#include "routemap.h"
#include "frr_pthread.h"
+#include "zebra/zebra_router.h"
#include "zebra/zebra_errors.h"
#include "zebra/rib.h"
#include "zebra/zserv.h"
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();
prefix_list_reset();
route_map_finish();
- list_delete_and_null(&zebrad.client_list);
+ 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);
+ zebra_router_terminate();
+
frr_fini();
exit(0);
}
},
};
+static const struct frr_yang_module_info *zebra_yang_modules[] = {
+ &frr_interface_info,
+};
+
FRR_DAEMON_INFO(
zebra, ZEBRA, .vty_port = ZEBRA_VTY_PORT, .flags = FRR_NO_ZCLIENT,
.signals = zebra_signals, .n_signals = array_size(zebra_signals),
- .privs = &zserv_privs, )
+ .privs = &zserv_privs,
+
+ .yang_modules = zebra_yang_modules,
+ .n_yang_modules = array_size(zebra_yang_modules), )
/* Main startup routine. */
int main(int argc, char **argv)
{
// 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();
rib_init();
zebra_if_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);
/* RNH init */
zebra_rnh_init();
-
+
/* Error init */
zebra_error_init();