bgpd: During NHT change evaluation, skip inappropriate paths

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>
This commit is contained in:
vivek 2020-05-25 14:17:12 -07:00
parent 34ea39b65a
commit 0139efe084

View 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)