summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss White <russ@riw.us>2020-05-26 12:14:16 -0400
committerGitHub <noreply@github.com>2020-05-26 12:14:16 -0400
commiteeec40ba69ddb56ab479c61d8a9fb992ca6db914 (patch)
tree7b99d8dbe8619d3c0b10c364a172798bdc2baff5
parent06fba5cb4cc707cf690f0fd5fb3fc02d365aadf0 (diff)
parent10f70510b952914cf3bacdd5101c52a245c5fead (diff)
Merge pull request #6375 from adharkar/frr-master-l3vni_label
bgpd: EVPN RT-2 advertised with 2 labels for prefix-routes-only config
-rw-r--r--bgpd/bgp_evpn.c24
-rw-r--r--bgpd/bgp_evpn_private.h8
2 files changed, 29 insertions, 3 deletions
diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c
index ae94235194..29cc9ac1eb 100644
--- a/bgpd/bgp_evpn.c
+++ b/bgpd/bgp_evpn.c
@@ -5824,9 +5824,31 @@ int bgp_evpn_local_l3vni_add(vni_t l3vni, vrf_id_t vrf_id,
is_anycast_mac ? "Enable" : "Disable");
}
/* set the right filter - are we using l3vni only for prefix routes? */
- if (filter)
+ if (filter) {
SET_FLAG(bgp_vrf->vrf_flags, BGP_VRF_L3VNI_PREFIX_ROUTES_ONLY);
+ /*
+ * VNI_FLAG_USE_TWO_LABELS flag for linked L2VNIs should not be
+ * set before linking vrf to L3VNI. Thus, no need to clear
+ * that explicitly.
+ */
+ } else {
+ UNSET_FLAG(bgp_vrf->vrf_flags,
+ BGP_VRF_L3VNI_PREFIX_ROUTES_ONLY);
+
+ for (ALL_LIST_ELEMENTS_RO(bgp_vrf->l2vnis, node, vpn)) {
+ if (!CHECK_FLAG(vpn->flags, VNI_FLAG_USE_TWO_LABELS)) {
+
+ /*
+ * If we are flapping VNI_FLAG_USE_TWO_LABELS
+ * flag, update all MACIP routes in this VNI
+ */
+ SET_FLAG(vpn->flags, VNI_FLAG_USE_TWO_LABELS);
+ update_all_type2_routes(bgp_evpn, vpn);
+ }
+ }
+ }
+
/* Map auto derive or configured RTs */
if (!CHECK_FLAG(bgp_vrf->vrf_flags, BGP_VRF_IMPORT_RT_CFGD))
evpn_auto_rt_import_add_for_vrf(bgp_vrf);
diff --git a/bgpd/bgp_evpn_private.h b/bgpd/bgp_evpn_private.h
index ea1ae087f1..c7ccf69f05 100644
--- a/bgpd/bgp_evpn_private.h
+++ b/bgpd/bgp_evpn_private.h
@@ -270,8 +270,12 @@ static inline void bgpevpn_link_to_l3vni(struct bgpevpn *vpn)
vpn->bgp_vrf = bgp_lock(bgp_vrf);
listnode_add_sort(bgp_vrf->l2vnis, vpn);
- /* check if we are advertising two labels for this vpn */
- if (!CHECK_FLAG(bgp_vrf->vrf_flags, BGP_VRF_L3VNI_PREFIX_ROUTES_ONLY))
+ /*
+ * If L3VNI is configured,
+ * check if we are advertising two labels for this vpn
+ */
+ if (bgp_vrf->l3vni &&
+ !CHECK_FLAG(bgp_vrf->vrf_flags, BGP_VRF_L3VNI_PREFIX_ROUTES_ONLY))
SET_FLAG(vpn->flags, VNI_FLAG_USE_TWO_LABELS);
}