]> git.puffer.fish Git - matthieu/frr.git/commitdiff
isisd: fix memory leak for non-freed spftrees
authorFredi Raspall <fredi@voltanet.io>
Fri, 23 Apr 2021 22:01:41 +0000 (00:01 +0200)
committerFredi Raspall <fredi@voltanet.io>
Sat, 1 May 2021 13:52:10 +0000 (15:52 +0200)
When enabling TI-LFA the forward SPF for neighbors adjacent to the
PLR is computed. Later, when computing the PQ spaces, the reverse
SPF trees for those adjacent neighbors affected by the protected
interface are computed.

When node protection is enabled, TI-LFA link protection is run
immediately afterwards to compute repairs in case no
node-protecting backup path exists. In this second run, the
existing code tries to compute the reverse SPF tree for the same
node, without freeing the SPF tree of the prior run.

This patch fixes this by not computing the reverse SPF again, thus
avoiding a memory leak and an unnecessary SPF run.

Signed-off-by: Fredi Raspall <fredi@voltanet.io>
isisd/isis_lfa.c

index 085177b94352ca1bfaaab884f7a1c28665360343..b535924e9364c1a4cf27c9d8dd5b34d015582a99 100644 (file)
@@ -1148,10 +1148,13 @@ static void lfa_calc_pq_spaces(struct isis_spftree *spftree_pc,
 
                        /*
                         * Compute the reverse SPF in the behalf of the node
-                        * adjacent to the failure.
+                        * adjacent to the failure, if we haven't done that
+                        * before
                         */
-                       adj_node->lfa.spftree_reverse =
-                               isis_spf_reverse_run(adj_node->lfa.spftree);
+                       if (!adj_node->lfa.spftree_reverse)
+                               adj_node->lfa.spftree_reverse =
+                                       isis_spf_reverse_run(
+                                               adj_node->lfa.spftree);
 
                        lfa_calc_reach_nodes(adj_node->lfa.spftree_reverse,
                                             spftree_reverse, adj_nodes, false,