summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss White <russ@riw.us>2022-05-09 19:35:14 -0400
committerGitHub <noreply@github.com>2022-05-09 19:35:14 -0400
commit2cf70f4ee01bfd7cc49c17b821a7c384e792403e (patch)
treedd4db98799fa0ead422d6db1d8ffd9bc916fa97f
parent286320b09f4f6bcf8d17334c292a4bbdc23a92c8 (diff)
parentf2ca5c5b952e9795c16d3e630cb61696a96d910c (diff)
Merge pull request #11147 from opensourcerouting/feature/gr_n-bit_cli_knob
bgpd: Add CLI knob to enable graceful restart for BGP notifications
-rw-r--r--bgpd/bgp_open.c11
-rw-r--r--bgpd/bgp_vty.c33
-rw-r--r--bgpd/bgpd.h2
-rw-r--r--doc/user/bgp.rst9
4 files changed, 52 insertions, 3 deletions
diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c
index bfa1506afe..fa3fa3fcee 100644
--- a/bgpd/bgp_open.c
+++ b/bgpd/bgp_open.c
@@ -1435,12 +1435,17 @@ static void bgp_peer_send_gr_capability(struct stream *s, struct peer *peer,
restart_time = peer->bgp->restart_time;
if (peer->bgp->t_startup) {
SET_FLAG(restart_time, GRACEFUL_RESTART_R_BIT);
- SET_FLAG(restart_time, GRACEFUL_RESTART_N_BIT);
SET_FLAG(peer->cap, PEER_CAP_GRACEFUL_RESTART_R_BIT_ADV);
- SET_FLAG(peer->cap, PEER_CAP_GRACEFUL_RESTART_N_BIT_ADV);
+ if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
+ zlog_debug("[BGP_GR] Sending R-Bit for peer: %s",
+ peer->host);
+ }
+ if (CHECK_FLAG(peer->bgp->flags, BGP_FLAG_GRACEFUL_NOTIFICATION)) {
+ SET_FLAG(restart_time, GRACEFUL_RESTART_N_BIT);
+ SET_FLAG(peer->cap, PEER_CAP_GRACEFUL_RESTART_N_BIT_ADV);
if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
- zlog_debug("[BGP_GR] Sending R-Bit/N-Bit for peer: %s",
+ zlog_debug("[BGP_GR] Sending N-Bit for peer: %s",
peer->host);
}
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index 65a053990e..192af2216a 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -123,6 +123,10 @@ FRR_CFG_DEFAULT_BOOL(BGP_SUPPRESS_DUPLICATES,
{ .val_bool = false, .match_version = "< 7.6", },
{ .val_bool = true },
);
+FRR_CFG_DEFAULT_BOOL(BGP_GRACEFUL_NOTIFICATION,
+ { .val_bool = false, .match_version = "< 8.3", },
+ { .val_bool = true },
+);
DEFINE_HOOK(bgp_inst_config_write,
(struct bgp *bgp, struct vty *vty),
@@ -569,6 +573,8 @@ int bgp_get_vty(struct bgp **bgp, as_t *as, const char *name,
SET_FLAG((*bgp)->flags, BGP_FLAG_EBGP_REQUIRES_POLICY);
if (DFLT_BGP_SUPPRESS_DUPLICATES)
SET_FLAG((*bgp)->flags, BGP_FLAG_SUPPRESS_DUPLICATES);
+ if (DFLT_BGP_GRACEFUL_NOTIFICATION)
+ SET_FLAG((*bgp)->flags, BGP_FLAG_GRACEFUL_NOTIFICATION);
ret = BGP_SUCCESS;
}
@@ -2868,6 +2874,24 @@ DEFUN (no_bgp_graceful_restart_preserve_fw,
return CMD_SUCCESS;
}
+DEFPY (bgp_graceful_restart_notification,
+ bgp_graceful_restart_notification_cmd,
+ "[no$no] bgp graceful-restart notification",
+ NO_STR
+ BGP_STR
+ "Graceful restart capability parameters\n"
+ "Indicate Graceful Restart support for BGP NOTIFICATION messages\n")
+{
+ VTY_DECLVAR_CONTEXT(bgp, bgp);
+
+ if (no)
+ UNSET_FLAG(bgp->flags, BGP_FLAG_GRACEFUL_NOTIFICATION);
+ else
+ SET_FLAG(bgp->flags, BGP_FLAG_GRACEFUL_NOTIFICATION);
+
+ return CMD_SUCCESS;
+}
+
DEFUN (bgp_graceful_restart_disable,
bgp_graceful_restart_disable_cmd,
"bgp graceful-restart-disable",
@@ -17275,6 +17299,14 @@ int bgp_config_write(struct vty *vty)
vty_out(vty, " bgp graceful-restart restart-time %u\n",
bgp->restart_time);
+ if (!!CHECK_FLAG(bgp->flags, BGP_FLAG_GRACEFUL_NOTIFICATION) !=
+ SAVE_BGP_GRACEFUL_NOTIFICATION)
+ vty_out(vty, " %sbgp graceful-restart notification\n",
+ CHECK_FLAG(bgp->flags,
+ BGP_FLAG_GRACEFUL_NOTIFICATION)
+ ? ""
+ : "no ");
+
if (bgp->select_defer_time != BGP_DEFAULT_SELECT_DEFERRAL_TIME)
vty_out(vty,
" bgp graceful-restart select-defer-time %u\n",
@@ -17907,6 +17939,7 @@ void bgp_vty_init(void)
&no_bgp_graceful_restart_select_defer_time_cmd);
install_element(BGP_NODE, &bgp_graceful_restart_preserve_fw_cmd);
install_element(BGP_NODE, &no_bgp_graceful_restart_preserve_fw_cmd);
+ install_element(BGP_NODE, &bgp_graceful_restart_notification_cmd);
install_element(BGP_NODE, &bgp_graceful_restart_disable_eor_cmd);
install_element(BGP_NODE, &no_bgp_graceful_restart_disable_eor_cmd);
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index 79ed787bfc..a0de2dab69 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -488,6 +488,8 @@ struct bgp {
#define BGP_FLAG_SUPPRESS_FIB_PENDING (1 << 26)
#define BGP_FLAG_SUPPRESS_DUPLICATES (1 << 27)
#define BGP_FLAG_PEERTYPE_MULTIPATH_RELAX (1 << 29)
+/* Indicate Graceful Restart support for BGP NOTIFICATION messages */
+#define BGP_FLAG_GRACEFUL_NOTIFICATION (1 << 30)
/* BGP default address-families.
* New peers inherit enabled afi/safis from bgp instance.
diff --git a/doc/user/bgp.rst b/doc/user/bgp.rst
index 6f99b41140..68d6d8714b 100644
--- a/doc/user/bgp.rst
+++ b/doc/user/bgp.rst
@@ -947,6 +947,15 @@ However, it MUST defer route selection for an address family until it either.
expires. The stale path timer is started when the router receives a Route-Refresh
BoRR message.
+.. clicmd:: bgp graceful-restart notification
+
+ Indicate Graceful Restart support for BGP NOTIFICATION messages.
+
+ After changing this parameter, you have to reset the peers in order to advertise
+ N-bit in Graceful Restart capability.
+
+ Enabled by default.
+
.. _bgp-per-peer-graceful-restart:
BGP Per Peer Graceful Restart