mirror of
https://github.com/FRRouting/frr.git
synced 2025-04-30 13:37:17 +02:00
lib: mgmtd: fix debug cli commands and memleaks
- Cannot have 2 cmd_node's with same .node number. Install the mgmtd client library debug nodes (client frontend and client backend) using new unique node numbers. Fixes memleaks. - Fix "debug mgmt client backend" to generate correct config (and not for frontend). Signed-off-by: Christian Hopps <chopps@labn.net>
This commit is contained in:
parent
19bcca4f2e
commit
59beac5013
|
@ -88,6 +88,8 @@ enum node_type {
|
|||
DEBUG_VNC_NODE, /* Debug VNC node. */
|
||||
RMAP_DEBUG_NODE, /* Route-map debug node */
|
||||
RESOLVER_DEBUG_NODE, /* Resolver debug node */
|
||||
MGMT_BE_DEBUG_NODE, /* mgmtd backend-client debug node */
|
||||
MGMT_FE_DEBUG_NODE, /* mgmtd frontend-client debug node */
|
||||
AAA_NODE, /* AAA node. */
|
||||
EXTLOG_NODE, /* RFC5424 & co. extended syslog */
|
||||
KEYCHAIN_NODE, /* Key-chain node. */
|
||||
|
|
|
@ -880,7 +880,7 @@ static void mgmt_debug_client_be_set_all(uint32_t flags, bool set)
|
|||
static int mgmt_debug_be_client_config_write(struct vty *vty)
|
||||
{
|
||||
if (DEBUG_MODE_CHECK(&mgmt_dbg_be_client, DEBUG_MODE_CONF))
|
||||
vty_out(vty, "debug mgmt client frontend\n");
|
||||
vty_out(vty, "debug mgmt client backend\n");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -895,8 +895,8 @@ static struct debug_callbacks mgmt_dbg_be_client_cbs = {
|
|||
.debug_set_all = mgmt_debug_client_be_set_all};
|
||||
|
||||
static struct cmd_node mgmt_dbg_node = {
|
||||
.name = "mgmt backend client",
|
||||
.node = DEBUG_NODE,
|
||||
.name = "debug mgmt client backend",
|
||||
.node = MGMT_BE_DEBUG_NODE,
|
||||
.prompt = "",
|
||||
.config_write = mgmt_debug_be_client_config_write,
|
||||
};
|
||||
|
|
|
@ -580,8 +580,8 @@ static struct debug_callbacks mgmt_dbg_fe_client_cbs = {
|
|||
.debug_set_all = mgmt_debug_client_fe_set_all};
|
||||
|
||||
static struct cmd_node mgmt_dbg_node = {
|
||||
.name = "mgmt client frontend",
|
||||
.node = DEBUG_NODE,
|
||||
.name = "debug mgmt client frontend",
|
||||
.node = MGMT_FE_DEBUG_NODE,
|
||||
.prompt = "",
|
||||
.config_write = mgmt_debug_fe_client_config_write,
|
||||
};
|
||||
|
|
|
@ -379,7 +379,7 @@ DEFPY(mgmt_rollback,
|
|||
|
||||
int config_write_mgmt_debug(struct vty *vty);
|
||||
static struct cmd_node debug_node = {
|
||||
.name = "debug",
|
||||
.name = "mgmt debug",
|
||||
.node = DEBUG_NODE,
|
||||
.prompt = "",
|
||||
.config_write = config_write_mgmt_debug,
|
||||
|
|
|
@ -455,6 +455,12 @@ void vtysh_config_parse_line(void *arg, const char *line)
|
|||
else if (strncmp(line, "debug resolver",
|
||||
strlen("debug resolver")) == 0)
|
||||
config = config_get(RESOLVER_DEBUG_NODE, line);
|
||||
else if (strncmp(line, "debug mgmt client frontend",
|
||||
strlen("debug mgmt client frontend")) == 0)
|
||||
config = config_get(MGMT_FE_DEBUG_NODE, line);
|
||||
else if (strncmp(line, "debug mgmt client backend",
|
||||
strlen("debug mgmt client backend")) == 0)
|
||||
config = config_get(MGMT_BE_DEBUG_NODE, line);
|
||||
else if (strncmp(line, "debug", strlen("debug")) == 0)
|
||||
config = config_get(DEBUG_NODE, line);
|
||||
else if (strncmp(line, "password", strlen("password")) == 0
|
||||
|
|
Loading…
Reference in a new issue