summaryrefslogtreecommitdiff
path: root/zebra/zebra_rib.c
diff options
context:
space:
mode:
authorMark Stapp <mjs@voltanet.io>2019-09-27 12:15:34 -0400
committerMark Stapp <mjs@voltanet.io>2019-09-27 12:15:34 -0400
commit2fc69f03d2f49fcf34948e82e865cd302ae08da0 (patch)
tree8a7d4cd5dc7c4aee567e627593d10fe0fe3f2b39 /zebra/zebra_rib.c
parent5300176ff82a6ba88e84bbf0eac25a883505b585 (diff)
zebra: during shutdown processing, drop dplane results
Don't process dataplane results in zebra during shutdown (after sigint has been seen). The dplane continues to run in order to clean up, but zebra main just drops results. Signed-off-by: Mark Stapp <mjs@voltanet.io>
Diffstat (limited to 'zebra/zebra_rib.c')
-rw-r--r--zebra/zebra_rib.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index 98e66cd017..fef54d5828 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -3204,6 +3204,7 @@ static int rib_process_dplane_results(struct thread *thread)
{
struct zebra_dplane_ctx *ctx;
struct dplane_ctx_q ctxlist;
+ bool shut_p = false;
/* Dequeue a list of completed updates with one lock/unlock cycle */
@@ -3223,6 +3224,21 @@ static int rib_process_dplane_results(struct thread *thread)
if (ctx == NULL)
break;
+ /* If zebra is shutting down, avoid processing results,
+ * just drain the results queue.
+ */
+ shut_p = atomic_load_explicit(&zrouter.in_shutdown,
+ memory_order_relaxed);
+ if (shut_p) {
+ while (ctx) {
+ dplane_ctx_fini(&ctx);
+
+ ctx = dplane_ctx_dequeue(&ctxlist);
+ }
+
+ continue;
+ }
+
while (ctx) {
switch (dplane_ctx_get_op(ctx)) {
case DPLANE_OP_ROUTE_INSTALL: