From 5f9c1aa29eab6052403fdf2df2c1d7c543da687c Mon Sep 17 00:00:00 2001 From: bisdhdh Date: Thu, 24 Oct 2019 00:45:43 +0530 Subject: bgpd: Fix for BGP core when connected routes are redistributed & GR is enabled. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When GR with deferral is enabled and connected routes are distributed then in one race condition route node gets added in to both deferred queue and work queue. If deferred queue gets processed first then it ends up delete only flag while leaving the entry in the work queue as it is. When a new update comes for the same route node next time from peer then it hits assert. Assert check is added to ensure we don’t add to work queue again while it is already present. So, check before adding in to deferred queue if it is already present in work queue and bail if so. Signed-off-by: Biswajit Sadhu --- bgpd/bgp_route.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index e58158957..75963def8 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -314,6 +314,15 @@ static int bgp_node_set_defer_flag(struct bgp_node *rn, bool delete) if (CHECK_FLAG(rn->flags, BGP_NODE_SELECT_DEFER) && (delete == false)) return 0; + if (CHECK_FLAG(rn->flags, BGP_NODE_PROCESS_SCHEDULED)) { + if (BGP_DEBUG(update, UPDATE_OUT)) { + prefix2str(&rn->p, buf, PREFIX2STR_BUFFER); + zlog_debug("Route %s is in workqueue and being processed, not deferred.", + buf); + } + return 0; + } + table = bgp_node_table(rn); if (table) { bgp = table->bgp; -- cgit v1.2.3