diff options
-rw-r--r-- | lib/command.c | 4 | ||||
-rw-r--r-- | lib/debug.c | 10 | ||||
-rw-r--r-- | lib/debug.h | 3 | ||||
-rw-r--r-- | lib/mgmt_be_client.c | 6 | ||||
-rw-r--r-- | lib/mgmt_be_client.h | 5 | ||||
-rw-r--r-- | lib/mgmt_fe_client.c | 6 | ||||
-rw-r--r-- | lib/mgmt_fe_client.h | 5 | ||||
-rw-r--r-- | mgmtd/mgmt_vty.c | 28 | ||||
-rw-r--r-- | pathd/path_cli.c | 4 | ||||
-rw-r--r-- | pathd/path_pcep_cli.c | 22 | ||||
-rw-r--r-- | pathd/path_ted.c | 11 | ||||
-rw-r--r-- | pathd/path_ted.h | 1 | ||||
-rw-r--r-- | pathd/pathd.c | 6 | ||||
-rw-r--r-- | pathd/pathd.h | 1 | ||||
-rw-r--r-- | pbrd/pbr_debug.c | 23 | ||||
-rw-r--r-- | pbrd/pbr_debug.h | 14 | ||||
-rw-r--r-- | pbrd/pbr_vty.c | 2 | ||||
-rw-r--r-- | staticd/static_debug.c | 31 | ||||
-rw-r--r-- | staticd/static_debug.h | 8 | ||||
-rw-r--r-- | staticd/static_vty.c | 2 | ||||
-rw-r--r-- | vrrpd/vrrp_debug.c | 39 | ||||
-rw-r--r-- | vrrpd/vrrp_vty.c | 2 |
22 files changed, 16 insertions, 217 deletions
diff --git a/lib/command.c b/lib/command.c index 51f2529e3..ac8d60118 100644 --- a/lib/command.c +++ b/lib/command.c @@ -17,6 +17,7 @@ #include <lib/version.h> #include "command.h" +#include "debug.h" #include "frrstr.h" #include "memory.h" #include "log.h" @@ -2463,8 +2464,7 @@ const char *host_config_get(void) void cmd_show_lib_debugs(struct vty *vty) { route_map_show_debug(vty); - mgmt_debug_be_client_show_debug(vty); - mgmt_debug_fe_client_show_debug(vty); + debug_status_write(vty); } void install_default(enum node_type node) diff --git a/lib/debug.c b/lib/debug.c index 9c283176a..d25c32d42 100644 --- a/lib/debug.c +++ b/lib/debug.c @@ -38,6 +38,16 @@ DEFUN_NOSH (debug_all, /* ------------------------------------------------------------------------- */ +void debug_status_write(struct vty *vty) +{ + struct debug *debug; + + frr_each (debug_list, &debug_head, debug) { + if (DEBUG_MODE_CHECK(debug, DEBUG_MODE_ALL)) + vty_out(vty, " %s debugging is on\n", debug->desc); + } +} + static int config_write_debug(struct vty *vty) { struct debug *debug; diff --git a/lib/debug.h b/lib/debug.h index 60f42e307..eee314cff 100644 --- a/lib/debug.h +++ b/lib/debug.h @@ -199,6 +199,9 @@ struct debug { #define DEBUGN(name, fmt, ...) DEBUG(notice, name, fmt, ##__VA_ARGS__) #define DEBUGD(name, fmt, ...) DEBUG(debug, name, fmt, ##__VA_ARGS__) +/* Show current debugging status. */ +void debug_status_write(struct vty *vty); + /* * Register a debug item. */ diff --git a/lib/mgmt_be_client.c b/lib/mgmt_be_client.c index ad57a887f..f03006ad0 100644 --- a/lib/mgmt_be_client.c +++ b/lib/mgmt_be_client.c @@ -1259,12 +1259,6 @@ DEFPY(debug_mgmt_client_be, debug_mgmt_client_be_cmd, return CMD_SUCCESS; } -void mgmt_debug_be_client_show_debug(struct vty *vty) -{ - if (debug_check_be_client()) - vty_out(vty, "debug mgmt client backend\n"); -} - struct mgmt_be_client *mgmt_be_client_create(const char *client_name, struct mgmt_be_client_cbs *cbs, uintptr_t user_data, diff --git a/lib/mgmt_be_client.h b/lib/mgmt_be_client.h index 7ad0589bd..6ed8c2a39 100644 --- a/lib/mgmt_be_client.h +++ b/lib/mgmt_be_client.h @@ -122,11 +122,6 @@ mgmt_be_client_create(const char *name, struct mgmt_be_client_cbs *cbs, extern void mgmt_be_client_lib_vty_init(void); /* - * Print enabled debugging commands. - */ -extern void mgmt_debug_be_client_show_debug(struct vty *vty); - -/* * [Un]-subscribe with MGMTD for one or more YANG subtree(s). * * client diff --git a/lib/mgmt_fe_client.c b/lib/mgmt_fe_client.c index cd74f3827..ced2f2e45 100644 --- a/lib/mgmt_fe_client.c +++ b/lib/mgmt_fe_client.c @@ -806,12 +806,6 @@ DEFPY(debug_mgmt_client_fe, debug_mgmt_client_fe_cmd, return CMD_SUCCESS; } -void mgmt_debug_fe_client_show_debug(struct vty *vty) -{ - if (debug_check_fe_client()) - vty_out(vty, "debug mgmt client frontend\n"); -} - /* * Initialize library and try connecting with MGMTD. */ diff --git a/lib/mgmt_fe_client.h b/lib/mgmt_fe_client.h index 20c87044a..2b5a25fa0 100644 --- a/lib/mgmt_fe_client.h +++ b/lib/mgmt_fe_client.h @@ -179,11 +179,6 @@ mgmt_fe_client_create(const char *client_name, struct mgmt_fe_client_cbs *cbs, extern void mgmt_fe_client_lib_vty_init(void); /* - * Print enabled debugging commands. - */ -extern void mgmt_debug_fe_client_show_debug(struct vty *vty); - -/* * Create a new Session for a Frontend Client connection. * * lib_hndl diff --git a/mgmtd/mgmt_vty.c b/mgmtd/mgmt_vty.c index 07ea7b4bd..876f70356 100644 --- a/mgmtd/mgmt_vty.c +++ b/mgmtd/mgmt_vty.c @@ -557,39 +557,11 @@ DEFPY(mgmt_rollback, return CMD_SUCCESS; } -static int write_mgmt_debug_helper(struct vty *vty, bool config) -{ - uint32_t mode = config ? DEBUG_MODE_CONF : DEBUG_MODE_ALL; - bool be = DEBUG_MODE_CHECK(&mgmt_debug_be, mode); - bool ds = DEBUG_MODE_CHECK(&mgmt_debug_ds, mode); - bool fe = DEBUG_MODE_CHECK(&mgmt_debug_fe, mode); - bool txn = DEBUG_MODE_CHECK(&mgmt_debug_txn, mode); - - if (!(be || ds || fe || txn)) - return 0; - - vty_out(vty, "debug mgmt"); - if (be) - vty_out(vty, " backend"); - if (ds) - vty_out(vty, " datastore"); - if (fe) - vty_out(vty, " frontend"); - if (txn) - vty_out(vty, " transaction"); - - vty_out(vty, "\n"); - - return 0; -} - DEFPY_NOSH(show_debugging_mgmt, show_debugging_mgmt_cmd, "show debugging [mgmt]", SHOW_STR DEBUG_STR "MGMT Information\n") { vty_out(vty, "MGMT debugging status:\n"); - write_mgmt_debug_helper(vty, false); - cmd_show_lib_debugs(vty); return CMD_SUCCESS; diff --git a/pathd/path_cli.c b/pathd/path_cli.c index 754fdf7a6..436883c1f 100644 --- a/pathd/path_cli.c +++ b/pathd/path_cli.c @@ -1089,9 +1089,7 @@ DEFPY_NOSH(show_debugging_pathd, show_debugging_pathd_cmd, vty_out(vty, "Path debugging status:\n"); cmd_show_lib_debugs(vty); - /* nothing to do here */ - path_ted_show_debugging(vty); - path_policy_show_debugging(vty); + return CMD_SUCCESS; } diff --git a/pathd/path_pcep_cli.c b/pathd/path_pcep_cli.c index 4294b51c5..8ceadb3e6 100644 --- a/pathd/path_pcep_cli.c +++ b/pathd/path_pcep_cli.c @@ -1952,27 +1952,6 @@ int pcep_cli_pcep_pce_config_write(struct vty *vty) * The param names are taken from the path_pcep_cli_clippy.c generated file. */ -DEFPY(show_debugging_pathd_pcep, - show_debugging_pathd_pcep_cmd, - "show debugging pathd-pcep", - SHOW_STR - "State of each debugging option\n" - "pathd pcep module debugging\n") -{ - vty_out(vty, "Pathd pcep debugging status:\n"); - - if (DEBUG_MODE_CHECK(&pcep_g->dbg_basic, DEBUG_MODE_ALL)) - vty_out(vty, "PCEP basic debugging is on\n"); - if (DEBUG_MODE_CHECK(&pcep_g->dbg_path, DEBUG_MODE_ALL)) - vty_out(vty, "PCEP path debugging is on\n"); - if (DEBUG_MODE_CHECK(&pcep_g->dbg_msg, DEBUG_MODE_ALL)) - vty_out(vty, "PCEP message debugging is on\n"); - if (DEBUG_MODE_CHECK(&pcep_g->dbg_lib, DEBUG_MODE_ALL)) - vty_out(vty, "PCEP lib debugging is on\n"); - - return CMD_SUCCESS; -} - DEFPY(pcep_cli_debug, pcep_cli_debug_cmd, "[no] debug pathd pcep [{basic$basic|path$path|message$msg|pceplib$lib}]", @@ -2369,7 +2348,6 @@ void pcep_cli_init(void) /* Top commands */ install_element(CONFIG_NODE, &pcep_cli_debug_cmd); install_element(ENABLE_NODE, &pcep_cli_debug_cmd); - install_element(ENABLE_NODE, &show_debugging_pathd_pcep_cmd); install_element(ENABLE_NODE, &pcep_cli_show_srte_pcep_counters_cmd); install_element(ENABLE_NODE, &pcep_cli_show_srte_pcep_pce_config_cmd); install_element(ENABLE_NODE, &pcep_cli_show_srte_pcep_pce_cmd); diff --git a/pathd/path_ted.c b/pathd/path_ted.c index 88cda7918..0f8d3827f 100644 --- a/pathd/path_ted.c +++ b/pathd/path_ted.c @@ -463,17 +463,6 @@ DEFPY (show_pathd_ted_db, return CMD_SUCCESS; } -/* - * Config Write functions - */ - - -void path_ted_show_debugging(struct vty *vty) -{ - if (DEBUG_MODE_CHECK(&ted_state_g.dbg, DEBUG_MODE_ALL)) - vty_out(vty, " Path TED debugging is on\n"); -} - /** * Help fn to show ted related configuration * diff --git a/pathd/path_ted.h b/pathd/path_ted.h index 449e62f84..7f3b3f590 100644 --- a/pathd/path_ted.h +++ b/pathd/path_ted.h @@ -81,7 +81,6 @@ int path_ted_segment_list_refresh(void); /* TED configuration functions */ uint32_t path_ted_config_write(struct vty *vty); -void path_ted_show_debugging(struct vty *vty); /* TED util functions */ /* clang-format off */ diff --git a/pathd/pathd.c b/pathd/pathd.c index 5df0e9c2d..431fe4d1e 100644 --- a/pathd/pathd.c +++ b/pathd/pathd.c @@ -1279,12 +1279,6 @@ const char *srte_origin2str(enum srte_protocol_origin origin) assert(!"Reached end of function we should never hit"); } -void path_policy_show_debugging(struct vty *vty) -{ - if (DEBUG_MODE_CHECK(&path_policy_debug, DEBUG_MODE_ALL)) - vty_out(vty, " Path policy debugging is on\n"); -} - void pathd_shutdown(void) { path_ted_teardown(); diff --git a/pathd/pathd.h b/pathd/pathd.h index c8cde33a1..75e7eff92 100644 --- a/pathd/pathd.h +++ b/pathd/pathd.h @@ -435,7 +435,6 @@ void srte_candidate_status_update(struct srte_candidate *candidate, int status); void srte_candidate_unset_segment_list(const char *originator, bool force); const char *srte_origin2str(enum srte_protocol_origin origin); void pathd_shutdown(void); -void path_policy_show_debugging(struct vty *vty); /* path_cli.c */ void path_cli_init(void); diff --git a/pbrd/pbr_debug.c b/pbrd/pbr_debug.c index 027f1e2c5..6b0d1d5a8 100644 --- a/pbrd/pbr_debug.c +++ b/pbrd/pbr_debug.c @@ -19,29 +19,6 @@ struct debug pbr_dbg_zebra = { 0, "debug pbr zebra", struct debug pbr_dbg_nht = { 0, "debug pbr nht", "PBR nexthop tracking" }; struct debug pbr_dbg_event = { 0, "debug pbr events", "PBR events" }; -struct debug *pbr_debugs[] = {&pbr_dbg_map, &pbr_dbg_zebra, &pbr_dbg_nht, - &pbr_dbg_event}; - -const char *pbr_debugs_conflines[] = { - "debug pbr map", - "debug pbr zebra", - "debug pbr nht", - "debug pbr events", -}; - -int pbr_debug_config_write_helper(struct vty *vty, bool config) -{ - uint32_t mode = DEBUG_MODE_ALL; - - if (config) - mode = DEBUG_MODE_CONF; - - for (unsigned int i = 0; i < array_size(pbr_debugs); i++) - if (DEBUG_MODE_CHECK(pbr_debugs[i], mode)) - vty_out(vty, "%s\n", pbr_debugs_conflines[i]); - return 0; -} - void pbr_debug_init(void) { debug_install(&pbr_dbg_map); diff --git a/pbrd/pbr_debug.h b/pbrd/pbr_debug.h index 101c6986b..c1ffce99b 100644 --- a/pbrd/pbr_debug.h +++ b/pbrd/pbr_debug.h @@ -35,18 +35,4 @@ void pbr_debug_init(void); */ void pbr_debug_set_all(uint32_t flags, bool set); -/* - * Config write helper. - * - * vty - * Vty to write to - * - * config - * Whether we are writing to show run or saving config file - * - * Returns: - * 0 for convenience - */ -int pbr_debug_config_write_helper(struct vty *vty, bool config); - #endif /* __PBR_DEBUG_H__ */ diff --git a/pbrd/pbr_vty.c b/pbrd/pbr_vty.c index d08310ca8..08fe56c7b 100644 --- a/pbrd/pbr_vty.c +++ b/pbrd/pbr_vty.c @@ -1993,8 +1993,6 @@ DEFUN_NOSH(show_debugging_pbr, { vty_out(vty, "PBR debugging status:\n"); - pbr_debug_config_write_helper(vty, false); - cmd_show_lib_debugs(vty); return CMD_SUCCESS; diff --git a/staticd/static_debug.c b/staticd/static_debug.c index 7e7027106..618ba91d1 100644 --- a/staticd/static_debug.c +++ b/staticd/static_debug.c @@ -22,39 +22,8 @@ struct debug static_dbg_events = {0, "debug static events", "Staticd events"}; struct debug static_dbg_route = {0, "debug static route", "Staticd route"}; struct debug static_dbg_bfd = {0, "debug static bfd", "Staticd bfd"}; - -struct debug *static_debug_arr[] = { - &static_dbg_events, - &static_dbg_route, - &static_dbg_bfd -}; - -const char *static_debugs_conflines[] = { - "debug static events", - "debug static route", - "debug static bfd" -}; /* clang-format on */ -static int static_debug_config_write_helper(struct vty *vty, bool config) -{ - uint32_t mode = DEBUG_MODE_ALL; - - if (config) - mode = DEBUG_MODE_CONF; - - for (unsigned int i = 0; i < array_size(static_debug_arr); i++) - if (DEBUG_MODE_CHECK(static_debug_arr[i], mode)) - vty_out(vty, "%s\n", static_debugs_conflines[i]); - - return 0; -} - -int static_debug_status_write(struct vty *vty) -{ - return static_debug_config_write_helper(vty, false); -} - /* * Set debugging status. * diff --git a/staticd/static_debug.h b/staticd/static_debug.h index 347f38b63..b990f7bcc 100644 --- a/staticd/static_debug.h +++ b/staticd/static_debug.h @@ -29,14 +29,6 @@ extern struct debug static_dbg_bfd; void static_debug_init(void); /* - * Print staticd debugging configuration, human readable form. - * - * vty - * VTY to print debugging configuration to. - */ -int static_debug_status_write(struct vty *vty); - -/* * Set debugging status. * * vtynode diff --git a/staticd/static_vty.c b/staticd/static_vty.c index 65c873688..07b8bc3d2 100644 --- a/staticd/static_vty.c +++ b/staticd/static_vty.c @@ -1639,8 +1639,6 @@ DEFUN_NOSH (show_debugging_static, { vty_out(vty, "Staticd debugging status\n"); - static_debug_status_write(vty); - cmd_show_lib_debugs(vty); return CMD_SUCCESS; diff --git a/vrrpd/vrrp_debug.c b/vrrpd/vrrp_debug.c index ccb0803c0..fd0edcfc7 100644 --- a/vrrpd/vrrp_debug.c +++ b/vrrpd/vrrp_debug.c @@ -20,47 +20,8 @@ struct debug vrrp_dbg_pkt = {0, "debug vrrp packets", "VRRP packets"}; struct debug vrrp_dbg_proto = {0, "debug vrrp protocol", "VRRP protocol events"}; struct debug vrrp_dbg_sock = {0, "debug vrrp sockets", "VRRP sockets"}; struct debug vrrp_dbg_zebra = {0, "debug vrrp zebra", "VRRP Zebra events"}; - -struct debug *vrrp_debugs[] = { - &vrrp_dbg_arp, - &vrrp_dbg_auto, - &vrrp_dbg_ndisc, - &vrrp_dbg_pkt, - &vrrp_dbg_proto, - &vrrp_dbg_sock, - &vrrp_dbg_zebra -}; - -const char *vrrp_debugs_conflines[] = { - "debug vrrp arp", - "debug vrrp autoconfigure", - "debug vrrp ndisc", - "debug vrrp packets", - "debug vrrp protocol", - "debug vrrp sockets", - "debug vrrp zebra", -}; /* clang-format on */ -static int vrrp_debug_config_write_helper(struct vty *vty, bool config) -{ - uint32_t mode = DEBUG_MODE_ALL; - - if (config) - mode = DEBUG_MODE_CONF; - - for (unsigned int i = 0; i < array_size(vrrp_debugs); i++) - if (DEBUG_MODE_CHECK(vrrp_debugs[i], mode)) - vty_out(vty, "%s\n", vrrp_debugs_conflines[i]); - - return 0; -} - -int vrrp_debug_status_write(struct vty *vty) -{ - return vrrp_debug_config_write_helper(vty, false); -} - void vrrp_debug_set(struct interface *ifp, uint8_t vrid, int vtynode, bool onoff, bool proto, bool autoconf, bool pkt, bool sock, bool ndisc, bool arp, bool zebra) diff --git a/vrrpd/vrrp_vty.c b/vrrpd/vrrp_vty.c index 53f66c79c..985354af3 100644 --- a/vrrpd/vrrp_vty.c +++ b/vrrpd/vrrp_vty.c @@ -738,8 +738,6 @@ DEFUN_NOSH (show_debugging_vrrp, { vty_out(vty, "VRRP debugging status:\n"); - vrrp_debug_status_write(vty); - cmd_show_lib_debugs(vty); return CMD_SUCCESS; |