diff --git a/ldpd/lde.c b/ldpd/lde.c index 806bab6a213b..c7e915deb332 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 2010829035a1..0fd5d4613c08 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 a5372dfc4976..96d474fe863a 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 053907f20949..fc51c739e4b5 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 dad26383e95e..826443f97906 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); }