summaryrefslogtreecommitdiffstats
path: root/sharpd/sharp_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'sharpd/sharp_main.c')
-rw-r--r--sharpd/sharp_main.c50
1 files changed, 32 insertions, 18 deletions
diff --git a/sharpd/sharp_main.c b/sharpd/sharp_main.c
index fa85c2b..f4ce147 100644
--- a/sharpd/sharp_main.c
+++ b/sharpd/sharp_main.c
@@ -54,6 +54,23 @@ struct zebra_privs_t sharp_privs = {
struct option longopts[] = {{0}};
+struct sharp_global sg;
+
+static void sharp_global_init(void)
+{
+ memset(&sg, 0, sizeof(sg));
+ sg.nhs = list_new();
+ sg.nhs->del = (void (*)(void *))sharp_nh_tracker_free;
+ sg.ted = NULL;
+ sg.srv6_locators = list_new();
+}
+
+static void sharp_global_destroy(void)
+{
+ list_delete(&sg.nhs);
+ list_delete(&sg.srv6_locators);
+}
+
/* Master of threads. */
struct event_loop *master;
@@ -68,6 +85,11 @@ static void sigint(void)
{
zlog_notice("Terminating on signal");
+ vrf_terminate();
+ sharp_zebra_terminate();
+
+ sharp_global_destroy();
+
frr_fini();
exit(0);
@@ -98,8 +120,6 @@ struct frr_signal_t sharp_signals[] = {
},
};
-#define SHARP_VTY_PORT 2614
-
static const struct frr_yang_module_info *const sharpd_yang_modules[] = {
&frr_filter_info,
&frr_interface_info,
@@ -107,26 +127,20 @@ static const struct frr_yang_module_info *const sharpd_yang_modules[] = {
&frr_vrf_info,
};
-FRR_DAEMON_INFO(sharpd, SHARP, .vty_port = SHARP_VTY_PORT,
+/* clang-format off */
+FRR_DAEMON_INFO(sharpd, SHARP,
+ .vty_port = SHARP_VTY_PORT,
+ .proghelp = "Implementation of a Sharp of routes daemon.",
- .proghelp = "Implementation of a Sharp of routes daemon.",
+ .signals = sharp_signals,
+ .n_signals = array_size(sharp_signals),
- .signals = sharp_signals,
- .n_signals = array_size(sharp_signals),
+ .privs = &sharp_privs,
- .privs = &sharp_privs, .yang_modules = sharpd_yang_modules,
- .n_yang_modules = array_size(sharpd_yang_modules),
+ .yang_modules = sharpd_yang_modules,
+ .n_yang_modules = array_size(sharpd_yang_modules),
);
-
-struct sharp_global sg;
-
-static void sharp_global_init(void)
-{
- memset(&sg, 0, sizeof(sg));
- sg.nhs = list_new();
- sg.ted = NULL;
- sg.srv6_locators = list_new();
-}
+/* clang-format on */
static void sharp_start_configuration(void)
{