Merge pull request #13847 from opensourcerouting/fix/free_zclient_sync_on_destroy

Stop and free synchronous Zebra client on destroy
This commit is contained in:
Donald Sharp 2023-07-01 14:35:42 -04:00 committed by GitHub
commit 1f322e4cef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 2 deletions

View file

@ -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

View file

@ -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;
}

View file

@ -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;

View file

@ -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();

View file

@ -344,4 +344,6 @@ void path_zebra_stop(void)
{
zclient_stop(zclient);
zclient_free(zclient);
zclient_stop(zclient_sync);
zclient_free(zclient_sync);
}