]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ospfd: support BFD profiles
authorRafael Zalamena <rzalamena@opensourcerouting.org>
Thu, 4 Mar 2021 14:10:20 +0000 (11:10 -0300)
committerRafael Zalamena <rzalamena@opensourcerouting.org>
Tue, 23 Mar 2021 13:18:42 +0000 (10:18 -0300)
Add new command to configure BFD peers to use a specific profile.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
ospfd/ospf_bfd.c

index 1f864224835d6a803a7a46ddda51ad5ca4765f8b..f4470ad833b19f816ee98a05e017ed17d3a9bbda 100644 (file)
@@ -175,6 +175,10 @@ void ospf_bfd_write_config(struct vty *vty, const struct ospf_if_params *params
        else
 #endif /* ! HAVE_BFDD */
                vty_out(vty, " ip ospf bfd\n");
+
+       if (params->bfd_config->profile[0])
+               vty_out(vty, " ip ospf bfd profile %s\n",
+                       params->bfd_config->profile);
 }
 
 void ospf_interface_bfd_show(struct vty *vty, const struct interface *ifp,
@@ -250,6 +254,49 @@ DEFUN(
        return CMD_SUCCESS;
 }
 
+DEFUN (ip_ospf_bfd_prof,
+       ip_ospf_bfd_prof_cmd,
+       "ip ospf bfd profile BFDPROF",
+       "IP Information\n"
+       "OSPF interface commands\n"
+       "Enables BFD support\n"
+       BFD_PROFILE_STR
+       BFD_PROFILE_NAME_STR)
+{
+       VTY_DECLVAR_CONTEXT(interface, ifp);
+       struct ospf_if_params *params;
+       int idx_prof = 4;
+
+       ospf_interface_enable_bfd(ifp);
+       params = IF_DEF_PARAMS(ifp);
+       strlcpy(params->bfd_config->profile, argv[idx_prof]->arg,
+               sizeof(params->bfd_config->profile));
+       ospf_interface_bfd_apply(ifp);
+
+       return CMD_SUCCESS;
+}
+
+DEFUN (no_ip_ospf_bfd_prof,
+       no_ip_ospf_bfd_prof_cmd,
+       "no ip ospf bfd profile [BFDPROF]",
+       NO_STR
+       "IP Information\n"
+       "OSPF interface commands\n"
+       "Enables BFD support\n"
+       BFD_PROFILE_STR
+       BFD_PROFILE_NAME_STR)
+{
+       VTY_DECLVAR_CONTEXT(interface, ifp);
+       struct ospf_if_params *params;
+
+       ospf_interface_enable_bfd(ifp);
+       params = IF_DEF_PARAMS(ifp);
+       params->bfd_config->profile[0] = 0;
+       ospf_interface_bfd_apply(ifp);
+
+       return CMD_SUCCESS;
+}
+
 DEFUN (no_ip_ospf_bfd,
        no_ip_ospf_bfd_cmd,
 #if HAVE_BFDD > 0
@@ -280,5 +327,7 @@ void ospf_bfd_init(struct thread_master *tm)
        /* Install BFD command */
        install_element(INTERFACE_NODE, &ip_ospf_bfd_cmd);
        install_element(INTERFACE_NODE, &ip_ospf_bfd_param_cmd);
+       install_element(INTERFACE_NODE, &ip_ospf_bfd_prof_cmd);
+       install_element(INTERFACE_NODE, &no_ip_ospf_bfd_prof_cmd);
        install_element(INTERFACE_NODE, &no_ip_ospf_bfd_cmd);
 }