diff --git a/zebra/main.c b/zebra/main.c index d34fdb3bf82c..5dd830b54241 100644 --- a/zebra/main.c +++ b/zebra/main.c @@ -236,6 +236,8 @@ void zebra_finalize(struct event *dummy) zebra_pw_terminate(); + zebra_srv6_terminate(); + label_manager_terminate(); ns_terminate(); diff --git a/zebra/zebra_srv6.c b/zebra/zebra_srv6.c index 94b93e5e8dbb..ee463c76a8d3 100644 --- a/zebra/zebra_srv6.c +++ b/zebra/zebra_srv6.c @@ -216,9 +216,10 @@ void zebra_notify_srv6_locator_delete(struct srv6_locator *locator) } } +struct zebra_srv6 srv6; + struct zebra_srv6 *zebra_srv6_get_default(void) { - static struct zebra_srv6 srv6; static bool first_execution = true; if (first_execution) { @@ -408,6 +409,23 @@ int release_daemon_srv6_locator_chunks(struct zserv *client) return count; } +void zebra_srv6_terminate(void) +{ + struct srv6_locator *locator; + + if (!srv6.locators) + return; + + while (listcount(srv6.locators)) { + locator = listnode_head(srv6.locators); + + listnode_delete(srv6.locators, locator); + srv6_locator_free(locator); + } + + list_delete(&srv6.locators); +} + void zebra_srv6_init(void) { hook_register(zserv_client_close, zebra_srv6_cleanup); diff --git a/zebra/zebra_srv6.h b/zebra/zebra_srv6.h index 51db83d6fb64..73876741fda7 100644 --- a/zebra/zebra_srv6.h +++ b/zebra/zebra_srv6.h @@ -52,6 +52,7 @@ void zebra_notify_srv6_locator_add(struct srv6_locator *locator); void zebra_notify_srv6_locator_delete(struct srv6_locator *locator); extern void zebra_srv6_init(void); +extern void zebra_srv6_terminate(void); extern struct zebra_srv6 *zebra_srv6_get_default(void); extern bool zebra_srv6_is_enable(void);