summaryrefslogtreecommitdiffstats
path: root/zebra/main.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2018-10-28 21:10:45 +0100
committerGitHub <noreply@github.com>2018-10-28 21:10:45 +0100
commit69c19e1def9b96f5b1f11aa2a6e5321f208e7042 (patch)
treee31191a9744f36bf59416dcfd19dd0ade78c2092 /zebra/main.c
parentMerge pull request #3252 from opensourcerouting/buildfoo-20181028 (diff)
parentzebra: only perform shutdown signal processing once (diff)
downloadfrr-69c19e1def9b96f5b1f11aa2a6e5321f208e7042.tar.xz
frr-69c19e1def9b96f5b1f11aa2a6e5321f208e7042.zip
Merge pull request #2946 from mjstapp/dplane_2
Zebra: async dataplane, phase 1
Diffstat (limited to 'zebra/main.c')
-rw-r--r--zebra/main.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/zebra/main.c b/zebra/main.c
index d8952a7b2..ce18cf849 100644
--- a/zebra/main.c
+++ b/zebra/main.c
@@ -143,11 +143,19 @@ 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");
frr_early_fini();
+ zebra_dplane_pre_finish();
+
for (ALL_LIST_ELEMENTS(zebrad.client_list, ln, nn, client))
zserv_close_client(client);
@@ -172,6 +180,25 @@ static void sigint(void)
route_map_finish();
list_delete(&zebrad.client_list);
+
+ /* 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();
+}
+
+/*
+ * 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");
+
+ /* Stop dplane thread and finish any cleanup */
+ zebra_dplane_shutdown();
+
work_queue_free_and_null(&zebrad.ribq);
meta_queue_free(zebrad.mq);