]> git.puffer.fish Git - mirror/frr.git/commitdiff
bfdd: fix echo configuration in profile 8191/head
authorIgor Ryzhov <iryzhov@nfware.com>
Thu, 4 Mar 2021 18:17:20 +0000 (21:17 +0300)
committerIgor Ryzhov <iryzhov@nfware.com>
Thu, 4 Mar 2021 18:17:20 +0000 (21:17 +0300)
It's not currently possible to configure echo mode in profile node:
```
(config)# bfd
(config-bfd)# profile test
(config-bfd-profile)# echo-mode
% Echo mode is only available for single hop sessions.
(config-bfd-profile)# echo-interval 20
% Echo mode is only available for single hop sessions.
```

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

index 84354e243db479e55f347c77cd3a2b437c714d4b..5072c76aac1919c234dbd84b0c6cc6edf1217b30 100644 (file)
@@ -57,6 +57,12 @@ bfd_cli_is_single_hop(struct vty *vty)
        return strstr(VTY_CURR_XPATH, "/single-hop") != NULL;
 }
 
+static bool
+bfd_cli_is_profile(struct vty *vty)
+{
+       return strstr(VTY_CURR_XPATH, "/bfd/profile") != NULL;
+}
+
 /*
  * Functions.
  */
@@ -422,7 +428,7 @@ DEFPY_YANG(
        NO_STR
        "Configure echo mode\n")
 {
-       if (!bfd_cli_is_single_hop(vty)) {
+       if (!bfd_cli_is_profile(vty) && !bfd_cli_is_single_hop(vty)) {
                vty_out(vty, "%% Echo mode is only available for single hop sessions.\n");
                return CMD_WARNING_CONFIG_FAILED;
        }
@@ -450,7 +456,7 @@ DEFPY_YANG(
 {
        char value[32];
 
-       if (!bfd_cli_is_single_hop(vty)) {
+       if (!bfd_cli_is_profile(vty) && !bfd_cli_is_single_hop(vty)) {
                vty_out(vty, "%% Echo mode is only available for single hop sessions.\n");
                return CMD_WARNING_CONFIG_FAILED;
        }