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 <chris@opensourcerouting.org>
This commit is contained in:
Christian Franke 2018-06-07 11:08:55 +02:00
parent a2d41bb0ee
commit df0ba689eb
3 changed files with 46 additions and 1 deletions

View File

@ -271,6 +271,16 @@ bool fabricd_initial_sync_is_in_progress(struct isis_area *area)
return false; 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 isis_circuit *fabricd_initial_sync_circuit(struct isis_area *area)
{ {
struct fabricd *f = area->fabricd; struct fabricd *f = area->fabricd;
@ -660,3 +670,24 @@ void fabricd_lsp_flood(struct isis_lsp *lsp)
zlog_debug("OpenFabric: Flooding algorithm complete."); 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]);
}
}

View File

@ -33,6 +33,7 @@ struct vty;
struct fabricd *fabricd_new(struct isis_area *area); struct fabricd *fabricd_new(struct isis_area *area);
void fabricd_finish(struct fabricd *f); void fabricd_finish(struct fabricd *f);
void fabricd_initial_sync_hello(struct isis_circuit *circuit); 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); bool fabricd_initial_sync_is_in_progress(struct isis_area *area);
struct isis_circuit *fabricd_initial_sync_circuit(struct isis_area *area); struct isis_circuit *fabricd_initial_sync_circuit(struct isis_area *area);
void fabricd_initial_sync_finish(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); uint8_t fabricd_tier(struct isis_area *area);
int fabricd_write_settings(struct isis_area *area, struct vty *vty); int fabricd_write_settings(struct isis_area *area, struct vty *vty);
void fabricd_lsp_flood(struct isis_lsp *lsp); void fabricd_lsp_flood(struct isis_lsp *lsp);
void fabricd_trigger_csnp(struct isis_area *area);
#endif #endif

View File

@ -1044,7 +1044,7 @@ dontcheckadj:
if (!lsp0) { if (!lsp0) {
zlog_debug( zlog_debug(
"Got lsp frag, while zero lsp not in database"); "Got lsp frag, while zero lsp not in database");
return ISIS_OK; goto out;
} }
} }
/* i */ /* i */
@ -1089,6 +1089,10 @@ dontcheckadj:
retval = ISIS_OK; retval = ISIS_OK;
out: out:
if (circuit_scoped) {
fabricd_trigger_csnp(circuit->area);
}
isis_free_tlvs(tlvs); isis_free_tlvs(tlvs);
return retval; 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 */ /* 7.3.15.2 b) Actions on LSP_ENTRIES reported */
for (struct isis_lsp_entry *entry = entry_head; entry; for (struct isis_lsp_entry *entry = entry_head; entry;
entry = entry->next) { entry = entry->next) {
@ -1279,6 +1285,7 @@ static int process_snp(uint8_t pdu_type, struct isis_circuit *circuit,
/* if (circuit->circ_type != /* if (circuit->circ_type !=
* CIRCUIT_T_BROADCAST) */ * CIRCUIT_T_BROADCAST) */
isis_tx_queue_del(circuit->tx_queue, lsp); isis_tx_queue_del(circuit->tx_queue, lsp);
resync_needed = true;
} }
} }
} else { } else {
@ -1313,6 +1320,7 @@ static int process_snp(uint8_t pdu_type, struct isis_circuit *circuit,
lsp_set_all_srmflags(lsp, false); lsp_set_all_srmflags(lsp, false);
ISIS_SET_FLAG(lsp->SSNflags, circuit); 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) */ /* on remaining LSPs we set SRM (neighbor knew not of) */
for (ALL_LIST_ELEMENTS_RO(lsp_list, node, lsp)) { for (ALL_LIST_ELEMENTS_RO(lsp_list, node, lsp)) {
isis_tx_queue_add(circuit->tx_queue, lsp, TX_LSP_NORMAL); isis_tx_queue_add(circuit->tx_queue, lsp, TX_LSP_NORMAL);
resync_needed = true;
} }
/* lets free it */ /* lets free it */
list_delete_and_null(&lsp_list); 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; retval = ISIS_OK;
out: out:
isis_free_tlvs(tlvs); isis_free_tlvs(tlvs);