]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: On shutdown, free up srv6 list data
authorDonald Sharp <sharpd@nvidia.com>
Tue, 12 Dec 2023 17:03:10 +0000 (12:03 -0500)
committerDonald Sharp <sharpd@nvidia.com>
Tue, 12 Dec 2023 17:04:14 +0000 (12:04 -0500)
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
zebra/main.c
zebra/zebra_srv6.c
zebra/zebra_srv6.h

index d34fdb3bf82c28c1c9e1d49418cab6cf02beb798..5dd830b54241487b94b1d12ea5ff77e85edee430 100644 (file)
@@ -236,6 +236,8 @@ void zebra_finalize(struct event *dummy)
 
        zebra_pw_terminate();
 
+       zebra_srv6_terminate();
+
        label_manager_terminate();
 
        ns_terminate();
index 94b93e5e8dbba3cf29e4ef3acaf5399f543b21f6..ee463c76a8d30b632cbcd70e33e725e2c92bd976 100644 (file)
@@ -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);
index 51db83d6fb64f8ead0b36d13b7095cccedf8dd7e..73876741fda7661f2083d9346c5f86481693ebb9 100644 (file)
@@ -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);