Skip to content

Commit

Permalink
*: Create and use infrastructure to show debugs in lib
Browse files Browse the repository at this point in the history
There are lib debugs being set but never show up in
`show debug` commands because there was no way to show
that they were being used.  Add a bit of infrastructure
to allow this and then use it for `debug route-map`

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
  • Loading branch information
donaldsharp committed Oct 7, 2022
1 parent a00621d commit cf00164
Show file tree
Hide file tree
Showing 24 changed files with 70 additions and 3 deletions.
2 changes: 2 additions & 0 deletions babeld/babel_zebra.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@ DEFUN_NOSH (show_debugging_babel,

debug_babel_config_write(vty);

cmd_show_lib_debugs(vty);

return CMD_SUCCESS;
}

Expand Down
2 changes: 2 additions & 0 deletions bfdd/bfdd_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -973,6 +973,8 @@ DEFUN_NOSH(show_debugging_bfd,
if (bglobal.debug_network)
vty_out(vty, " Network layer debugging is on.\n");

cmd_show_lib_debugs(vty);

return CMD_SUCCESS;
}

Expand Down
2 changes: 2 additions & 0 deletions bgpd/bgp_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -2278,6 +2278,8 @@ DEFUN_NOSH (show_debugging_bgp,
vty_out(vty,
" BGP conditional advertisement debugging is on\n");

cmd_show_lib_debugs(vty);

return CMD_SUCCESS;
}

Expand Down
1 change: 1 addition & 0 deletions eigrpd/eigrp_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ DEFUN_NOSH (show_debugging_eigrp,
}
}

cmd_show_lib_debugs(vty);
return CMD_SUCCESS;
}

Expand Down
2 changes: 2 additions & 0 deletions isisd/isisd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1700,6 +1700,8 @@ DEFUN_NOSH (show_debugging,
if (IS_DEBUG_LFA)
print_debug(vty, DEBUG_LFA, 1);

cmd_show_lib_debugs(vty);

return CMD_SUCCESS;
}

Expand Down
6 changes: 5 additions & 1 deletion ldpd/ldp_vty_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,11 @@ DEFPY_NOSH (ldp_show_debugging_mpls_ldp,
"MPLS information\n"
"Label Distribution Protocol\n")
{
return (ldp_vty_show_debugging(vty));
ldp_vty_show_debugging(vty);

cmd_show_lib_debugs(vty);

return CMD_SUCCESS;
}

static void
Expand Down
6 changes: 6 additions & 0 deletions lib/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
#include "lib_errors.h"
#include "northbound_cli.h"
#include "network.h"
#include "routemap.h"

#include "frrscript.h"

Expand Down Expand Up @@ -2446,6 +2447,11 @@ const char *host_config_get(void)
return host.config;
}

void cmd_show_lib_debugs(struct vty *vty)
{
route_map_show_debug(vty);
}

void install_default(enum node_type node)
{
_install_element(node, &config_exit_cmd);
Expand Down
6 changes: 6 additions & 0 deletions lib/command.h
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,12 @@ extern char *cmd_variable_comp2str(vector comps, unsigned short cols);

extern void command_setup_early_logging(const char *dest, const char *level);

/*
* Allow a mechanism for `debug XXX` commands that live
* under the lib directory to output their debug status
*/
extern void cmd_show_lib_debugs(struct vty *vty);

#ifdef __cplusplus
}
#endif
Expand Down
6 changes: 6 additions & 0 deletions lib/routemap.c
Original file line number Diff line number Diff line change
Expand Up @@ -3174,6 +3174,12 @@ static struct cmd_node rmap_debug_node = {
.config_write = rmap_config_write_debug,
};

void route_map_show_debug(struct vty *vty)
{
if (rmap_debug)
vty_out(vty, "debug route-map\n");
}

/* Configuration write function. */
static int rmap_config_write_debug(struct vty *vty)
{
Expand Down
2 changes: 2 additions & 0 deletions lib/routemap.h
Original file line number Diff line number Diff line change
Expand Up @@ -1015,6 +1015,8 @@ extern void route_map_optimization_disabled_show(struct vty *vty,
bool show_defaults);
extern void route_map_cli_init(void);

extern void route_map_show_debug(struct vty *vty);

#ifdef __cplusplus
}
#endif
Expand Down
2 changes: 2 additions & 0 deletions nhrpd/nhrp_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ DEFUN_NOSH(show_debugging_nhrp, show_debugging_nhrp_cmd,
debug_flags_desc[i].str);
}

cmd_show_lib_debugs(vty);

return CMD_SUCCESS;
}

