From: Lou Berger Date: Tue, 29 Aug 2017 19:30:34 +0000 (-0400) Subject: bgp: add asserts to catch unsupported double enqueue of an RN on a bgp_process_queue X-Git-Tag: frr-4.0-dev~361^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=b3e1dd3ca47e0cbae3b2a6485e0a3a92b544173e;p=mirror%2Ffrr.git bgp: add asserts to catch unsupported double enqueue of an RN on a bgp_process_queue Signed-off-by: Lou Berger --- diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index f1885c5693..f19e65b2e5 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -2213,6 +2213,7 @@ static wq_item_status bgp_process_wq(struct work_queue *wq, void *data) while (!STAILQ_EMPTY(&pqnode->pqueue)) { rn = STAILQ_FIRST(&pqnode->pqueue); STAILQ_REMOVE_HEAD(&pqnode->pqueue, pq); + STAILQ_NEXT(rn, pq) = NULL; /* complete unlink */ table = bgp_node_table(rn); /* note, new RNs may be added as part of processing */ bgp_process_main_one(bgp, rn, table->afi, table->safi); @@ -2299,6 +2300,7 @@ void bgp_process(struct bgp *bgp, struct bgp_node *rn, afi_t afi, safi_t safi) SET_FLAG(rn->flags, BGP_NODE_PROCESS_SCHEDULED); bgp_lock_node(rn); + assert(STAILQ_NEXT(rn, pq) == NULL); /* can't be enqueued twice */ STAILQ_INSERT_TAIL(&pqnode->pqueue, rn, pq); pqnode->queued++;