Skip to content

Commit 7cb8e8e

Browse files
raja-rajasekarPdoijode
authored andcommitted
bgpd: [EVPN GR] fix EVPN GR for non default vrf
Consider a case where default vrf is EVPN enabled and there are some tenant VRFs with no peers which imports some routes from default VRF. With the current code for EVPN GR, BGP declares GR completion after the default VRF is complete and not wait for other VRFs to complete its deferral path selection. Reason for this is because of the following sequence of events, a) Since there are no peers in tenant VRFs(non default VRFs), we prematurely send UPDATE_PENDING + UPDATE_COMPLETE in peer_unshut_after_cfg(). b) When bgp_do_deferred_path_selection() is invoked for default VRF, it completes the deferred path calculation and calls bgp_evpn_handle_deferred_bestpath_for_vrfs() to enqueue the deferred path selection for non default VRFs. c) It then(for default VRF) sends UPDATE_COMPLETE followed by GR done for all instances from BGP pov because the deferral related variables are not set appropriately for non default VRFs (especially gr_route_sync_pending) Fixing the above by setting deferral related variables for non default VRFs appropriately and sending UPDATE_PENDING accordingly. Signed-off-by: Rajasekar Raja <[email protected]> Signed-off-by: Chirag Shah <[email protected]> Signed-off-by: Vijayalaxmi Basavaraj <[email protected]>
1 parent 60f542a commit 7cb8e8e

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

bgpd/bgp_route.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4281,6 +4281,33 @@ static inline void bgp_evpn_handle_deferred_bestpath_for_vrfs(void)
42814281
bgp_vrf->name_pretty,
42824282
get_afi_safi_str(tmp_afi, tmp_safi, false));
42834283

4284+
/*
4285+
* Below piece of code is to handle non default EVPN VRF
4286+
* instances where the variables are to be set
4287+
* appropriately.
4288+
*
4289+
* NOTE:
4290+
* - Prior to this change, peer_unshut_after_cfg() sends
4291+
* UPD_PENDING + UPD_COMPLETE for non default VRFs
4292+
* prematurely.
4293+
* - So, when default vrf deferral calculation is
4294+
* complete, it invokes this function to queue the
4295+
* deferral for non default vrfs.
4296+
* - However it then ends up sending the UPDATE_COMPLETE
4297+
* and marks GR done for all instances since the below
4298+
* variables (especially gr_route_sync_pending) are
4299+
* not set for non default vrfs.
4300+
*
4301+
* Sending UPDATE_PENDING here makes sense to tell zebra
4302+
* that the non default VRF is a work in progress and is
4303+
* yet to go through the deferred path selection.
4304+
*/
4305+
bgp_vrf->gr_route_sync_pending = true;
4306+
bgp_vrf->gr_info[tmp_afi][tmp_safi].af_enabled = true;
4307+
bgp_zebra_update(bgp_vrf, tmp_afi, tmp_safi,
4308+
ZEBRA_CLIENT_ROUTE_UPDATE_PENDING);
4309+
bgp_vrf->gr_info[tmp_afi][tmp_safi].select_defer_over = true;
4310+
42844311
/*
42854312
* The reason why we are starting the timer and
42864313
* not doing deferred BP calculation in place is

0 commit comments

Comments
 (0)