summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_evpn_private.h
diff options
context:
space:
mode:
Diffstat (limited to 'bgpd/bgp_evpn_private.h')
-rw-r--r--bgpd/bgp_evpn_private.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/bgpd/bgp_evpn_private.h b/bgpd/bgp_evpn_private.h
index 54e9b014c..5d59ed5ae 100644
--- a/bgpd/bgp_evpn_private.h
+++ b/bgpd/bgp_evpn_private.h
@@ -61,6 +61,8 @@ struct bgpevpn {
#define VNI_FLAG_RD_CFGD 0x4 /* RD is user configured. */
#define VNI_FLAG_IMPRT_CFGD 0x8 /* Import RT is user configured */
#define VNI_FLAG_EXPRT_CFGD 0x10 /* Export RT is user configured */
+#define VNI_FLAG_USE_TWO_LABELS 0x20 /* Attach both L2-VNI and L3-VNI if
+ needed for this VPN */
struct bgp *bgp_vrf; /* back pointer to the vrf instance */
@@ -166,9 +168,10 @@ static inline void bgpevpn_unlink_from_l3vni(struct bgpevpn *vpn)
/* bail if vpn is not associated to bgp_vrf */
if (!vpn->bgp_vrf)
return;
-
+
+ UNSET_FLAG(vpn->flags, VNI_FLAG_USE_TWO_LABELS);
listnode_delete(vpn->bgp_vrf->l2vnis, vpn);
-
+
/* remove the backpointer to the vrf instance */
vpn->bgp_vrf = NULL;
}
@@ -182,12 +185,17 @@ static inline void bgpevpn_link_to_l3vni(struct bgpevpn *vpn)
return;
bgp_vrf = bgp_lookup_by_vrf_id(vpn->tenant_vrf_id);
- if (!bgp_vrf || !bgp_vrf->l2vnis)
+ if (!bgp_vrf)
return;
/* associate the vpn to the bgp_vrf instance */
vpn->bgp_vrf = 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))
+ SET_FLAG(vpn->flags, VNI_FLAG_USE_TWO_LABELS);
}
static inline int is_vni_configured(struct bgpevpn *vpn)