From: Igor Ryzhov Date: Mon, 12 Jul 2021 20:56:04 +0000 (+0300) Subject: isisd: fix processing of the attached bit X-Git-Tag: frr-8.0.1~80^2~1 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=180c0d0e64c16c3b5c2a31755538b544ac3dddb9;p=matthieu%2Ffrr.git isisd: fix processing of the attached bit There are two problems with the current code for processing the attached bit: - we should process it when acting both a level-1-only and level-1-2 - we should add the default route when we don't have L2 adjacensies, not when we don't have other routers configured on the device Signed-off-by: Igor Ryzhov (cherry picked from commit a4777e465ab5515bf36ad5f3dc4c413adf9d15b6) --- diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c index 87a6061d4e..c0b74a9044 100644 --- a/isisd/isis_lsp.c +++ b/isisd/isis_lsp.c @@ -401,13 +401,16 @@ static void lsp_seqno_update(struct isis_lsp *lsp0) return; } -static bool isis_level2_adj_up(struct isis_area *area) +bool isis_level2_adj_up(struct isis_area *area) { struct listnode *node, *cnode; struct isis_circuit *circuit; struct list *adjdb; struct isis_adjacency *adj; + if (area->is_type == IS_LEVEL_1) + return false; + for (ALL_LIST_ELEMENTS_RO(area->circuit_list, cnode, circuit)) { if (circuit->circ_type == CIRCUIT_T_BROADCAST) { adjdb = circuit->u.bc.adjdb[1]; diff --git a/isisd/isis_lsp.h b/isisd/isis_lsp.h index f3d9f61bcf..cac5f0d733 100644 --- a/isisd/isis_lsp.h +++ b/isisd/isis_lsp.h @@ -77,6 +77,8 @@ int _lsp_regenerate_schedule(struct isis_area *area, int level, int lsp_generate_pseudo(struct isis_circuit *circuit, int level); int lsp_regenerate_schedule_pseudo(struct isis_circuit *circuit, int level); +bool isis_level2_adj_up(struct isis_area *area); + struct isis_lsp *lsp_new(struct isis_area *area, uint8_t *lsp_id, uint16_t rem_lifetime, uint32_t seq_num, uint8_t lsp_bits, uint16_t checksum, diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c index 3e8ec8817e..45e89897ff 100644 --- a/isisd/isis_spf.c +++ b/isisd/isis_spf.c @@ -1070,8 +1070,8 @@ end: */ if ((lsp->hdr.lsp_bits & LSPBIT_ATT) == LSPBIT_ATT && !spftree->area->attached_bit_rcv_ignore - && spftree->area->is_type == IS_LEVEL_1 - && !isis_area_count(spftree->area->isis, IS_LEVEL_2)) { + && (spftree->area->is_type & IS_LEVEL_1) + && !isis_level2_adj_up(spftree->area)) { struct prefix_pair ip_info = { {0} }; if (IS_DEBUG_RTE_EVENTS) zlog_debug("ISIS-Spf (%s): add default %s route", diff --git a/isisd/isisd.c b/isisd/isisd.c index 7e78e0ce69..1537fcb8ac 100644 --- a/isisd/isisd.c +++ b/isisd/isisd.c @@ -469,22 +469,6 @@ int isis_area_get(struct vty *vty, const char *area_tag) return CMD_SUCCESS; } -/* return the number of Level1 and level-1-2 routers or - * the number of Level2 and level-1-2 routers configured - */ -int isis_area_count(const struct isis *isis, int levels) -{ - struct isis_area *area; - struct listnode *node; - int count = 0; - - for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) - if (area->is_type & levels) - count++; - - return count; -} - void isis_area_destroy(struct isis_area *area) { struct listnode *node, *nnode; diff --git a/isisd/isisd.h b/isisd/isisd.h index b2c9af55b7..f815969b92 100644 --- a/isisd/isisd.h +++ b/isisd/isisd.h @@ -269,7 +269,6 @@ struct isis_area *isis_area_lookup(const char *, vrf_id_t vrf_id); struct isis_area *isis_area_lookup_by_vrf(const char *area_tag, const char *vrf_name); int isis_area_get(struct vty *vty, const char *area_tag); -int isis_area_count(const struct isis *isis, int levels); void isis_area_destroy(struct isis_area *area); void isis_filter_update(struct access_list *access); void isis_prefix_list_update(struct prefix_list *plist);