]> git.puffer.fish Git - mirror/frr.git/commitdiff
isisd: fix logging of uninitialized data in the TI-LFA code
authorRenato Westphal <renato@opensourcerouting.org>
Tue, 8 Dec 2020 14:54:32 +0000 (11:54 -0300)
committerRenato Westphal <renato@opensourcerouting.org>
Sat, 9 Jan 2021 01:22:11 +0000 (22:22 -0300)
Always call vid2string() whenever necessary instead of trying to be
too clever and call it only once. The original assumption was that
"buf" only needed to be initialized when LFA debugging was enabled,
but we also need that buffer when logging one error message.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
isisd/isis_lfa.c

index 2da4600a21225601c7c1caacc8185b7c7eae11c2..7137c71a370ada54c512ef7e180ff734d368e7ce 100644 (file)
@@ -882,14 +882,12 @@ int isis_tilfa_check(struct isis_spftree *spftree_pc,
        if (!spftree_pc->area->srdb.enabled)
                return -1;
 
-       if (IS_DEBUG_LFA)
-               vid2string(vertex, buf, sizeof(buf));
-
        if (!lfa_check_needs_protection(spftree_pc, vertex)) {
                if (IS_DEBUG_LFA)
                        zlog_debug(
                                "ISIS-LFA: %s %s unaffected by %s",
-                               vtype2string(vertex->type), buf,
+                               vtype2string(vertex->type),
+                               vid2string(vertex, buf, sizeof(buf)),
                                lfa_protected_resource2str(
                                        &spftree_pc->lfa.protected_resource));
 
@@ -910,7 +908,8 @@ int isis_tilfa_check(struct isis_spftree *spftree_pc,
                        if (IS_DEBUG_LFA)
                                zlog_debug(
                                        "ISIS-LFA: %s %s already covered by node protection",
-                                       vtype2string(vertex->type), buf);
+                                       vtype2string(vertex->type),
+                                       vid2string(vertex, buf, sizeof(buf)));
 
                        return -1;
                }
@@ -923,7 +922,8 @@ int isis_tilfa_check(struct isis_spftree *spftree_pc,
                        if (IS_DEBUG_LFA)
                                zlog_debug(
                                        "ISIS-LFA: %s %s already covered by node protection",
-                                       vtype2string(vertex->type), buf);
+                                       vtype2string(vertex->type),
+                                       vid2string(vertex, buf, sizeof(buf)));
 
                        return -1;
                }
@@ -932,7 +932,8 @@ int isis_tilfa_check(struct isis_spftree *spftree_pc,
        if (IS_DEBUG_LFA)
                zlog_debug(
                        "ISIS-LFA: computing repair path(s) of %s %s w.r.t %s",
-                       vtype2string(vertex->type), buf,
+                       vtype2string(vertex->type),
+                       vid2string(vertex, buf, sizeof(buf)),
                        lfa_protected_resource2str(
                                &spftree_pc->lfa.protected_resource));
 
@@ -947,7 +948,8 @@ int isis_tilfa_check(struct isis_spftree *spftree_pc,
        if (ret != 0)
                zlog_warn(
                        "ISIS-LFA: failed to compute repair path(s) of %s %s w.r.t %s",
-                       vtype2string(vertex->type), buf,
+                       vtype2string(vertex->type),
+                       vid2string(vertex, buf, sizeof(buf)),
                        lfa_protected_resource2str(
                                &spftree_pc->lfa.protected_resource));