From: vivek Date: Tue, 3 Aug 2021 05:06:28 +0000 (-0700) Subject: bgpd: Handle quick flaps of an EVPN prefix properly X-Git-Tag: frr-8.2.2~668^2 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=9146341f0621f75059d4b14341d09e2a2a28fec0;p=mirror_frr.git bgpd: Handle quick flaps of an EVPN prefix properly When an EVPN prefix flaps too quickly such that the new advertisement is received prior to the full processing of the prior withdraw, we may get into a state where the route doesn't get imported properly into MAC or IP VRFs. Ensure that we do the route import in such cases. Suggested-by: Sri Mohana Singamsetty Suggested-by: Ameya Dharkar Signed-off-by: Vivek Venkatraman --- diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 4299ea352..d314da31d 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -3607,6 +3607,7 @@ int bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id, afi_t nh_afi; uint8_t pi_type = 0; uint8_t pi_sub_type = 0; + bool force_evpn_import = false; if (frrtrace_enabled(frr_bgp, process_update)) { char pfxprint[PREFIX2STR_BUFFER]; @@ -3919,6 +3920,14 @@ int bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id, } bgp_path_info_restore(dest, pi); + + /* + * If the BGP_PATH_REMOVED flag is set, then EVPN + * routes would have been unimported already when a + * prior BGP withdraw processing happened. Such routes + * need to be imported again, so flag accordingly. + */ + force_evpn_import = true; } /* Received Logging. */ @@ -4141,7 +4150,7 @@ int bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id, #endif /* If this is an EVPN route and some attribute has changed, - * process + * or we are explicitly told to perform a route import, process * route for import. If the extended community has changed, we * would * have done the un-import earlier and the import would result @@ -4152,7 +4161,8 @@ int bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id, * updating * the attributes for the route in the VNI(s). */ - if (safi == SAFI_EVPN && !same_attr && + if (safi == SAFI_EVPN && + (!same_attr || force_evpn_import) && CHECK_FLAG(pi->flags, BGP_PATH_VALID)) bgp_evpn_import_route(bgp, afi, safi, p, pi);