summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2017-01-06 10:22:11 -0500
committerGitHub <noreply@github.com>2017-01-06 10:22:11 -0500
commit2ad8ae5ca6b10e35b7e0fcfe7077e3a00016e041 (patch)
tree23f5f87fa0ee3532ea1a815f07f1d773babd677d
parent3b14d86eed3c042db718c7e006ca5299f473c88e (diff)
parent43fc21b363e2657c444fe85bef1f72cf00fb0d4a (diff)
Merge pull request #49 from pguibert6WIND/frr_6wind_mpbgpgracefulrestart_2
Graceful Restart Route Preservation
-rw-r--r--bgpd/bgp_open.c5
-rw-r--r--bgpd/bgp_vty.c28
-rw-r--r--bgpd/bgpd.c4
-rw-r--r--bgpd/bgpd.h1
4 files changed, 37 insertions, 1 deletions
diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c
index 4c698562be..af3c0486e5 100644
--- a/bgpd/bgp_open.c
+++ b/bgpd/bgp_open.c
@@ -1537,7 +1537,10 @@ bgp_open_capability (struct stream *s, struct peer *peer)
{
stream_putw (s, afi);
stream_putc (s, (safi == SAFI_MPLS_VPN) ? SAFI_MPLS_LABELED_VPN : safi);
- stream_putc (s, 0); //Forwarding is not retained as of now.
+ if (bgp_flag_check(peer->bgp, BGP_FLAG_GR_PRESERVE_FWD))
+ stream_putc (s, RESTART_F_BIT);
+ else
+ stream_putc (s, 0);
}
}
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index c691d20a87..a5fa97021e 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -1677,6 +1677,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,
@@ -9886,6 +9911,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);
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index 86fa207b6b..b82cf9dde9 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -289,6 +289,7 @@ struct bgp
#define BGP_FLAG_MULTIPATH_RELAX_AS_SET (1 << 17)
#define BGP_FLAG_FORCE_STATIC_PROCESS (1 << 18)
#define BGP_FLAG_SHOW_HOSTNAME (1 << 19)
+#define BGP_FLAG_GR_PRESERVE_FWD (1 << 20)
/* BGP Per AF flags */
u_int16_t af_flags[AFI_MAX][SAFI_MAX];