bgpd: configure preserve forwarding state from vty

Preserve forwarding state bit can be set in OPEN message with the use of
new vty commands
bgp graceful-restart preserve-fw-state
no bgp graceful-restart preserve-fw-state

This must be set before activating the connection to a peer, since it is
for forging graceful restart capability of OPEN messages.

Signed-off-by: Julien Courtat <julien.courtat@6wind.com>
This commit is contained in:
Julien Courtat 2016-05-17 16:26:22 +02:00 committed by Philippe Guibert
parent 6a9a3cde58
commit 43fc21b363
2 changed files with 32 additions and 0 deletions

View File

@ -1673,6 +1673,31 @@ DEFUN (no_bgp_graceful_restart_restart_time,
return CMD_SUCCESS;
}
DEFUN (bgp_graceful_restart_preserve_fw,
bgp_graceful_restart_preserve_fw_cmd,
"bgp graceful-restart preserve-fw-state",
"BGP specific commands\n"
"Graceful restart capability parameters\n"
"Sets F-bit indication that fib is preserved while doing Graceful Restart\n")
{
VTY_DECLVAR_CONTEXT(bgp, bgp);
bgp_flag_set(bgp, BGP_FLAG_GR_PRESERVE_FWD);
return CMD_SUCCESS;
}
DEFUN (no_bgp_graceful_restart_preserve_fw,
no_bgp_graceful_restart_preserve_fw_cmd,
"no bgp graceful-restart preserve-fw-state",
NO_STR
"BGP specific commands\n"
"Graceful restart capability parameters\n"
"Unsets F-bit indication that fib is preserved while doing Graceful Restart\n")
{
VTY_DECLVAR_CONTEXT(bgp, bgp);
bgp_flag_unset(bgp, BGP_FLAG_GR_PRESERVE_FWD);
return CMD_SUCCESS;
}
/* "bgp fast-external-failover" configuration. */
DEFUN (bgp_fast_external_failover,
bgp_fast_external_failover_cmd,
@ -9852,6 +9877,9 @@ bgp_vty_init (void)
install_element (BGP_NODE, &bgp_graceful_restart_restart_time_cmd);
install_element (BGP_NODE, &no_bgp_graceful_restart_restart_time_cmd);
install_element (BGP_NODE, &bgp_graceful_restart_preserve_fw_cmd);
install_element (BGP_NODE, &no_bgp_graceful_restart_preserve_fw_cmd);
/* "bgp fast-external-failover" commands */
install_element (BGP_NODE, &bgp_fast_external_failover_cmd);
install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd);

View File

@ -7371,6 +7371,10 @@ bgp_config_write (struct vty *vty)
if (bgp_flag_check (bgp, BGP_FLAG_GRACEFUL_RESTART))
vty_out (vty, " bgp graceful-restart%s", VTY_NEWLINE);
/* BGP graceful-restart Preserve State F bit. */
if (bgp_flag_check (bgp, BGP_FLAG_GR_PRESERVE_FWD))
vty_out (vty, " bgp graceful-restart preserve-fw-state%s", VTY_NEWLINE);
/* BGP bestpath method. */
if (bgp_flag_check (bgp, BGP_FLAG_ASPATH_IGNORE))
vty_out (vty, " bgp bestpath as-path ignore%s", VTY_NEWLINE);