]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgp: fix handling of bgp_process_queue to allow for RNs added
authorLou Berger <lberger@labn.net>
Mon, 28 Aug 2017 22:34:45 +0000 (18:34 -0400)
committerLou Berger <lberger@labn.net>
Tue, 29 Aug 2017 19:27:21 +0000 (15:27 -0400)
     during callback.  Issue introduced in PR #939.

Signed-off-by: Lou Berger <lberger@labn.net>
bgpd/bgp_route.c

index 49ea84602bbdcb92c2b18ae0c4e7b7d254044c67..f1885c5693c762c3fd651531b2cdf1fd7ced464b 100644 (file)
@@ -2201,18 +2201,20 @@ static wq_item_status bgp_process_wq(struct work_queue *wq, void *data)
        struct bgp_process_queue *pqnode = data;
        struct bgp *bgp = pqnode->bgp;
        struct bgp_table *table;
-       struct bgp_node *rn, *nrn;
+       struct bgp_node *rn;
 
        /* eoiu marker */
        if (CHECK_FLAG(pqnode->flags, BGP_PROCESS_QUEUE_EOIU_MARKER)) {
                bgp_process_main_one(bgp, NULL, 0, 0);
-
+               assert(STAILQ_FIRST(&pqnode->pqueue) == NULL); /* should always have dedicated wq call */
                return WQ_SUCCESS;
        }
 
-       STAILQ_FOREACH_SAFE(rn, &pqnode->pqueue, pq, nrn) {
+       while (!STAILQ_EMPTY(&pqnode->pqueue)) {
+               rn = STAILQ_FIRST(&pqnode->pqueue);
+               STAILQ_REMOVE_HEAD(&pqnode->pqueue, pq);
                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);
 
                bgp_unlock_node(rn);