]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: Separate out the debug_init api 4393/head
authorDonald Sharp <sharpd@cumulusnetworks.com>
Sat, 25 May 2019 00:15:31 +0000 (20:15 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 28 May 2019 21:16:16 +0000 (17:16 -0400)
Separate out the debug_init api to have 2 functions:

1) Function to register a callback
2) Function to initiate the cli.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
lib/debug.c
lib/debug.h
lib/libfrr.c
lib/northbound_cli.c

index a39623b03981d425d70010234534dbb213751e77..3248ceb13b53222e84a143a5a532a73c4cf8d0dd 100644 (file)
@@ -54,7 +54,10 @@ void debug_init(struct debug_callbacks *cb)
        }
 
        debug_cb_list_add_head(&cb_head, cb);
+}
 
+void debug_init_cli(void)
+{
        install_element(ENABLE_NODE, &debug_all_cmd);
        install_element(CONFIG_NODE, &debug_all_cmd);
 }
index 0ee5963ec6b8a2f5d759ab93ee16ad21e8850e88..f25cd426913f8a0bb518df0e77b6e1933c6d060c 100644 (file)
@@ -241,6 +241,12 @@ struct debug_callbacks {
  */
 void debug_init(struct debug_callbacks *cb);
 
+/*
+ * Turn on the cli to turn on/off debugs.
+ * Should only be called by libfrr
+ */
+void debug_init_cli(void);
+
 #ifdef __cplusplus
 }
 #endif
index 5970e70a6bd493230f9b7cb5091cb963277178c5..8fa1509b7dfbecf0582b2aa26891aa4e722e20a9 100644 (file)
@@ -39,6 +39,7 @@
 #include "db.h"
 #include "northbound_cli.h"
 #include "northbound_db.h"
+#include "debug.h"
 
 DEFINE_HOOK(frr_late_init, (struct thread_master * tm), (tm))
 DEFINE_KOOH(frr_early_fini, (), ())
@@ -654,6 +655,9 @@ struct thread_master *frr_init(void)
        lib_error_init();
 
        yang_init();
+
+       debug_init_cli();
+
        nb_init(master, di->yang_modules, di->n_yang_modules);
        if (nb_db_init() != NB_OK)
                flog_warn(EC_LIB_NB_DATABASE,
index ae1b0578a004ef473da89b2c97ea8c74a6a2a906..7b7b526af02a52a64f66b98b3f1454341d1c182a 100644 (file)
@@ -1722,8 +1722,8 @@ void nb_cli_init(struct thread_master *tm)
        /* Initialize the shared candidate configuration. */
        vty_shared_candidate_config = nb_config_new(NULL);
 
-       /* Install debug commands */
        debug_init(&nb_dbg_cbs);
+
        install_node(&nb_debug_node, nb_debug_config_write);
        install_element(ENABLE_NODE, &debug_nb_cmd);
        install_element(CONFIG_NODE, &debug_nb_cmd);