mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-02 23:38:55 +00:00
ospf6d: add support for BFD profiles
Allow user to pre configure BFD sessions using profiles. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
This commit is contained in:
parent
4a9e802c3c
commit
1f7be0d242
@ -164,18 +164,22 @@ void ospf6_bfd_write_config(struct vty *vty, struct ospf6_interface *oi)
|
||||
else
|
||||
#endif /* ! HAVE_BFDD */
|
||||
vty_out(vty, " ipv6 ospf6 bfd\n");
|
||||
|
||||
if (oi->bfd_config.profile)
|
||||
vty_out(vty, " ipv6 ospf6 bfd profile %s\n",
|
||||
oi->bfd_config.profile);
|
||||
}
|
||||
|
||||
DEFUN (ipv6_ospf6_bfd,
|
||||
ipv6_ospf6_bfd_cmd,
|
||||
"ipv6 ospf6 bfd",
|
||||
IP6_STR
|
||||
OSPF6_STR
|
||||
"Enables BFD support\n"
|
||||
)
|
||||
DEFUN(ipv6_ospf6_bfd, ipv6_ospf6_bfd_cmd,
|
||||
"ipv6 ospf6 bfd [profile BFDPROF]",
|
||||
IP6_STR OSPF6_STR
|
||||
"Enables BFD support\n"
|
||||
"BFD Profile selection\n"
|
||||
"BFD Profile name\n")
|
||||
{
|
||||
VTY_DECLVAR_CONTEXT(interface, ifp);
|
||||
struct ospf6_interface *oi;
|
||||
int prof_idx = 4;
|
||||
assert(ifp);
|
||||
|
||||
oi = (struct ospf6_interface *)ifp->info;
|
||||
@ -187,12 +191,44 @@ DEFUN (ipv6_ospf6_bfd,
|
||||
oi->bfd_config.min_rx = BFD_DEF_MIN_RX;
|
||||
oi->bfd_config.min_tx = BFD_DEF_MIN_TX;
|
||||
oi->bfd_config.enabled = true;
|
||||
if (argc > prof_idx) {
|
||||
XFREE(MTYPE_TMP, oi->bfd_config.profile);
|
||||
oi->bfd_config.profile =
|
||||
XSTRDUP(MTYPE_TMP, argv[prof_idx]->arg);
|
||||
}
|
||||
|
||||
ospf6_bfd_reg_dereg_all_nbr(oi, true);
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN(no_ipv6_ospf6_bfd_profile, no_ipv6_ospf6_bfd_profile_cmd,
|
||||
"no ipv6 ospf6 bfd profile [BFDPROF]",
|
||||
NO_STR IP6_STR OSPF6_STR
|
||||
"BFD support\n"
|
||||
"BFD Profile selection\n"
|
||||
"BFD Profile name\n")
|
||||
{
|
||||
VTY_DECLVAR_CONTEXT(interface, ifp);
|
||||
struct ospf6_interface *oi;
|
||||
assert(ifp);
|
||||
|
||||
oi = (struct ospf6_interface *)ifp->info;
|
||||
if (oi == NULL)
|
||||
oi = ospf6_interface_create(ifp);
|
||||
assert(oi);
|
||||
|
||||
/* BFD not enabled, nothing to do. */
|
||||
if (!oi->bfd_config.enabled)
|
||||
return CMD_SUCCESS;
|
||||
|
||||
/* Remove profile and apply new configuration. */
|
||||
XFREE(MTYPE_TMP, oi->bfd_config.profile);
|
||||
ospf6_bfd_reg_dereg_all_nbr(oi, true);
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
#if HAVE_BFDD > 0
|
||||
DEFUN_HIDDEN(
|
||||
#else
|
||||
@ -263,5 +299,6 @@ void ospf6_bfd_init(void)
|
||||
/* Install BFD command */
|
||||
install_element(INTERFACE_NODE, &ipv6_ospf6_bfd_cmd);
|
||||
install_element(INTERFACE_NODE, &ipv6_ospf6_bfd_param_cmd);
|
||||
install_element(INTERFACE_NODE, &no_ipv6_ospf6_bfd_profile_cmd);
|
||||
install_element(INTERFACE_NODE, &no_ipv6_ospf6_bfd_cmd);
|
||||
}
|
||||
|
@ -275,6 +275,9 @@ void ospf6_interface_delete(struct ospf6_interface *oi)
|
||||
/* disable from area list if possible */
|
||||
ospf6_area_interface_delete(oi);
|
||||
|
||||
/* Free BFD allocated data. */
|
||||
XFREE(MTYPE_TMP, oi->bfd_config.profile);
|
||||
|
||||
XFREE(MTYPE_OSPF6_IF, oi);
|
||||
}
|
||||
|
||||
|
@ -124,6 +124,7 @@ struct ospf6_interface {
|
||||
uint8_t detection_multiplier;
|
||||
uint32_t min_rx;
|
||||
uint32_t min_tx;
|
||||
char *profile;
|
||||
} bfd_config;
|
||||
|
||||
/* Statistics Fields */
|
||||
|
Loading…
Reference in New Issue
Block a user