]> git.puffer.fish Git - mirror/frr.git/commitdiff
isisd: Provide better flooding debugging
authorChristian Franke <chris@opensourcerouting.org>
Fri, 16 Nov 2018 15:31:37 +0000 (16:31 +0100)
committerRodny Molina <rmolina@linkedin.com>
Fri, 7 Dec 2018 19:45:14 +0000 (19:45 +0000)
Show from where LSP flooding is triggered.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
isisd/fabricd.c
isisd/isis_lsp.c
isisd/isis_lsp.h
isisd/isis_vty_fabricd.c
isisd/isisd.c
isisd/isisd.h

index 2b3116b1ff19fd107d4f69c31b7cf1db1903f7a4..a9eb6da521e552dde5e5b907c9e7f6987ee9c5e0 100644 (file)
@@ -502,7 +502,7 @@ static void move_to_dnr(struct isis_lsp *lsp, struct neighbor_entry *n)
 
        n->present = false;
 
-       if (isis->debugs & DEBUG_FABRICD_FLOODING) {
+       if (isis->debugs & DEBUG_FLOODING) {
                char buff[PREFIX2STR_BUFFER];
                zlog_debug("OpenFabric: Adding %s to DNR",
                           vid2string(n->vertex, buff, sizeof(buff)));
@@ -520,7 +520,7 @@ static void move_to_rf(struct isis_lsp *lsp, struct neighbor_entry *n)
 
        n->present = false;
 
-       if (isis->debugs & DEBUG_FABRICD_FLOODING) {
+       if (isis->debugs & DEBUG_FLOODING) {
                char buff[PREFIX2STR_BUFFER];
                zlog_debug("OpenFabric: Adding %s to RF",
                           vid2string(n->vertex, buff, sizeof(buff)));
@@ -549,7 +549,7 @@ static void handle_firsthops(struct hash_backet *backet, void *arg)
 
        n = neighbor_entry_lookup_list(f->neighbors, vertex->N.id);
        if (n) {
-               if (isis->debugs & DEBUG_FABRICD_FLOODING) {
+               if (isis->debugs & DEBUG_FLOODING) {
                        char buff[PREFIX2STR_BUFFER];
                        zlog_debug("Removing %s from NL as its in the reverse path",
                                   vid2string(vertex, buff, sizeof(buff)));
@@ -559,7 +559,7 @@ static void handle_firsthops(struct hash_backet *backet, void *arg)
 
        n = neighbor_entry_lookup_hash(f->neighbors_neighbors, vertex->N.id);
        if (n) {
-               if (isis->debugs & DEBUG_FABRICD_FLOODING) {
+               if (isis->debugs & DEBUG_FLOODING) {
                        char buff[PREFIX2STR_BUFFER];
                        zlog_debug("Removing %s from NN as its in the reverse path",
                                   vid2string(vertex, buff, sizeof(buff)));
@@ -576,11 +576,6 @@ void fabricd_lsp_flood(struct isis_lsp *lsp)
        void *cursor = NULL;
        struct neighbor_entry *n;
 
-       if (isis->debugs & DEBUG_FABRICD_FLOODING) {
-               zlog_debug("OpenFabric: Flooding LSP %s",
-                          rawlspid_print(lsp->hdr.lsp_id));
-       }
-
        /* Mark all elements in NL as present and move T0s into DNR */
        while (!skiplist_next(f->neighbors, NULL, (void **)&n, &cursor)) {
                n->present = true;
@@ -595,7 +590,7 @@ void fabricd_lsp_flood(struct isis_lsp *lsp)
                        continue;
                }
 
-               if (isis->debugs & DEBUG_FABRICD_FLOODING) {
+               if (isis->debugs & DEBUG_FLOODING) {
                        zlog_debug("Moving %s to DNR because it's T0",
                                   rawlspid_print(node_lsp->hdr.lsp_id));
                }
@@ -623,7 +618,7 @@ void fabricd_lsp_flood(struct isis_lsp *lsp)
 
                struct isis_lsp *nlsp = lsp_for_vertex(f->spftree, n->vertex);
                if (!nlsp || !nlsp->tlvs) {
-                       if (isis->debugs & DEBUG_FABRICD_FLOODING) {
+                       if (isis->debugs & DEBUG_FLOODING) {
                                char buff[PREFIX2STR_BUFFER];
                                zlog_debug("Moving %s to DNR as it has no LSP",
                                           vid2string(n->vertex, buff, sizeof(buff)));
@@ -633,7 +628,7 @@ void fabricd_lsp_flood(struct isis_lsp *lsp)
                        continue;
                }
 
-               if (isis->debugs & DEBUG_FABRICD_FLOODING) {
+               if (isis->debugs & DEBUG_FLOODING) {
                        char buff[PREFIX2STR_BUFFER];
                        zlog_debug("Considering %s from NL...",
                                   vid2string(n->vertex, buff, sizeof(buff)));
@@ -651,7 +646,7 @@ void fabricd_lsp_flood(struct isis_lsp *lsp)
                                                        er->id);
 
                        if (nn) {
-                               if (isis->debugs & DEBUG_FABRICD_FLOODING) {
+                               if (isis->debugs & DEBUG_FLOODING) {
                                        char buff[PREFIX2STR_BUFFER];
                                        zlog_debug("Found neighbor %s in NN, removing it from NN and setting reflood.",
                                                   vid2string(nn->vertex, buff, sizeof(buff)));
@@ -668,7 +663,7 @@ void fabricd_lsp_flood(struct isis_lsp *lsp)
                        move_to_dnr(lsp, n);
        }
 
-       if (isis->debugs & DEBUG_FABRICD_FLOODING) {
+       if (isis->debugs & DEBUG_FLOODING) {
                zlog_debug("OpenFabric: Flooding algorithm complete.");
        }
 }
index 9a57d0d0ac2f522cba654e01bb40e9ac10873257..de9c84402fc9a147fc607e37f780c30adf10f490 100644 (file)
@@ -1997,8 +1997,17 @@ void lsp_set_all_srmflags(struct isis_lsp *lsp, bool set)
        }
 }
 
-void lsp_flood(struct isis_lsp *lsp, struct isis_circuit *circuit)
+void _lsp_flood(struct isis_lsp *lsp, struct isis_circuit *circuit,
+               const char *func, const char *file, int line)
 {
+       if (isis->debugs & DEBUG_FLOODING) {
+               zlog_debug("Flooding LSP %s%s%s (From %s %s:%d)",
+                          rawlspid_print(lsp->hdr.lsp_id),
+                          circuit ? " except on " : "",
+                          circuit ? circuit->interface->name : "",
+                          func, file, line);
+       }
+
        if (!fabricd)
                lsp_set_all_srmflags(lsp, true);
        else
index 2b45e6994ce1179887156cc90233e90876a0e531..f303c953c0fa1694d063b3349a740d7ebcb06e44 100644 (file)
@@ -105,7 +105,11 @@ void lsp_print_detail(struct isis_lsp *lsp, struct vty *vty, char dynhost);
 int lsp_print_all(struct vty *vty, dict_t *lspdb, char detail, char dynhost);
 /* sets SRMflags for all active circuits of an lsp */
 void lsp_set_all_srmflags(struct isis_lsp *lsp, bool set);
-void lsp_flood(struct isis_lsp *lsp, struct isis_circuit *circuit);
+
+#define lsp_flood(lsp, circuit) \
+       _lsp_flood((lsp), (circuit), __func__, __FILE__, __LINE__)
+void _lsp_flood(struct isis_lsp *lsp, struct isis_circuit *circuit,
+               const char *func, const char *file, int line);
 void lsp_init(void);
 
 #endif /* ISIS_LSP */
index 95ebe0de81dd23b3a478d0de61b0b8408424647d..5ef3af0f19d204d33f2147ba42034fa17178351c 100644 (file)
@@ -55,40 +55,8 @@ DEFUN (no_fabric_tier,
        return CMD_SUCCESS;
 }
 
-DEFUN (debug_fabric_flooding,
-       debug_fabric_flooding_cmd,
-       "debug openfabric flooding",
-       DEBUG_STR
-       PROTO_HELP
-       "Flooding optimization algorithm\n")
-{
-       isis->debugs |= DEBUG_FABRICD_FLOODING;
-       print_debug(vty, DEBUG_FABRICD_FLOODING, 1);
-
-       return CMD_SUCCESS;
-}
-
-DEFUN (no_debug_fabric_flooding,
-       no_debug_fabric_flooding_cmd,
-       "no debug openfabric flooding",
-       NO_STR
-       UNDEBUG_STR
-       PROTO_HELP
-       "Flooding optimization algorithm\n")
-{
-       isis->debugs &= ~DEBUG_FABRICD_FLOODING;
-       print_debug(vty, DEBUG_FABRICD_FLOODING, 0);
-
-       return CMD_SUCCESS;
-}
-
-
 void isis_vty_daemon_init(void)
 {
        install_element(ROUTER_NODE, &fabric_tier_cmd);
        install_element(ROUTER_NODE, &no_fabric_tier_cmd);
-       install_element(ENABLE_NODE, &debug_fabric_flooding_cmd);
-       install_element(ENABLE_NODE, &no_debug_fabric_flooding_cmd);
-       install_element(CONFIG_NODE, &debug_fabric_flooding_cmd);
-       install_element(CONFIG_NODE, &no_debug_fabric_flooding_cmd);
 }
index 279f7bfee1c5dbb81adf15bfd03c706419897362..0138f4345dadb914580645725a997262797b8dea 100644 (file)
@@ -741,8 +741,8 @@ void print_debug(struct vty *vty, int flags, int onoff)
                vty_out(vty, "IS-IS LSP generation debugging is %s\n", onoffs);
        if (flags & DEBUG_LSP_SCHED)
                vty_out(vty, "IS-IS LSP scheduling debugging is %s\n", onoffs);
-       if (flags & DEBUG_FABRICD_FLOODING)
-               vty_out(vty, "OpenFabric Flooding debugging is %s\n", onoffs);
+       if (flags & DEBUG_FLOODING)
+               vty_out(vty, "IS-IS Flooding debugging is %s\n", onoffs);
        if (flags & DEBUG_BFD)
                vty_out(vty, "IS-IS BFD debugging is %s\n", onoffs);
 }
@@ -810,7 +810,7 @@ static int config_write_debug(struct vty *vty)
                vty_out(vty, "debug " PROTO_NAME " lsp-sched\n");
                write++;
        }
-       if (flags & DEBUG_FABRICD_FLOODING) {
+       if (flags & DEBUG_FLOODING) {
                vty_out(vty, "debug " PROTO_NAME " flooding\n");
                write++;
        }
@@ -877,6 +877,33 @@ DEFUN (no_debug_isis_tx_queue,
        return CMD_SUCCESS;
 }
 
+DEFUN (debug_isis_flooding,
+       debug_isis_flooding_cmd,
+       "debug " PROTO_NAME " flooding",
+       DEBUG_STR
+       PROTO_HELP
+       "Flooding algorithm\n")
+{
+       isis->debugs |= DEBUG_FLOODING;
+       print_debug(vty, DEBUG_FLOODING, 1);
+
+       return CMD_SUCCESS;
+}
+
+DEFUN (no_debug_isis_flooding,
+       no_debug_isis_flooding_cmd,
+       "no debug " PROTO_NAME " flooding",
+       NO_STR
+       UNDEBUG_STR
+       PROTO_HELP
+       "Flooding algorithm\n")
+{
+       isis->debugs &= ~DEBUG_FLOODING;
+       print_debug(vty, DEBUG_FLOODING, 0);
+
+       return CMD_SUCCESS;
+}
+
 DEFUN (debug_isis_snp,
        debug_isis_snp_cmd,
        "debug " PROTO_NAME " snp-packets",
@@ -2097,6 +2124,8 @@ void isis_init()
        install_element(ENABLE_NODE, &no_debug_isis_adj_cmd);
        install_element(ENABLE_NODE, &debug_isis_tx_queue_cmd);
        install_element(ENABLE_NODE, &no_debug_isis_tx_queue_cmd);
+       install_element(ENABLE_NODE, &debug_isis_flooding_cmd);
+       install_element(ENABLE_NODE, &no_debug_isis_flooding_cmd);
        install_element(ENABLE_NODE, &debug_isis_snp_cmd);
        install_element(ENABLE_NODE, &no_debug_isis_snp_cmd);
        install_element(ENABLE_NODE, &debug_isis_upd_cmd);
@@ -2120,6 +2149,8 @@ void isis_init()
        install_element(CONFIG_NODE, &no_debug_isis_adj_cmd);
        install_element(CONFIG_NODE, &debug_isis_tx_queue_cmd);
        install_element(CONFIG_NODE, &no_debug_isis_tx_queue_cmd);
+       install_element(CONFIG_NODE, &debug_isis_flooding_cmd);
+       install_element(CONFIG_NODE, &no_debug_isis_flooding_cmd);
        install_element(CONFIG_NODE, &debug_isis_snp_cmd);
        install_element(CONFIG_NODE, &no_debug_isis_snp_cmd);
        install_element(CONFIG_NODE, &debug_isis_upd_cmd);
index 95fdb971b1514d0db0d354205928b2abfafeb1f9..7899d3ecd8f62fcd7a619a5439a9f3ee158fbfd5 100644 (file)
@@ -212,7 +212,7 @@ extern struct thread_master *master;
 #define DEBUG_PACKET_DUMP                (1<<6)
 #define DEBUG_LSP_GEN                    (1<<7)
 #define DEBUG_LSP_SCHED                  (1<<8)
-#define DEBUG_FABRICD_FLOODING           (1<<9)
+#define DEBUG_FLOODING                   (1<<9)
 #define DEBUG_BFD                        (1<<10)
 #define DEBUG_TX_QUEUE                   (1<<11)