]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: move l2vpn evpn related flags in struct bgp to af_flags
authorMitesh Kanjariya <mitesh@marvel-07.cumulusnetworks.com>
Tue, 20 Feb 2018 08:46:22 +0000 (00:46 -0800)
committermitesh <mitesh@cumulusnetworks.com>
Fri, 23 Feb 2018 01:24:36 +0000 (17:24 -0800)
We have af_flags in struct bgp to hold address family related flags,
l2vpn evpn flags to indicate advertise ipvX unicast should be moved there.

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
bgpd/bgp_evpn.h
bgpd/bgp_evpn_vty.c
bgpd/bgpd.h

index cd3b7e3af2c8648c1375a68bb8b638fbc68e12cd..064cc7134975986377ceb1babbe25972595695b2 100644 (file)
@@ -62,11 +62,13 @@ static inline int advertise_type5_routes(struct bgp *bgp_vrf,
                return 0;
 
        if (afi == AFI_IP &&
-           CHECK_FLAG(bgp_vrf->vrf_flags, BGP_VRF_ADVERTISE_IPV4_IN_EVPN))
+           CHECK_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN],
+                      BGP_L2VPN_EVPN_ADVERTISE_IPV4_UNICAST))
                return 1;
 
        if (afi == AFI_IP6 &&
-           CHECK_FLAG(bgp_vrf->vrf_flags, BGP_VRF_ADVERTISE_IPV6_IN_EVPN))
+           CHECK_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN],
+                      BGP_L2VPN_EVPN_ADVERTISE_IPV6_UNICAST))
                return 1;
 
        return 0;
index c3cab18d2e77c132e00651d8840acd6e7c919b73..1720744439055001f1903e85e1b1c7d2b30cece5 100644 (file)
@@ -2761,21 +2761,23 @@ DEFUN (bgp_evpn_advertise_type5,
                /* if we are already advertising ipv4 prefix as type-5
                 * nothing to do
                 */
-               if (!rmap_changed && CHECK_FLAG(bgp_vrf->vrf_flags,
-                                               BGP_VRF_ADVERTISE_IPV4_IN_EVPN))
+               if (!rmap_changed &&
+                   CHECK_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN],
+                              BGP_L2VPN_EVPN_ADVERTISE_IPV4_UNICAST))
                        return CMD_WARNING;
-               SET_FLAG(bgp_vrf->vrf_flags,
-                        BGP_VRF_ADVERTISE_IPV4_IN_EVPN);
+               SET_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN],
+                        BGP_L2VPN_EVPN_ADVERTISE_IPV4_UNICAST);
        } else {
 
                /* if we are already advertising ipv6 prefix as type-5
                 * nothing to do
                 */
-               if (!rmap_changed && CHECK_FLAG(bgp_vrf->vrf_flags,
-                                               BGP_VRF_ADVERTISE_IPV6_IN_EVPN))
+               if (!rmap_changed &&
+                   CHECK_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN],
+                              BGP_L2VPN_EVPN_ADVERTISE_IPV6_UNICAST))
                        return CMD_WARNING;