Expand Down
2 changes: 2 additions & 0 deletions ospf6d/ospf6d.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ DEFUN_NOSH (show_debugging_ospf6,

config_write_ospf6_debug(vty);

cmd_show_lib_debugs(vty);

return CMD_SUCCESS;
}

Expand Down
12 changes: 10 additions & 2 deletions ospfd/ospf_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -1860,7 +1860,11 @@ DEFUN_NOSH (show_debugging_ospf,
DEBUG_STR
OSPF_STR)
{
return show_debugging_ospf_common(vty);
show_debugging_ospf_common(vty);

cmd_show_lib_debugs(vty);

return CMD_SUCCESS;
}

DEFUN_NOSH (show_debugging_ospf_instance,
Expand All @@ -1878,7 +1882,11 @@ DEFUN_NOSH (show_debugging_ospf_instance,
if (instance != ospf_instance)
return CMD_NOT_MY_INSTANCE;

return show_debugging_ospf_common(vty);
show_debugging_ospf_common(vty);

cmd_show_lib_debugs(vty);

return CMD_SUCCESS;
}

static int config_write_debug(struct vty *vty);
Expand Down
2 changes: 2 additions & 0 deletions pathd/path_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -1092,6 +1092,8 @@ DEFPY_NOSH(show_debugging_pathd, show_debugging_pathd_cmd,
"State of each debugging option\n"
"pathd module debugging\n")
{

cmd_show_lib_debugs(vty);
/* nothing to do here */
return CMD_SUCCESS;
}
Expand Down
2 changes: 2 additions & 0 deletions pbrd/pbr_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -1243,6 +1243,8 @@ DEFUN_NOSH(show_debugging_pbr,

pbr_debug_config_write_helper(vty, false);

cmd_show_lib_debugs(vty);

return CMD_SUCCESS;
}

Expand Down
2 changes: 2 additions & 0 deletions pimd/pim6_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1558,6 +1558,8 @@ DEFUN_NOSH (show_debugging_pimv6,

pim_debug_config_write(vty);

cmd_show_lib_debugs(vty);

return CMD_SUCCESS;
}

Expand Down
1 change: 1 addition & 0 deletions pimd/pim_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -4906,6 +4906,7 @@ DEFUN_NOSH (show_debugging_pim,

pim_debug_config_write(vty);

cmd_show_lib_debugs(vty);
return CMD_SUCCESS;
}

Expand Down
2 changes: 2 additions & 0 deletions ripd/rip_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ DEFUN_NOSH (show_debugging_rip,
if (IS_RIP_DEBUG_ZEBRA)
vty_out(vty, " RIP zebra debugging is on\n");

cmd_show_lib_debugs(vty);

return CMD_SUCCESS;
}

Expand Down
2 changes: 2 additions & 0 deletions ripngd/ripng_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ DEFUN_NOSH (show_debugging_ripng,
if (IS_RIPNG_DEBUG_ZEBRA)
vty_out(vty, " RIPng zebra debugging is on\n");

cmd_show_lib_debugs(vty);

return CMD_SUCCESS;
}

Expand Down
2 changes: 2 additions & 0 deletions sharpd/sharp_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,8 @@ DEFUN_NOSH (show_debugging_sharpd,
{
vty_out(vty, "Sharp debugging status:\n");

cmd_show_lib_debugs(vty);

return CMD_SUCCESS;
}

Expand Down
2 changes: 2 additions & 0 deletions staticd/static_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -1301,6 +1301,8 @@ DEFUN_NOSH (show_debugging_static,

static_debug_status_write(vty);

cmd_show_lib_debugs(vty);

return CMD_SUCCESS;
}

Expand Down
2 changes: 2 additions & 0 deletions vrrpd/vrrp_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,8 @@ DEFUN_NOSH (show_debugging_vrrp,

vrrp_debug_status_write(vty);

cmd_show_lib_debugs(vty);

return CMD_SUCCESS;
}

Expand Down
2 changes: 2 additions & 0 deletions watchfrr/watchfrr_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ DEFUN_NOSH (show_debugging_watchfrr,
DEBUG_STR
WATCHFRR_STR)
{
cmd_show_lib_debugs(vty);

return CMD_SUCCESS;
}

Expand Down
3 changes: 3 additions & 0 deletions zebra/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ DEFUN_NOSH (show_debugging_zebra,
vty_out(vty, " Zebra PBR debugging is on\n");

hook_call(zebra_debug_show_debugging, vty);

cmd_show_lib_debugs(vty);

return CMD_SUCCESS;
}

Expand Down

0 comments on commit cf00164

Please sign in to comment.