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.cour...@6wind.com>
---
 bgpd/bgp_vty.c | 37 +++++++++++++++++++++++++++++++++++++
 bgpd/bgpd.c    |  4 ++++
 2 files changed, 41 insertions(+)

diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index d593a02..701b214 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -1116,6 +1116,41 @@ ALIAS (no_bgp_graceful_restart_restart_time,
        "Set the time to wait to delete stale routes before a BGP open message 
is received\n"
        "Delay value (seconds)\n")
 
+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")
+{
+  struct bgp *bgp;
+
+  bgp = vty->index;
+  if (! bgp)
+    return CMD_WARNING;
+
+  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")
+{
+  struct bgp *bgp;
+
+  bgp = vty->index;
+  if (! bgp)
+    return CMD_WARNING;
+
+  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,
@@ -10363,6 +10398,8 @@ 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, &no_bgp_graceful_restart_restart_time_val_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);
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index c2bd6e3..5696c98 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -5875,6 +5875,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.1.4


_______________________________________________
Quagga-dev mailing list
Quagga-dev@lists.quagga.net
https://lists.quagga.net/mailman/listinfo/quagga-dev

Reply via email to