Skip to content

Commit

Permalink
Merge pull request FRRouting#14771 from LabNConsulting/fix-mgmtd-clie…
Browse files Browse the repository at this point in the history
…nt-memleaks

lib: mgmtd: fix debug cli commands and memleaks
  • Loading branch information
idryzhov authored Nov 12, 2023
2 parents 2c0c2c7 + 756002e commit 8fb5596
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 6 deletions.
2 changes: 2 additions & 0 deletions lib/command.h
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
6 changes: 3 additions & 3 deletions lib/mgmt_be_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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,
};
Expand Down
4 changes: 2 additions & 2 deletions lib/mgmt_fe_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
2 changes: 1 addition & 1 deletion mgmtd/mgmt_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
9 changes: 9 additions & 0 deletions tools/valgrind.supp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@
fun:cap_init
fun:zprivs_caps_init
}
{
<zprivs_init leak in library code we do not control>
Memcheck:Leak
match-leak-kinds: reachable
...
fun:getgrouplist
fun:zprivs_init
fun:frr_init
}
{
<sqlite3 leak in a function we do not control>
Memcheck:Leak
Expand Down
6 changes: 6 additions & 0 deletions vtysh/vtysh_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8fb5596

Please sign in to comment.