]> git.proxmox.com Git - mirror_frr.git/blobdiff - zebra/zebra_router.h
zebra: print unknown rule family as number
[mirror_frr.git] / zebra / zebra_router.h
index b3def297ac6bfdc59ce9da411df71da36fde8295..d8ad8a68646d778cfbba94438aa39ebaad3afe07 100644 (file)
@@ -50,6 +50,17 @@ RB_HEAD(zebra_router_table_head, zebra_router_table);
 RB_PROTOTYPE(zebra_router_table_head, zebra_router_table,
             zebra_router_table_entry, zebra_router_table_entry_compare)
 
+/* RPF lookup behaviour */
+enum multicast_mode {
+       MCAST_NO_CONFIG = 0,  /* MIX_MRIB_FIRST, but no show in config write */
+       MCAST_MRIB_ONLY,      /* MRIB only */
+       MCAST_URIB_ONLY,      /* URIB only */
+       MCAST_MIX_MRIB_FIRST, /* MRIB, if nothing at all then URIB */
+       MCAST_MIX_DISTANCE,   /* MRIB & URIB, lower distance wins */
+       MCAST_MIX_PFXLEN,     /* MRIB & URIB, longer prefix wins */
+                             /* on equal value, MRIB wins for last 2 */
+};
+
 struct zebra_mlag_info {
        /* Role this zebra router is playing */
        enum mlag_role role;
@@ -60,9 +71,46 @@ struct zebra_mlag_info {
 
        /* The system mac being used */
        struct ethaddr mac;
+       /*
+        * Zebra will open the communication channel with MLAGD only if any
+        * clients are interested and it is controlled dynamically based on
+        * client registers & un-registers.
+        */
+       uint32_t clients_interested_cnt;
+
+       /* coomunication channel with MLAGD is established */
+       bool connected;
+
+       /* connection retry timer is running */
+       bool timer_running;
+
+       /* Holds the client data(unencoded) that need to be pushed to MCLAGD*/
+       struct stream_fifo *mlag_fifo;
+
+       /*
+        * A new Kernel thread will be created to post the data to MCLAGD.
+        * where as, read will be performed from the zebra main thread, because
+        * read involves accessing client registartion data structures.
+        */
+       struct frr_pthread *zebra_pth_mlag;
+
+       /* MLAG Thread context 'master' */
+       struct thread_master *th_master;
+
+       /*
+        * Event for Initial MLAG Connection setup & Data Read
+        * Read can be performed only after successful connection establishment,
+        * so no issues.
+        *
+        */
+       struct thread *t_read;
+       /* Event for MLAG write */
+       struct thread *t_write;
 };
 
 struct zebra_router {
+       atomic_bool in_shutdown;
+
        /* Thread master */
        struct thread_master *master;
 
@@ -82,9 +130,8 @@ struct zebra_router {
 
        struct hash *iptable_hash;
 
-#if defined(HAVE_RTADV)
-       struct rtadv rtadv;
-#endif /* HAVE_RTADV */
+       /* used if vrf backend is not network namespace */
+       int rtadv_sock;
 
        /* A sequence number used for tracking routes */
        _Atomic uint32_t sequence_num;
@@ -112,11 +159,28 @@ struct zebra_router {
        struct zebra_vrf *evpn_vrf;
 
        uint32_t multipath_num;
+
+       /* RPF Lookup behavior */
+       enum multicast_mode ipv4_multicast_mode;
+
+       /*
+        * Time for when we sweep the rib from old routes
+        */
+       time_t startup_time;
+
+       /*
+        * The hash of nexthop groups associated with this router
+        */
+       struct hash *nhgs;
+       struct hash *nhgs_id;
 };
 
+#define GRACEFUL_RESTART_TIME 60
+
 extern struct zebra_router zrouter;
 
 extern void zebra_router_init(void);
+extern void zebra_router_cleanup(void);
 extern void zebra_router_terminate(void);
 
 extern struct route_table *zebra_router_find_table(struct zebra_vrf *zvrf,
@@ -131,6 +195,7 @@ extern void zebra_router_release_table(struct zebra_vrf *zvrf, uint32_t tableid,
 extern int zebra_router_config_write(struct vty *vty);
 
 extern void zebra_router_sweep_route(void);
+extern void zebra_router_sweep_nhgs(void);
 
 extern void zebra_router_show_table_summary(struct vty *vty);
 
@@ -146,6 +211,10 @@ static inline struct zebra_vrf *zebra_vrf_get_evpn(void)
                                : zebra_vrf_lookup_by_id(VRF_DEFAULT);
 }
 
+extern void multicast_mode_ipv4_set(enum multicast_mode mode);
+
+extern enum multicast_mode multicast_mode_ipv4_get(void);
+
 #ifdef __cplusplus
 }
 #endif