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);
work_queue_free_and_null(&zebrad.lsp_process_q);
vrf_terminate();
- ns_walk_func(zebra_ns_disabled);
+ ns_walk_func(zebra_ns_early_shutdown);
zebra_ns_notify_close();
access_list_reset();
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");
+
+ /* Final shutdown of ns resources */
+ ns_walk_func(zebra_ns_final_shutdown);
+
+ /* Stop dplane thread and finish any cleanup */
+ zebra_dplane_shutdown();
+
work_queue_free_and_null(&zebrad.ribq);
meta_queue_free(zebrad.mq);
{
// int batch_mode = 0;
char *zserv_path = NULL;
+ char *vrf_default_name_configured = NULL;
/* Socket to external label manager */
char *lblmgr_path = NULL;
struct sockaddr_storage dummy;
}
break;
case 'o':
- vrf_set_default_name(optarg);
+ vrf_default_name_configured = optarg;
break;
case 'z':
zserv_path = optarg;
}
}
- vty_config_lockless();
zebrad.master = frr_init();
+ /* Initialize pthread library */
+ frr_pthread_init();
+
/* Zebra related initialize. */
zebra_router_init();
zserv_init();
* Initialize NS( and implicitly the VRF module), and make kernel
* routing socket. */
zebra_ns_init();
-
+ if (vrf_default_name_configured)
+ vrf_set_default_name(vrf_default_name_configured,
+ true);
zebra_vty_init();
access_list_init();
prefix_list_init();
/* Needed for BSD routing socket. */
pid = getpid();
- /* Intialize pthread library */
- frr_pthread_init();
+ /* Start dataplane system */
+ zebra_dplane_start();
/* Start Zebra API server */
zserv_start(zserv_path);