From 43fc21b363e2657c444fe85bef1f72cf00fb0d4a Mon Sep 17 00:00:00 2001 From: Julien Courtat Date: Tue, 17 May 2016 16:26:22 +0200 Subject: [PATCH] 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 --- bgpd/bgp_vty.c | 28 ++++++++++++++++++++++++++++ bgpd/bgpd.c | 4 ++++ 2 files changed, 32 insertions(+) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 1c2cc037f9..683c09bf61 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -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); diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 68ad6bbe11..f9c3f9af4b 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -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); -- 2.39.5