From df0ba689ebf4960812bb4c65ea1b44236627f6ba Mon Sep 17 00:00:00 2001 From: Christian Franke Date: Thu, 7 Jun 2018 11:08:55 +0200 Subject: [PATCH] fabricd: trigger CSNP after flooding scope LSP has been received 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 --- isisd/fabricd.c | 31 +++++++++++++++++++++++++++++++ isisd/fabricd.h | 2 ++ isisd/isis_pdu.c | 14 +++++++++++++- 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/isisd/fabricd.c b/isisd/fabricd.c index 88ecdf2a7b..b52f2b554e 100644 --- a/isisd/fabricd.c +++ b/isisd/fabricd.c @@ -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]); + } +} diff --git a/isisd/fabricd.h b/isisd/fabricd.h index da07c5d814..f54c7bf89e 100644 --- a/isisd/fabricd.h +++ b/isisd/fabricd.h @@ -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 diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c index d5e9704b02..fc9ff5143f 100644 --- a/isisd/isis_pdu.c +++ b/isisd/isis_pdu.c @@ -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); -- 2.39.5