]> git.puffer.fish Git - mirror/frr.git/commitdiff
bfdd: require local-address when using multihop
authorIgor Ryzhov <iryzhov@nfware.com>
Wed, 3 Mar 2021 16:38:38 +0000 (19:38 +0300)
committerIgor Ryzhov <iryzhov@nfware.com>
Wed, 24 Mar 2021 12:13:45 +0000 (15:13 +0300)
If local-address is not supplied, then an incorrect xpath is generated
which is not expected by NB CLI.

Fixes #7465.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
bfdd/bfdd_cli.c

index d115684b1cf4f4c6961424627651f0715049f389..f6ba8fce94ad510697361d8891e7c77c5a9295a6 100644 (file)
@@ -112,10 +112,14 @@ DEFPY_YANG_NOSH(
        char source_str[INET6_ADDRSTRLEN + 32];
        char xpath[XPATH_MAXLEN], xpath_srcaddr[XPATH_MAXLEN + 32];
 
-       if (multihop)
+       if (multihop) {
+               if (!local_address_str) {
+                       vty_out(vty, "%% local-address is required when using multihop\n");
+                       return CMD_WARNING_CONFIG_FAILED;
+               }
                snprintf(source_str, sizeof(source_str), "[source-addr='%s']",
                         local_address_str);
-       else
+       else
                source_str[0] = 0;
 
        slen = snprintf(xpath, sizeof(xpath),