*: Create and use infrastructure to show debugs in lib

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>
This commit is contained in:
Donald Sharp 2022-10-07 07:51:17 -04:00
parent a00621d8b9
commit cf00164b69
24 changed files with 70 additions and 3 deletions

View File

@ -225,6 +225,8 @@ DEFUN_NOSH (show_debugging_babel,
debug_babel_config_write(vty);
cmd_show_lib_debugs(vty);
return CMD_SUCCESS;
}

View File

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

View File

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

View File

@ -322,6 +322,7 @@ DEFUN_NOSH (show_debugging_eigrp,
}
}
cmd_show_lib_debugs(vty);
return CMD_SUCCESS;
}

View File

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

View File

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

View File

@ -48,6 +48,7 @@
#include "lib_errors.h"
#include "northbound_cli.h"
#include "network.h"
#include "routemap.h"
#include "frrscript.h"
@ -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);

View File

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

View File

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

View File

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

View File

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

View File

@ -115,6 +115,8 @@ DEFUN_NOSH (show_debugging_ospf6,
config_write_ospf6_debug(vty);
cmd_show_lib_debugs(vty);
return CMD_SUCCESS;
}

View File

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

View File

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

View File

@ -1243,6 +1243,8 @@ DEFUN_NOSH(show_debugging_pbr,
pbr_debug_config_write_helper(vty, false);
cmd_show_lib_debugs(vty);
return CMD_SUCCESS;
}

View File

@ -1558,6 +1558,8 @@ DEFUN_NOSH (show_debugging_pimv6,
pim_debug_config_write(vty);
cmd_show_lib_debugs(vty);
return CMD_SUCCESS;
}

View File

@ -4906,6 +4906,7 @@ DEFUN_NOSH (show_debugging_pim,
pim_debug_config_write(vty);
cmd_show_lib_debugs(vty);
return CMD_SUCCESS;
}

View File

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

View File

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

View File

@ -615,6 +615,8 @@ DEFUN_NOSH (show_debugging_sharpd,
{
vty_out(vty, "Sharp debugging status:\n");
cmd_show_lib_debugs(vty);
return CMD_SUCCESS;
}

View File

@ -1301,6 +1301,8 @@ DEFUN_NOSH (show_debugging_static,
static_debug_status_write(vty);
cmd_show_lib_debugs(vty);
return CMD_SUCCESS;
}

View File

@ -710,6 +710,8 @@ DEFUN_NOSH (show_debugging_vrrp,
vrrp_debug_status_write(vty);
cmd_show_lib_debugs(vty);
return CMD_SUCCESS;
}

View File

@ -125,6 +125,8 @@ DEFUN_NOSH (show_debugging_watchfrr,
DEBUG_STR
WATCHFRR_STR)
{
cmd_show_lib_debugs(vty);
return CMD_SUCCESS;
}

View File

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