]> git.puffer.fish Git - mirror/frr.git/commitdiff
ospf6d: avoid writing dumb ospf6 info at startup 9909/head
authorPhilippe Guibert <philippe.guibert@6wind.com>
Wed, 27 Oct 2021 14:45:05 +0000 (16:45 +0200)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Wed, 3 Nov 2021 10:48:55 +0000 (11:48 +0100)
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>
ospf6d/ospf6_spf.c

index a9bd7febcf23245ebe3faa533bf859bd7782f773..f9c47cbce58c74e104124ac71e8f51c0ffadd9a6 100644 (file)
@@ -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",