summaryrefslogtreecommitdiffstats
path: root/zebra/main.c
diff options
context:
space:
mode:
authorMark Stapp <mjs@voltanet.io>2018-10-15 17:14:07 +0200
committerMark Stapp <mjs@voltanet.io>2018-10-25 14:57:04 +0200
commitff2460d5972a21363dab55cf874fc740380e5e55 (patch)
treefb7a52dd05fc3046e38834bfacf8417725e670dc /zebra/main.c
parentzebra: rebase dataplane, align with master (diff)
downloadfrr-ff2460d5972a21363dab55cf874fc740380e5e55.tar.xz
frr-ff2460d5972a21363dab55cf874fc740380e5e55.zip
zebra: only perform shutdown signal processing once
Avoid running the shutdown/sigint handler code more than once. With the async dataplane, once shutdown has been initiated, the completion of all async updates triggers final shutdown of the zebra main pthread. During that time, avoid taking and processing a second signal, such as SIGINT or SIGTERM. Signed-off-by: Mark Stapp <mjs@voltanet.io>
Diffstat (limited to 'zebra/main.c')
-rw-r--r--zebra/main.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/zebra/main.c b/zebra/main.c
index 955ab0445..253b3087f 100644
--- a/zebra/main.c
+++ b/zebra/main.c
@@ -142,6 +142,12 @@ static void sigint(void)
struct zebra_vrf *zvrf;
struct listnode *ln, *nn;
struct zserv *client;
+ static bool sigint_done;
+
+ if (sigint_done)
+ return;
+
+ sigint_done = true;
zlog_notice("Terminating on signal");
@@ -174,11 +180,17 @@ static void sigint(void)
list_delete(&zebrad.client_list);
- /* Indicate that all new dplane work has been enqueued */
+ /* Indicate that all new dplane work has been enqueued. When that
+ * work is complete, the dataplane will enqueue an event
+ * with the 'finalize' function.
+ */
zebra_dplane_finish();
}
-/* TODO */
+/*
+ * Final shutdown step for the zebra main thread. This is run after all
+ * async update processing has completed.
+ */
int zebra_finalize(struct thread *dummy)
{
zlog_info("Zebra final shutdown");