summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2020-12-08 11:54:32 -0300
committerRenato Westphal <renato@opensourcerouting.org>2021-01-08 22:22:11 -0300
commit816c583f27a9315d523e88184bb686ed14cb93ed (patch)
tree89e0654965b2492539deb13ab8264c25b363eae0
parent6c87fb38f3b4c0ab62f1c0b57f82f0014b098aa1 (diff)
isisd: fix logging of uninitialized data in the TI-LFA code
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>
-rw-r--r--isisd/isis_lfa.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/isisd/isis_lfa.c b/isisd/isis_lfa.c
index 2da4600a21..7137c71a37 100644
--- a/isisd/isis_lfa.c
+++ b/isisd/isis_lfa.c
@@ -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));