]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: During NHT change evaluation, skip inappropriate paths
authorvivek <vivek@cumulusnetworks.com>
Mon, 25 May 2020 21:17:12 +0000 (14:17 -0700)
committervivek <vivek@cumulusnetworks.com>
Mon, 25 May 2020 21:17:12 +0000 (14:17 -0700)
When there is a NHT change and the paths dependent on that NHT are being
evaluated, skip those that are marked for removal or as history.

When a route gets withdrawn, its valid flag is cleared and it is flagged
for removal; in the case of an EVPN route, it is also unimported from
VRFs (L2 and/or L3). bgp_process is then scheduled. Under rare timing
conditions, an NHT update for the route's next hop may arrive right after,
and if routes flagged for removal are not skipped, they may not only be
incorrectly marked as valid but also re-imported in the case of EVPN,
which will be a serious error.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
bgpd/bgp_nht.c

index 78911c82f2294196a468410ba4e0e82f32f7210b..e3b05e8b79a66d0440334a6efefa8d630f627f8f 100644 (file)
@@ -776,6 +776,11 @@ static void evaluate_paths(struct bgp_nexthop_cache *bnc)
                                        path->flags);
                }
 
+               /* Skip paths marked for removal or as history. */
+               if (CHECK_FLAG(path->flags, BGP_PATH_REMOVED)
+                   || CHECK_FLAG(path->flags, BGP_PATH_HISTORY))
+                       continue;
+
                /* Copy the metric to the path. Will be used for bestpath
                 * computation */
                if (bgp_isvalid_nexthop(bnc) && bnc->metric)