Skip to content

Commit e63258f

Browse files
vivek-cumulusraja-rajasekar
authored andcommitted
bgpd: Link L2VNI to L3VNI only when it really exists
When a L2VNI is made known to bgpd, the current linking of it to L3VNI does not quite check if the L3VNI is known to bgpd. This is incorrect and can lead to problematic behavior in some situations. In one specific instance, if type-1 routes from a remote MH pair already exist, the ES-VRF association gets prematurely setup leading to the corresponding L3NHG getting setup with incorrect information. Note: Only additional checks are added in the linkage function. Code already exists to link all relevant L2VNIs to associated L3VNI when the L3VNI is learnt by bgpd. Signed-off-by: Vivek Venkatraman <vivek@nvidia.com>
1 parent d20531e commit e63258f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

bgpd/bgp_evpn_private.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,20 +280,23 @@ static inline void bgpevpn_link_to_l3vni(struct bgpevpn *vpn)
280280
if (vpn->bgp_vrf)
281281
return;
282282

283+
/* bail if VRF still doesn't exist */
283284
bgp_vrf = bgp_lookup_by_vrf_id(vpn->tenant_vrf_id);
284285
if (!bgp_vrf)
285286
return;
286287

288+
/* or if there is no l3vni */
289+
if (!bgp_vrf->l3vni)
290+
return;
291+
287292
/* associate the vpn to the bgp_vrf instance */
288293
vpn->bgp_vrf = bgp_lock(bgp_vrf);
289294
listnode_add_sort(bgp_vrf->l2vnis, vpn);
290295

291296
/*
292-
* If L3VNI is configured,
293297
* check if we are advertising two labels for this vpn
294298
*/
295-
if (bgp_vrf->l3vni &&
296-
!CHECK_FLAG(bgp_vrf->vrf_flags, BGP_VRF_L3VNI_PREFIX_ROUTES_ONLY))
299+
if (!CHECK_FLAG(bgp_vrf->vrf_flags, BGP_VRF_L3VNI_PREFIX_ROUTES_ONLY))
297300
SET_FLAG(vpn->flags, VNI_FLAG_USE_TWO_LABELS);
298301

299302
bgp_evpn_es_evi_vrf_ref(vpn);

0 commit comments

Comments
 (0)