summaryrefslogtreecommitdiff
path: root/zebra/zebra_srv6.c
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2023-12-14 07:38:06 +0200
committerGitHub <noreply@github.com>2023-12-14 07:38:06 +0200
commit5bdf2e5962743b3614d00e8de185e0d0905fc36d (patch)
tree642c59724bbb0197b32efafd16cf83f847a3053a /zebra/zebra_srv6.c
parentec1e9f4ba274ad3e0311e4cfe9ffb68a677a11b9 (diff)
parent8fcacf680389778e29acf68adbec9a7021217a22 (diff)
Merge pull request #14996 from donaldsharp/srv6_shutdown_zebra_deletion
zebra: On shutdown, free up srv6 list data
Diffstat (limited to 'zebra/zebra_srv6.c')
-rw-r--r--zebra/zebra_srv6.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/zebra/zebra_srv6.c b/zebra/zebra_srv6.c
index 94b93e5e8d..ee463c76a8 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);