-               SET_FLAG(bgp_vrf->vrf_flags,
-                        BGP_VRF_ADVERTISE_IPV6_IN_EVPN);
+               SET_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN],
+                        BGP_L2VPN_EVPN_ADVERTISE_IPV6_UNICAST);
        }
 
        if (rmap_changed) {
@@ -2836,22 +2838,22 @@ DEFUN (no_bgp_evpn_advertise_type5,
                /* if we are not advertising ipv4 prefix as type-5
                 * nothing to do
                 */
-               if (CHECK_FLAG(bgp_vrf->vrf_flags,
-                              BGP_VRF_ADVERTISE_IPV4_IN_EVPN)) {
+               if (CHECK_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN],
+                              BGP_L2VPN_EVPN_ADVERTISE_IPV4_UNICAST)) {
                        bgp_evpn_withdraw_type5_routes(bgp_vrf, afi, safi);
-                       UNSET_FLAG(bgp_vrf->vrf_flags,
-                                  BGP_VRF_ADVERTISE_IPV4_IN_EVPN);
+                       UNSET_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN],
+                                  BGP_L2VPN_EVPN_ADVERTISE_IPV4_UNICAST);
                }
        } else {
 
                /* if we are not advertising ipv6 prefix as type-5
                 * nothing to do
                 */
-               if (CHECK_FLAG(bgp_vrf->vrf_flags,
-                              BGP_VRF_ADVERTISE_IPV6_IN_EVPN)) {
+               if (CHECK_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN],
+                              BGP_L2VPN_EVPN_ADVERTISE_IPV6_UNICAST)) {
                        bgp_evpn_withdraw_type5_routes(bgp_vrf, afi, safi);
                        UNSET_FLAG(bgp_vrf->vrf_flags,
-                                  BGP_VRF_ADVERTISE_IPV6_IN_EVPN);
+                                  BGP_L2VPN_EVPN_ADVERTISE_IPV6_UNICAST);
                }
        }
 
@@ -4373,10 +4375,12 @@ void bgp_config_write_evpn_info(struct vty *vty, struct bgp *bgp, afi_t afi,
        if (bgp->advertise_gw_macip)
                vty_out(vty, "  advertise-default-gw\n");
 
-       if (CHECK_FLAG(bgp->vrf_flags, BGP_VRF_ADVERTISE_IPV4_IN_EVPN))
+       if (CHECK_FLAG(bgp->af_flags[AFI_L2VPN][SAFI_EVPN],
+                      BGP_L2VPN_EVPN_ADVERTISE_IPV4_UNICAST))
                vty_out(vty, "  advertise ipv4 unicast\n");
 
-       if (CHECK_FLAG(bgp->vrf_flags, BGP_VRF_ADVERTISE_IPV6_IN_EVPN))
+       if (CHECK_FLAG(bgp->af_flags[AFI_L2VPN][SAFI_EVPN],
+                      BGP_L2VPN_EVPN_ADVERTISE_IPV6_UNICAST))
                vty_out(vty, "  advertise ipv6 unicast\n");
 }
 
index 220b6d989e43b551f98b8275d4884b85f7c6c14d..5b77be2be9db438037227959bbaf4128bfc9b4e3 100644 (file)
@@ -320,6 +320,11 @@ struct bgp {
        u_int16_t af_flags[AFI_MAX][SAFI_MAX];
 #define BGP_CONFIG_DAMPENING              (1 << 0)
 
+/* l2vpn evpn flags */
+#define BGP_L2VPN_EVPN_ADVERTISE_IPV4_UNICAST      (1 << 0)
+#define BGP_L2VPN_EVPN_ADVERTISE_IPV6_UNICAST      (1 << 1)
+
+
        /* Route table for next-hop lookup cache. */
        struct bgp_table *nexthop_cache_table[AFI_MAX];
 
@@ -431,11 +436,9 @@ struct bgp {
        /* vrf flags */
        uint32_t vrf_flags;
 #define BGP_VRF_AUTO                        (1 << 0)
-#define BGP_VRF_ADVERTISE_IPV4_IN_EVPN      (1 << 1)
-#define BGP_VRF_ADVERTISE_IPV6_IN_EVPN      (1 << 2)
-#define BGP_VRF_IMPORT_RT_CFGD              (1 << 3)
-#define BGP_VRF_EXPORT_RT_CFGD              (1 << 4)
-#define BGP_VRF_RD_CFGD                     (1 << 5)
+#define BGP_VRF_IMPORT_RT_CFGD              (1 << 1)
+#define BGP_VRF_EXPORT_RT_CFGD              (1 << 2)
+#define BGP_VRF_RD_CFGD                     (1 << 3)
 
        /* unique ID for auto derivation of RD for this vrf */
        uint16_t vrf_rd_id;