summaryrefslogtreecommitdiff
path: root/ospf6d/ospf6_spf.c
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2021-10-27 16:45:05 +0200
committerPhilippe Guibert <philippe.guibert@6wind.com>2021-11-03 11:48:55 +0100
commitf13d33ccd076e7e6c81dcf95ee032e63e29434c3 (patch)
treea5b275b588daf69dfccafa712ec5517c3bb6802b /ospf6d/ospf6_spf.c
parent0051effcb151b803b4a8caa5d2f958485574dd24 (diff)
ospf6d: avoid writing dumb ospf6 info at startup
in show: 'show ipv6 ospf6' handler command, the reason of SPF executation is looked up and displayed. At startup, SPF has been started, but shows no specific reason. Instead of dumping non initialised string context, reset the string context. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'ospf6d/ospf6_spf.c')
-rw-r--r--ospf6d/ospf6_spf.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c
index a9bd7febcf..f9c47cbce5 100644
--- a/ospf6d/ospf6_spf.c
+++ b/ospf6d/ospf6_spf.c
@@ -461,6 +461,10 @@ void ospf6_spf_reason_string(uint32_t reason, char *buf, int size)
if (!buf)
return;
+ if (!reason) {
+ buf[0] = '\0';
+ return;
+ }
for (bit = 0; bit < array_size(ospf6_spf_reason_str); bit++) {
if ((reason & (1 << bit)) && (len < size)) {
len += snprintf((buf + len), (size - len), "%s%s",