mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-03 04:01:59 +00:00
bgpd: Add CLI knob to enable graceful restart for BGP notifications
N-bit flag should be exchanged in BGP OPEN messages, not only when the bgpd is restarted/started. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
This commit is contained in:
parent
50f1f2e724
commit
f2ca5c5b95
@ -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/N-Bit for peer: %s",
|
||||
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 N-Bit for peer: %s",
|
||||
peer->host);
|
||||
}
|
||||
|
||||
|
@ -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",
|
||||
@ -17258,6 +17282,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",
|
||||
@ -17890,6 +17922,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);
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user