summaryrefslogtreecommitdiff
path: root/lib/debug.c
diff options
context:
space:
mode:
authorIgor Ryzhov <iryzhov@nfware.com>2024-03-26 19:24:45 +0200
committerMark Stapp <mjs@cisco.com>2024-08-27 09:53:02 -0400
commit82e52e0f21c12aa5b7270032c32b38e1fa33aa28 (patch)
tree6a771925348869c500ab278fd54fb30b267bc7bf /lib/debug.c
parent5dac6961540422a1ca139fae8c5ea9e5a437c4ba (diff)
lib: common debug config output
Implement common code for debug config output and remove daemon-specific code that is duplicated everywhere. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'lib/debug.c')
-rw-r--r--lib/debug.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/debug.c b/lib/debug.c
index 5f9109b3f1..9c283176a6 100644
--- a/lib/debug.c
+++ b/lib/debug.c
@@ -38,6 +38,25 @@ DEFUN_NOSH (debug_all,
/* ------------------------------------------------------------------------- */
+static int config_write_debug(struct vty *vty)
+{
+ struct debug *debug;
+
+ frr_each (debug_list, &debug_head, debug) {
+ if (DEBUG_MODE_CHECK(debug, DEBUG_MODE_CONF))
+ vty_out(vty, "%s\n", debug->conf);
+ }
+
+ return 0;
+}
+
+static struct cmd_node debug_node = {
+ .name = "debug",
+ .node = LIB_DEBUG_NODE,
+ .prompt = "",
+ .config_write = config_write_debug,
+};
+
void debug_install(struct debug *debug)
{
debug_list_add_tail(&debug_head, debug);
@@ -47,6 +66,8 @@ void debug_init(void)
{
debug_list_init(&debug_head);
+ install_node(&debug_node);
+
install_element(ENABLE_NODE, &debug_all_cmd);
install_element(CONFIG_NODE, &debug_all_cmd);
}