From 82e52e0f21c12aa5b7270032c32b38e1fa33aa28 Mon Sep 17 00:00:00 2001 From: Igor Ryzhov Date: Tue, 26 Mar 2024 19:24:45 +0200 Subject: 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 --- lib/debug.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'lib/debug.c') 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); } -- cgit v1.2.3