Skip to content

Commit 5abf1ee

Browse files
authored
Merge pull request FRRouting#20050 from raja-rajasekar/rajasekarr/l2_l3vni_safefix
bgpd: Link L2VNI to L3VNI only when it really exists
2 parents 1ab7631 + e63258f commit 5abf1ee

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)