]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ospfd: Fix ospf_ti_lfa drop of an entire table
authorDonald Sharp <sharpd@nvidia.com>
Fri, 17 Mar 2023 14:37:40 +0000 (10:37 -0400)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Sun, 19 Mar 2023 04:45:21 +0000 (04:45 +0000)
The new_rtrs variable was just generated and then dropped.  Let's
fix that entirely

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit eb7e14011fa19f4ecc18b0108c556cc1d82ee381)

ospfd/ospf_spf.c
ospfd/ospf_ti_lfa.c

index 4edc1de8119e719ee6b74ff1d18333a05ef716ae..8c0037d0b107228e0ddc6f3ba434631464f7e36c 100644 (file)
@@ -1748,7 +1748,8 @@ void ospf_spf_calculate(struct ospf_area *area, struct ospf_lsa *root_lsa,
                if (v->type != OSPF_VERTEX_ROUTER)
                        ospf_intra_add_transit(new_table, v, area);
                else {
-                       ospf_intra_add_router(new_rtrs, v, area, false);
+                       if (new_rtrs)
+                               ospf_intra_add_router(new_rtrs, v, area, false);
                        if (all_rtrs)
                                ospf_intra_add_router(all_rtrs, v, area, true);
                }
index 28d24bcbe6b4b0af76dcc57d9f53af22205f57cf..b6a833684d26cbc5618b18d7e73021e3c2c73011 100644 (file)
@@ -252,7 +252,7 @@ static void ospf_ti_lfa_generate_inner_label_stack(
        struct q_space *q_space,
        struct ospf_ti_lfa_inner_backup_path_info *inner_backup_path_info)
 {
-       struct route_table *new_table, *new_rtrs;
+       struct route_table *new_table;
        struct vertex *q_node;
        struct vertex *start_vertex, *end_vertex;
        struct vertex_parent *vertex_parent;
@@ -315,7 +315,6 @@ static void ospf_ti_lfa_generate_inner_label_stack(
                                                    start_vertex, end_vertex);
 
        new_table = route_table_init();
-       new_rtrs = route_table_init();
 
        /* Copy the current state ... */
        spf_orig = area->spf;
@@ -326,7 +325,7 @@ static void ospf_ti_lfa_generate_inner_label_stack(
                XCALLOC(MTYPE_OSPF_P_SPACE, sizeof(struct p_spaces_head));
 
        /* dry run true, root node false */
-       ospf_spf_calculate(area, start_vertex->lsa_p, new_table, NULL, new_rtrs,
+       ospf_spf_calculate(area, start_vertex->lsa_p, new_table, NULL, NULL,
                           true, false);
 
        q_node = ospf_spf_vertex_find(end_vertex->id, area->spf_vertex_list);
@@ -637,7 +636,7 @@ static void ospf_ti_lfa_generate_q_spaces(struct ospf_area *area,
 {
        struct listnode *node;
        struct vertex *child;
-       struct route_table *new_table, *new_rtrs;
+       struct route_table *new_table;
        struct q_space *q_space, q_space_search;
        char label_buf[MPLS_LABEL_STRLEN];
        char res_buf[PROTECTED_RESOURCE_STRLEN];
@@ -676,15 +675,13 @@ static void ospf_ti_lfa_generate_q_spaces(struct ospf_area *area,
                                       sizeof(struct ospf_ti_lfa_node_info));
 
        new_table = route_table_init();
-       /* XXX do these get  freed?? */
-       new_rtrs = route_table_init();
 
        /*
         * Generate a new (reversed!) SPF tree for this vertex,
         * dry run true, root node false
         */
        area->spf_reversed = true;
-       ospf_spf_calculate(area, dest->lsa_p, new_table, NULL, new_rtrs, true,
+       ospf_spf_calculate(area, dest->lsa_p, new_table, NULL, NULL, true,
                           false);
 
        /* Reset the flag for reverse SPF */
@@ -749,11 +746,9 @@ static void ospf_ti_lfa_generate_q_spaces(struct ospf_area *area,
 static void ospf_ti_lfa_generate_post_convergence_spf(struct ospf_area *area,
                                                      struct p_space *p_space)
 {
-       struct route_table *new_table, *new_rtrs;
+       struct route_table *new_table;
 
        new_table = route_table_init();
-       /* XXX do these get  freed?? */
-       new_rtrs = route_table_init();
 
        area->spf_protected_resource = p_space->protected_resource;
 
@@ -772,8 +767,8 @@ static void ospf_ti_lfa_generate_post_convergence_spf(struct ospf_area *area,
         * endeavour (because LSAs are stored as a 'raw' stream), so we go with
         * this rather hacky way for now.
         */
-       ospf_spf_calculate(area, area->router_lsa_self, new_table, NULL,
-                          new_rtrs, true, false);
+       ospf_spf_calculate(area, area->router_lsa_self, new_table, NULL, NULL,
+                          true, false);
 
        p_space->pc_spf = area->spf;
        p_space->pc_vertex_list = area->spf_vertex_list;