]> git.proxmox.com Git - mirror_frr.git/commit - bgpd/bgp_evpn_private.h
bgpd: EVPN RT-2 advertised with 2 labels for prefix-routes-only config
authorAmeya Dharkar <adharkar@vmware.com>
Thu, 7 May 2020 20:33:02 +0000 (13:33 -0700)
committerAmeya Dharkar <adharkar@vmware.com>
Sat, 9 May 2020 04:10:10 +0000 (21:10 -0700)
commit10f70510b952914cf3bacdd5101c52a245c5fead
tree68c8748fb4eb999ceea1d35b2e6a64f474f23b95
parentfaad472899e0be77160c134914b34d06365be949
bgpd: EVPN RT-2 advertised with 2 labels for prefix-routes-only config

L3VNI is configured with "prefix-routes-only" flag. Even in this case,
intermittently, we observed that local EVPN MACIP routes are installed and
advertised with 2 labels and 2 export RTs.

This is a sequencing issue. Consider following case where L2VNI 200 and L3VNI
1000 are configured for tenant vrf vrf-blue.

Bug is observed for following sequence of events:
1. vrf-blue BGP instance is created.
2. L2VNI is created in bgp for vni 200. It is linked to the tenant vrf vrf-blue
in function bgpevpn_link_to_l3vni.
Following code sets "VNI_FLAG_USE_TWO_LABELS" flag for vni 200 as L3VNI is not
yet attached to vrf-blue BGP instance.

/* 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);

2. Now L3VNI is attached to vrf-blue BGP instance. In this case, we set
BGP_VRF_L3VNI_PREFIX_ROUTES_ONLY flag for vrf-blue but we do not clear
VNI_FLAG_USE_TWO_LABELS flag set on the corresponding L2VNIs.

This fix resolves following 2 issues observed above.
1. When L2VNI is created in BGP, flag VNI_FLAG_USE_TWO_LABELS should not be set
for this VNI if BGP vrf is not attached to any L3VNI.
2. When L3VNI is attached to the BGP vrf, set "VNI_FLAG_USE_TWO_LABELS" flag
if "prefix-routes-only" is not for the vrf.

UT cases:
1. Flap "prefix-routes-only" config for a vrf.
2. Test following triggers for vrfs with and without "prefix-routes-only"
   - Flap L2VNI from kernel.
   - Flap L3VNI from kernel.

Signed-off-by: Ameya Dharkar <adharkar@vmware.com>
bgpd/bgp_evpn.c
bgpd/bgp_evpn_private.h