diff --git a/lib/mgmt_be_client.c b/lib/mgmt_be_client.c index 51eaeb92deb4..058ff038d41f 100644 --- a/lib/mgmt_be_client.c +++ b/lib/mgmt_be_client.c @@ -116,7 +116,8 @@ struct debug mgmt_dbg_be_client = { .desc = "Management backend client operations" }; -struct mgmt_be_client *mgmt_be_client; +/* NOTE: only one client per proc for now. */ +static struct mgmt_be_client *__be_client; static int mgmt_be_client_send_msg(struct mgmt_be_client *client_ctx, Mgmtd__BeMessage *be_msg) @@ -828,11 +829,11 @@ static void mgmt_debug_client_be_set(uint32_t flags, bool set) { DEBUG_FLAGS_SET(&mgmt_dbg_be_client, flags, set); - if (!mgmt_be_client) + if (!__be_client) return; - mgmt_be_client->client.conn.debug = - DEBUG_MODE_CHECK(&mgmt_dbg_be_client, DEBUG_MODE_ALL); + __be_client->client.conn.debug = DEBUG_MODE_CHECK(&mgmt_dbg_be_client, + DEBUG_MODE_ALL); } DEFPY(debug_mgmt_client_be, debug_mgmt_client_be_cmd, @@ -878,11 +879,11 @@ struct mgmt_be_client *mgmt_be_client_create(const char *client_name, { struct mgmt_be_client *client; - if (mgmt_be_client) + if (__be_client) return NULL; client = XCALLOC(MTYPE_MGMTD_BE_CLIENT, sizeof(*client)); - mgmt_be_client = client; + __be_client = client; /* Only call after frr_init() */ assert(running_config); @@ -916,7 +917,7 @@ void mgmt_be_client_lib_vty_init(void) void mgmt_be_client_destroy(struct mgmt_be_client *client) { - assert(client == mgmt_be_client); + assert(client == __be_client); MGMTD_BE_CLIENT_DBG("Destroying MGMTD Backend Client '%s'", client->name); @@ -929,5 +930,5 @@ void mgmt_be_client_destroy(struct mgmt_be_client *client) XFREE(MTYPE_MGMTD_BE_CLIENT_NAME, client->name); XFREE(MTYPE_MGMTD_BE_CLIENT, client); - mgmt_be_client = NULL; + __be_client = NULL; } diff --git a/lib/mgmt_fe_client.c b/lib/mgmt_fe_client.c index e99826761ea0..4c6f86b19450 100644 --- a/lib/mgmt_fe_client.c +++ b/lib/mgmt_fe_client.c @@ -51,7 +51,8 @@ struct debug mgmt_dbg_fe_client = { .desc = "Management frontend client operations" }; -struct mgmt_fe_client *mgmt_fe_client; +/* NOTE: only one client per proc for now. */ +static struct mgmt_fe_client *__fe_client; static inline const char *dsid2name(Mgmtd__DatastoreId id) { @@ -550,11 +551,11 @@ static void mgmt_debug_client_fe_set(uint32_t mode, bool set) { DEBUG_FLAGS_SET(&mgmt_dbg_fe_client, mode, set); - if (!mgmt_fe_client) + if (!__fe_client) return; - mgmt_fe_client->client.conn.debug = - DEBUG_MODE_CHECK(&mgmt_dbg_fe_client, DEBUG_MODE_ALL); + __fe_client->client.conn.debug = DEBUG_MODE_CHECK(&mgmt_dbg_fe_client, + DEBUG_MODE_ALL); } DEFPY(debug_mgmt_client_fe, debug_mgmt_client_fe_cmd, @@ -603,11 +604,11 @@ struct mgmt_fe_client *mgmt_fe_client_create(const char *client_name, { struct mgmt_fe_client *client; - if (mgmt_fe_client) + if (__fe_client) return NULL; client = XCALLOC(MTYPE_MGMTD_FE_CLIENT, sizeof(*client)); - mgmt_fe_client = client; + __fe_client = client; client->name = XSTRDUP(MTYPE_MGMTD_FE_CLIENT_NAME, client_name); client->user_data = user_data; @@ -704,7 +705,7 @@ void mgmt_fe_client_destroy(struct mgmt_fe_client *client) { struct mgmt_fe_client_session *session; - assert(client == mgmt_fe_client); + assert(client == __fe_client); MGMTD_FE_CLIENT_DBG("Destroying MGMTD Frontend Client '%s'", client->name); @@ -717,5 +718,5 @@ void mgmt_fe_client_destroy(struct mgmt_fe_client *client) XFREE(MTYPE_MGMTD_FE_CLIENT_NAME, client->name); XFREE(MTYPE_MGMTD_FE_CLIENT, client); - mgmt_fe_client = NULL; + __fe_client = NULL; } diff --git a/staticd/static_main.c b/staticd/static_main.c index 165fb4d65204..b2f5ec4952d6 100644 --- a/staticd/static_main.c +++ b/staticd/static_main.c @@ -53,7 +53,7 @@ struct option longopts[] = { { 0 } }; /* Master of threads. */ struct event_loop *master; -struct mgmt_be_client *mgmt_be_client; +static struct mgmt_be_client *mgmt_be_client; static struct frr_daemon_info staticd_di;