]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgp: add asserts to catch unsupported double enqueue of an RN on a bgp_process_queue 1073/head
authorLou Berger <lberger@labn.net>
Tue, 29 Aug 2017 19:30:34 +0000 (15:30 -0400)
committerLou Berger <lberger@labn.net>
Tue, 29 Aug 2017 19:30:34 +0000 (15:30 -0400)
Signed-off-by: Lou Berger <lberger@labn.net>
bgpd/bgp_route.c

index f1885c5693c762c3fd651531b2cdf1fd7ced464b..f19e65b2e5c35b4271f6004f2db04e8f310e8397 100644 (file)
@@ -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++;