From: Mitesh Kanjariya Date: Tue, 20 Feb 2018 08:46:22 +0000 (-0800) Subject: bgpd: move l2vpn evpn related flags in struct bgp to af_flags X-Git-Tag: frr-5.0-dev~171^2~7 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=154faa5007767a23eeb1daed8a33421320a9276d;p=matthieu%2Ffrr.git bgpd: move l2vpn evpn related flags in struct bgp to af_flags 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 --- diff --git a/bgpd/bgp_evpn.h b/bgpd/bgp_evpn.h index cd3b7e3af2..064cc71349 100644 --- a/bgpd/bgp_evpn.h +++ b/bgpd/bgp_evpn.h @@ -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; diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c index c3cab18d2e..1720744439 100644 --- a/bgpd/bgp_evpn_vty.c +++ b/bgpd/bgp_evpn_vty.c @@ -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"); } diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index 220b6d989e..5b77be2be9 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -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;