]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: Move multicast mode to being a property of the router 4417/head
authorDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 15 Feb 2019 14:06:58 +0000 (09:06 -0500)
committerStephen Worley <sworley@cumulusnetworks.com>
Wed, 29 May 2019 19:25:33 +0000 (15:25 -0400)
The multicast mode enum was a global static in zebra_rib.c
it does not belong there, it belongs in zebra_router, moving.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
zebra/rib.h
zebra/zebra_rib.c
zebra/zebra_router.c
zebra/zebra_router.h

index a54e164d98c64c2d4c1dc21280563fdab05ae77d..292f6bc6004239001f71c2cfea97cee38799a7eb 100644 (file)
@@ -340,19 +340,6 @@ extern void route_entry_copy_nexthops(struct route_entry *re,
 extern void _route_entry_dump(const char *func, union prefixconstptr pp,
                              union prefixconstptr src_pp,
                              const struct route_entry *re);
-/* 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 */
-};
-
-extern void multicast_mode_ipv4_set(enum multicast_mode mode);
-extern enum multicast_mode multicast_mode_ipv4_get(void);
 
 extern void rib_lookup_and_dump(struct prefix_ipv4 *p, vrf_id_t vrf_id);
 extern void rib_lookup_and_pushup(struct prefix_ipv4 *p, vrf_id_t vrf_id);
index 600e820bc47e3205029c9806caba4d689f436ee5..b38a3f08d3ec635714f0e3418bfd094d1aa73be8 100644 (file)
@@ -108,10 +108,6 @@ static const struct {
        /* no entry/default: 150 */
 };
 
-/* RPF lookup behaviour */
-static enum multicast_mode ipv4_multicast_mode = MCAST_NO_CONFIG;
-
-
 static void __attribute__((format(printf, 5, 6)))
 _rnode_zlog(const char *_func, vrf_id_t vrf_id, struct route_node *rn,
            int priority, const char *msgfmt, ...)
@@ -404,7 +400,7 @@ struct route_entry *rib_match_ipv4_multicast(vrf_id_t vrf_id,
        struct route_node *m_rn = NULL, *u_rn = NULL;
        union g_addr gaddr = {.ipv4 = addr};
 
-       switch (ipv4_multicast_mode) {
+       switch (zrouter.ipv4_multicast_mode) {
        case MCAST_MRIB_ONLY:
                return rib_match(AFI_IP, SAFI_MULTICAST, vrf_id, &gaddr,
                                 rn_out);
@@ -456,19 +452,6 @@ struct route_entry *rib_match_ipv4_multicast(vrf_id_t vrf_id,
        return re;
 }
 
-void multicast_mode_ipv4_set(enum multicast_mode mode)
-{
-       if (IS_ZEBRA_DEBUG_RIB)
-               zlog_debug("%s: multicast lookup mode set (%d)", __func__,
-                          mode);
-       ipv4_multicast_mode = mode;
-}
-
-enum multicast_mode multicast_mode_ipv4_get(void)
-{
-       return ipv4_multicast_mode;
-}
-
 struct route_entry *rib_lookup_ipv4(struct prefix_ipv4 *p, vrf_id_t vrf_id)
 {
        struct route_table *table;
index 610d51d3ea34b0c666ea0a70ed7b60aba377d6bd..4352d688a1da7b04f552532ed5005ddeba95a6d3 100644 (file)
 #include "zebra_pbr.h"
 #include "zebra_vxlan.h"
 #include "zebra_mlag.h"
+#include "zebra_nhg.h"
+#include "debug.h"
 
 struct zebra_router zrouter = {
        .multipath_num = MULTIPATH_NUM,
+       .ipv4_multicast_mode = MCAST_NO_CONFIG,
 };
 
 static inline int
@@ -187,6 +190,19 @@ uint32_t zebra_router_get_next_sequence(void)
                                           memory_order_relaxed);
 }
 
+void multicast_mode_ipv4_set(enum multicast_mode mode)
+{
+       if (IS_ZEBRA_DEBUG_RIB)
+               zlog_debug("%s: multicast lookup mode set (%d)", __func__,
+                          mode);
+       zrouter.ipv4_multicast_mode = mode;
+}
+
+enum multicast_mode multicast_mode_ipv4_get(void)
+{
+       return zrouter.ipv4_multicast_mode;
+}
+
 void zebra_router_terminate(void)
 {
        struct zebra_router_table *zrt, *tmp;
index 6c9f3a0f281b7857ec0c7afe66682f5560f8dcad..092cf2e049db3f232b5f3c20814cbc6935cb5695 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;
@@ -113,6 +124,9 @@ struct zebra_router {
 
        uint32_t multipath_num;
 
+       /* RPF Lookup behavior */
+       enum multicast_mode ipv4_multicast_mode;
+
        /*
         * Time for when we sweep the rib from old routes
         */
@@ -153,6 +167,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