]> git.puffer.fish Git - mirror/frr.git/commitdiff
fabricd: trigger CSNP after flooding scope LSP has been received
authorChristian Franke <chris@opensourcerouting.org>
Thu, 7 Jun 2018 09:08:55 +0000 (11:08 +0200)
committerChristian Franke <chris@opensourcerouting.org>
Wed, 5 Sep 2018 09:38:13 +0000 (11:38 +0200)
Have fabricd send out a CSNP whenever a circuit scoped LSP is received,
and log a warning if the CSNP showed resynchronization was necessary.

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

index 88ecdf2a7b08ea017874131d47c7a7a83ea56e0c..b52f2b554ea23e491a5738843315733cfc39f53b 100644 (file)
@@ -271,6 +271,16 @@ bool fabricd_initial_sync_is_in_progress(struct isis_area *area)
        return false;
 }
 
+bool fabricd_initial_sync_is_complete(struct isis_area *area)
+{
+       struct fabricd *f = area->fabricd;
+
+       if (!f)
+               return false;
+
+       return f->initial_sync_state == FABRICD_SYNC_COMPLETE;
+}
+
 struct isis_circuit *fabricd_initial_sync_circuit(struct isis_area *area)
 {
        struct fabricd *f = area->fabricd;
@@ -660,3 +670,24 @@ void fabricd_lsp_flood(struct isis_lsp *lsp)
                zlog_debug("OpenFabric: Flooding algorithm complete.");
        }
 }
+
+void fabricd_trigger_csnp(struct isis_area *area)
+{
+       struct fabricd *f = area->fabricd;
+
+       if (!f)
+               return;
+
+       struct listnode *node;
+       struct isis_circuit *circuit;
+
+       for (ALL_LIST_ELEMENTS_RO(area->circuit_list, node, circuit)) {
+               if (!circuit->t_send_csnp[1])
+                       continue;
+
+               thread_cancel(circuit->t_send_csnp[ISIS_LEVEL2 - 1]);
+               thread_add_timer_msec(master, send_l2_csnp, circuit,
+                                     isis_jitter(500, CSNP_JITTER),
+                                     &circuit->t_send_csnp[ISIS_LEVEL2 - 1]);
+       }
+}
index da07c5d814df033da577e3cde419ccb91b1b3ef2..f54c7bf89e460e603ff83404e93a4719d23c7d8e 100644 (file)
@@ -33,6 +33,7 @@ struct vty;
 struct fabricd *fabricd_new(struct isis_area *area);
 void fabricd_finish(struct fabricd *f);
 void fabricd_initial_sync_hello(struct isis_circuit *circuit);
+bool fabricd_initial_sync_is_complete(struct isis_area *area);
 bool fabricd_initial_sync_is_in_progress(struct isis_area *area);
 struct isis_circuit *fabricd_initial_sync_circuit(struct isis_area *area);
 void fabricd_initial_sync_finish(struct isis_area *area);
@@ -42,5 +43,6 @@ void fabricd_configure_tier(struct isis_area *area, uint8_t tier);
 uint8_t fabricd_tier(struct isis_area *area);
 int fabricd_write_settings(struct isis_area *area, struct vty *vty);
 void fabricd_lsp_flood(struct isis_lsp *lsp);
+void fabricd_trigger_csnp(struct isis_area *area);
 
 #endif
index d5e9704b0226dc0b3fd214d1a15dac4f7fa71f72..fc9ff5143f305f2fc5f8bb3c92ce9fe3da166779 100644 (file)
@@ -1044,7 +1044,7 @@ dontcheckadj:
                                if (!lsp0) {
                                        zlog_debug(
                                                "Got lsp frag, while zero lsp not in database");
-                                       return ISIS_OK;
+                                       goto out;
                                }
                        }
                        /* i */
@@ -1089,6 +1089,10 @@ dontcheckadj:
        retval = ISIS_OK;
 
 out:
+       if (circuit_scoped) {
+               fabricd_trigger_csnp(circuit->area);
+       }
+
        isis_free_tlvs(tlvs);
        return retval;
 }
@@ -1243,6 +1247,8 @@ static int process_snp(uint8_t pdu_type, struct isis_circuit *circuit,
                }
        }
 
+       bool resync_needed = false;
+
        /* 7.3.15.2 b) Actions on LSP_ENTRIES reported */
        for (struct isis_lsp_entry *entry = entry_head; entry;
             entry = entry->next) {
@@ -1279,6 +1285,7 @@ static int process_snp(uint8_t pdu_type, struct isis_circuit *circuit,
                                        /* if (circuit->circ_type !=
                                         * CIRCUIT_T_BROADCAST) */
                                        isis_tx_queue_del(circuit->tx_queue, lsp);
+                                       resync_needed = true;
                                }
                        }
                } else {
@@ -1313,6 +1320,7 @@ static int process_snp(uint8_t pdu_type, struct isis_circuit *circuit,
 
                                lsp_set_all_srmflags(lsp, false);
                                ISIS_SET_FLAG(lsp->SSNflags, circuit);
+                               resync_needed = true;
                        }
                }
        }
@@ -1345,12 +1353,16 @@ static int process_snp(uint8_t pdu_type, struct isis_circuit *circuit,
                /* on remaining LSPs we set SRM (neighbor knew not of) */
                for (ALL_LIST_ELEMENTS_RO(lsp_list, node, lsp)) {
                        isis_tx_queue_add(circuit->tx_queue, lsp, TX_LSP_NORMAL);
+                       resync_needed = true;
                }
 
                /* lets free it */
                list_delete_and_null(&lsp_list);
        }
 
+       if (fabricd_initial_sync_is_complete(circuit->area) && resync_needed)
+               zlog_warn("OpenFabric: Needed to resync LSPDB using CSNP!\n");
+
        retval = ISIS_OK;
 out:
        isis_free_tlvs(tlvs);