diff options
-rw-r--r-- | isisd/fabricd.c | 14 | ||||
-rw-r--r-- | isisd/fabricd.h | 2 | ||||
-rw-r--r-- | isisd/isis_lsp.h | 2 | ||||
-rw-r--r-- | isisd/isis_pdu.c | 21 | ||||
-rw-r--r-- | isisd/isis_vty_fabricd.c | 24 |
5 files changed, 55 insertions, 8 deletions
diff --git a/isisd/fabricd.c b/isisd/fabricd.c index 3b6db67c2..537dc9966 100644 --- a/isisd/fabricd.c +++ b/isisd/fabricd.c @@ -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; +} diff --git a/isisd/fabricd.h b/isisd/fabricd.h index 886fd3c62..6b55cce38 100644 --- a/isisd/fabricd.h +++ b/isisd/fabricd.h @@ -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 diff --git a/isisd/isis_lsp.h b/isisd/isis_lsp.h index 7f088987b..e6ea0b4ed 100644 --- a/isisd/isis_lsp.h +++ b/isisd/isis_lsp.h @@ -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); diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c index 4720b044e..0c352422b 100644 --- a/isisd/isis_pdu.c +++ b/isisd/isis_pdu.c @@ -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) diff --git a/isisd/isis_vty_fabricd.c b/isisd/isis_vty_fabricd.c index 72ee2ac92..bd4020104 100644 --- a/isisd/isis_vty_fabricd.c +++ b/isisd/isis_vty_fabricd.c @@ -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; |