mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-03 02:22:48 +00:00
fabricd: Improve LSP flooding log
Also track when we received an LSP as do not reflood, as well as the time when we last considered flooding it. Signed-off-by: Christian Franke <chris@opensourcerouting.org>
This commit is contained in:
parent
1eb7c3a195
commit
a6b60da99a
@ -588,6 +588,8 @@ static void fabricd_free_lsp_flooding_info(void *val)
|
||||
static void fabricd_lsp_reset_flooding_info(struct isis_lsp *lsp,
|
||||
struct isis_circuit *circuit)
|
||||
{
|
||||
lsp->flooding_time = time(NULL);
|
||||
|
||||
XFREE(MTYPE_FABRICD_FLOODING_INFO, lsp->flooding_interface);
|
||||
for (enum isis_tx_type type = TX_LSP_NORMAL;
|
||||
type <= TX_LSP_CIRCUIT_SCOPED; type++) {
|
||||
@ -604,6 +606,8 @@ static void fabricd_lsp_reset_flooding_info(struct isis_lsp *lsp,
|
||||
lsp->flooding_interface = XSTRDUP(MTYPE_FABRICD_FLOODING_INFO,
|
||||
circuit->interface->name);
|
||||
}
|
||||
|
||||
lsp->flooding_circuit_scoped = false;
|
||||
}
|
||||
|
||||
void fabricd_lsp_flood(struct isis_lsp *lsp, struct isis_circuit *circuit)
|
||||
@ -759,3 +763,13 @@ void fabricd_lsp_free(struct isis_lsp *lsp)
|
||||
list_delete(&lsp->flooding_neighbors[type]);
|
||||
}
|
||||
}
|
||||
|
||||
void fabricd_update_lsp_no_flood(struct isis_lsp *lsp,
|
||||
struct isis_circuit *circuit)
|
||||
{
|
||||
if (!fabricd)
|
||||
return;
|
||||
|
||||
fabricd_lsp_reset_flooding_info(lsp, circuit);
|
||||
lsp->flooding_circuit_scoped = true;
|
||||
}
|
||||
|
@ -46,5 +46,7 @@ void fabricd_lsp_flood(struct isis_lsp *lsp, struct isis_circuit *circuit);
|
||||
void fabricd_trigger_csnp(struct isis_area *area);
|
||||
struct list *fabricd_ip_addrs(struct isis_circuit *circuit);
|
||||
void fabricd_lsp_free(struct isis_lsp *lsp);
|
||||
void fabricd_update_lsp_no_flood(struct isis_lsp *lsp,
|
||||
struct isis_circuit *circuit);
|
||||
|
||||
#endif
|
||||
|
@ -48,8 +48,10 @@ struct isis_lsp {
|
||||
struct isis_area *area;
|
||||
struct isis_tlvs *tlvs;
|
||||
|
||||
time_t flooding_time;
|
||||
struct list *flooding_neighbors[TX_LSP_CIRCUIT_SCOPED + 1];
|
||||
char *flooding_interface;
|
||||
bool flooding_circuit_scoped;
|
||||
};
|
||||
|
||||
dict_t *lsp_db_init(void);
|
||||
|
@ -702,6 +702,17 @@ out:
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void lsp_flood_or_update(struct isis_lsp *lsp,
|
||||
struct isis_circuit *circuit,
|
||||
bool circuit_scoped)
|
||||
{
|
||||
if (!circuit_scoped) {
|
||||
lsp_flood(lsp, circuit);
|
||||
} else {
|
||||
fabricd_update_lsp_no_flood(lsp, circuit);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Process Level 1/2 Link State
|
||||
* ISO - 10589
|
||||
@ -931,8 +942,8 @@ dontcheckadj:
|
||||
lsp_confusion);
|
||||
tlvs = NULL;
|
||||
/* ii */
|
||||
if (!circuit_scoped)
|
||||
lsp_flood(lsp, NULL);
|
||||
lsp_flood_or_update(lsp, NULL,
|
||||
circuit_scoped);
|
||||
/* v */
|
||||
ISIS_FLAGS_CLEAR_ALL(
|
||||
lsp->SSNflags); /* FIXME:
|
||||
@ -977,8 +988,7 @@ dontcheckadj:
|
||||
/* our own LSP -> 7.3.16.4 c) */
|
||||
if (comp == LSP_NEWER) {
|
||||
lsp_inc_seqno(lsp, hdr.seqno);
|
||||
if (!circuit_scoped)
|
||||
lsp_flood(lsp, NULL);
|
||||
lsp_flood_or_update(lsp, NULL, circuit_scoped);
|
||||
} else {
|
||||
isis_tx_queue_add(circuit->tx_queue,
|
||||
lsp, TX_LSP_NORMAL);
|
||||
@ -1068,8 +1078,7 @@ dontcheckadj:
|
||||
circuit->area, level, false);
|
||||
tlvs = NULL;
|
||||
}
|
||||
if (!circuit_scoped)
|
||||
lsp_flood(lsp, circuit);
|
||||
lsp_flood_or_update(lsp, circuit, circuit_scoped);
|
||||
|
||||
/* iv */
|
||||
if (circuit->circ_type != CIRCUIT_T_BROADCAST)
|
||||
|
@ -65,14 +65,34 @@ static void lsp_print_flooding(struct vty *vty, struct isis_lsp *lsp)
|
||||
vty_out(vty, "Flooding information for %s\n", lspid);
|
||||
|
||||
if (!lsp->flooding_neighbors[TX_LSP_NORMAL]) {
|
||||
vty_out(vty, " Never flooded.\n");
|
||||
vty_out(vty, " Never received.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
vty_out(vty, " Last received on: %s\n",
|
||||
vty_out(vty, " Last received on: %s (",
|
||||
lsp->flooding_interface ?
|
||||
lsp->flooding_interface : "(null)");
|
||||
|
||||
time_t uptime = time(NULL) - lsp->flooding_time;
|
||||
struct tm *tm = gmtime(&uptime);
|
||||
|
||||
if (uptime < ONE_DAY_SECOND)
|
||||
vty_out(vty, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min,
|
||||
tm->tm_sec);
|
||||
else if (uptime < ONE_WEEK_SECOND)
|
||||
vty_out(vty, "%dd%02dh%02dm", tm->tm_yday, tm->tm_hour,
|
||||
tm->tm_min);
|
||||
else
|
||||
vty_out(vty, "%02dw%dd%02dh", tm->tm_yday / 7,
|
||||
tm->tm_yday - ((tm->tm_yday / 7) * 7),
|
||||
tm->tm_hour);
|
||||
vty_out(vty, " ago)\n");
|
||||
|
||||
if (lsp->flooding_circuit_scoped) {
|
||||
vty_out(vty, " Received as circuit-scoped LSP, so not flooded.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
for (enum isis_tx_type type = TX_LSP_NORMAL;
|
||||
type <= TX_LSP_CIRCUIT_SCOPED; type++) {
|
||||
struct listnode *node;
|
||||
|
Loading…
Reference in New Issue
Block a user