From eb7e14011fa19f4ecc18b0108c556cc1d82ee381 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 17 Mar 2023 10:37:40 -0400 Subject: [PATCH] ospfd: Fix ospf_ti_lfa drop of an entire table The new_rtrs variable was just generated and then dropped. Let's fix that entirely Signed-off-by: Donald Sharp --- ospfd/ospf_spf.c | 3 ++- ospfd/ospf_ti_lfa.c | 19 +++++++------------ 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/ospfd/ospf_spf.c b/ospfd/ospf_spf.c index 7c1f9f17ac..f731d1cf18 100644 --- a/ospfd/ospf_spf.c +++ b/ospfd/ospf_spf.c @@ -1764,7 +1764,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); } diff --git a/ospfd/ospf_ti_lfa.c b/ospfd/ospf_ti_lfa.c index b14200868e..385428f8e6 100644 --- a/ospfd/ospf_ti_lfa.c +++ b/ospfd/ospf_ti_lfa.c @@ -237,7 +237,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; @@ -300,7 +300,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; @@ -311,7 +310,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); @@ -622,7 +621,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]; @@ -661,15 +660,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 */ @@ -734,11 +731,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; @@ -757,8 +752,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; -- 2.39.5