]> git.puffer.fish Git - matthieu/frr.git/commitdiff
isisd: fix processing of the attached bit
authorIgor Ryzhov <iryzhov@nfware.com>
Mon, 12 Jul 2021 20:56:04 +0000 (23:56 +0300)
committermergify-bot <noreply@mergify.io>
Fri, 23 Jul 2021 09:16:59 +0000 (09:16 +0000)
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 <iryzhov@nfware.com>
(cherry picked from commit a4777e465ab5515bf36ad5f3dc4c413adf9d15b6)

isisd/isis_lsp.c
isisd/isis_lsp.h
isisd/isis_spf.c
isisd/isisd.c
isisd/isisd.h

index 87a6061d4e234f804180ef2a8ebc19402d8521b1..c0b74a9044f4a91d1faf311f11cc3e0cbdefadbf 100644 (file)
@@ -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];
index f3d9f61bcfa4955a3b26ef216d350241e57764da..cac5f0d73388564d1fffe33a3242929f735dd057 100644 (file)
@@ -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,
index 3e8ec8817e7e873dd6dd3d472959ab4ab7914c5c..45e89897ffa43a1d47e5dcd808816a8be3f1f0d1 100644 (file)
@@ -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",
index 7e78e0ce69daa5b5eddc89ccc560ea8c3225a5f8..1537fcb8ac08ab0b96be5a3dfdfac6d342ef9a3c 100644 (file)
@@ -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;
index b2c9af55b78faf157074d71b5f2cf6edf38531c4..f815969b92936ca3c97181e50f08ffa7760ff785 100644 (file)
@@ -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);