summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Sharp <donaldsharp72@gmail.com>2023-07-01 14:35:42 -0400
committerGitHub <noreply@github.com>2023-07-01 14:35:42 -0400
commit1f322e4cef0df7c736af7626ad7c9dc6f03e4bcc (patch)
tree2eec3cba264caeeced5f36152e1c8c4cf4e86c29
parent69a826c485bf6f79f39be372ef6a98aed2322ff9 (diff)
parenta5c9e190beb444f70c83579d0e3a7f77435a73fa (diff)
Merge pull request #13847 from opensourcerouting/fix/free_zclient_sync_on_destroy
Stop and free synchronous Zebra client on destroy
-rw-r--r--ldpd/lde.c2
-rw-r--r--ldpd/ldp_zebra.c7
-rw-r--r--ospfd/ospf_zebra.c2
-rw-r--r--ospfd/ospfd.c3
-rw-r--r--pathd/path_zebra.c2
5 files changed, 14 insertions, 2 deletions
diff --git a/ldpd/lde.c b/ldpd/lde.c
index 806bab6a21..c7e915deb3 100644
--- a/ldpd/lde.c
+++ b/ldpd/lde.c
@@ -87,7 +87,7 @@ static struct list *label_chunk_list;
static struct listnode *current_label_chunk;
/* Synchronous zclient to request labels */
-static struct zclient *zclient_sync;
+struct zclient *zclient_sync;
/* SIGINT / SIGTERM handler. */
static void
diff --git a/ldpd/ldp_zebra.c b/ldpd/ldp_zebra.c
index 2010829035..0fd5d4613c 100644
--- a/ldpd/ldp_zebra.c
+++ b/ldpd/ldp_zebra.c
@@ -39,6 +39,7 @@ static int ldp_zebra_opaque_msg_handler(ZAPI_CALLBACK_ARGS);
static void ldp_sync_zebra_init(void);
static struct zclient *zclient;
+extern struct zclient *zclient_sync;
static bool zebra_registered = false;
static void
@@ -703,4 +704,10 @@ ldp_zebra_destroy(void)
zclient_stop(zclient);
zclient_free(zclient);
zclient = NULL;
+
+ if (zclient_sync == NULL)
+ return;
+ zclient_stop(zclient_sync);
+ zclient_free(zclient_sync);
+ zclient_sync = NULL;
}
diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c
index a5372dfc49..96d474fe86 100644
--- a/ospfd/ospf_zebra.c
+++ b/ospfd/ospf_zebra.c
@@ -47,7 +47,7 @@ DEFINE_MTYPE_STATIC(OSPFD, OSPF_REDISTRIBUTE, "OSPF Redistriute");
/* Zebra structure to hold current status. */
struct zclient *zclient = NULL;
/* and for the Synchronous connection to the Label Manager */
-static struct zclient *zclient_sync;
+struct zclient *zclient_sync;
/* For registering threads. */
extern struct event_loop *master;
diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c
index 053907f209..fc51c739e4 100644
--- a/ospfd/ospfd.c
+++ b/ospfd/ospfd.c
@@ -60,6 +60,7 @@ struct ospf_master *om;
unsigned short ospf_instance;
extern struct zclient *zclient;
+extern struct zclient *zclient_sync;
/* OSPF config processing timer thread */
struct event *t_ospf_cfg;
@@ -683,6 +684,8 @@ void ospf_terminate(void)
*/
zclient_stop(zclient);
zclient_free(zclient);
+ zclient_stop(zclient_sync);
+ zclient_free(zclient_sync);
done:
frr_fini();
diff --git a/pathd/path_zebra.c b/pathd/path_zebra.c
index dad26383e9..826443f979 100644
--- a/pathd/path_zebra.c
+++ b/pathd/path_zebra.c
@@ -344,4 +344,6 @@ void path_zebra_stop(void)
{
zclient_stop(zclient);
zclient_free(zclient);
+ zclient_stop(zclient_sync);
+ zclient_free(zclient_sync);
}