diff options
| author | Donatas Abraitis <donatas@opensourcerouting.org> | 2022-09-27 17:30:16 +0300 | 
|---|---|---|
| committer | Mergify <37929162+mergify[bot]@users.noreply.github.com> | 2022-11-07 19:26:41 +0000 | 
| commit | 54acee45bd60bd06662f9551db500d584a9c73b1 (patch) | |
| tree | 37ea68968a1fd4602a7b0c4064501cad9f69367f /bgpd | |
| parent | 99477bc4925725a9f371149e5396937936b2a855 (diff) | |
bgpd: Do not send Deconfig/Shutdown message when restarting
We might disable sending unconfig/shutdown notifications when
Graceful-Restart is enabled and negotiated.
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 95098d9611e79d43b578400bb76dc7a76aa8cab9)
Diffstat (limited to 'bgpd')
| -rw-r--r-- | bgpd/bgpd.c | 35 | 
1 files changed, 27 insertions, 8 deletions
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 749e46ebe9..7840f5e0b8 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -2760,6 +2760,21 @@ void peer_notify_unconfig(struct peer *peer)  				BGP_NOTIFY_CEASE_PEER_UNCONFIG);  } +static void peer_notify_shutdown(struct peer *peer) +{ +	if (BGP_PEER_GRACEFUL_RESTART_CAPABLE(peer)) { +		if (bgp_debug_neighbor_events(peer)) +			zlog_debug( +				"%pBP configured Graceful-Restart, skipping shutdown notification", +				peer); +		return; +	} + +	if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->status)) +		bgp_notify_send(peer, BGP_NOTIFY_CEASE, +				BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN); +} +  void peer_group_notify_unconfig(struct peer_group *group)  {  	struct peer *peer, *other; @@ -3676,11 +3691,8 @@ int bgp_delete(struct bgp *bgp)  	}  	/* Inform peers we're going down. */ -	for (ALL_LIST_ELEMENTS(bgp->peer, node, next, peer)) { -		if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->status)) -			bgp_notify_send(peer, BGP_NOTIFY_CEASE, -					BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN); -	} +	for (ALL_LIST_ELEMENTS(bgp->peer, node, next, peer)) +		peer_notify_shutdown(peer);  	/* Delete static routes (networks). */  	bgp_static_delete(bgp); @@ -8251,11 +8263,18 @@ void bgp_terminate(void)  	/* reverse bgp_master_init */  	for (ALL_LIST_ELEMENTS(bm->bgp, mnode, mnnode, bgp)) {  		bgp_close_vrf_socket(bgp); -		for (ALL_LIST_ELEMENTS(bgp->peer, node, nnode, peer)) -			if (peer_established(peer) || peer->status == OpenSent -			    || peer->status == OpenConfirm) +		for (ALL_LIST_ELEMENTS(bgp->peer, node, nnode, peer)) { +			if (BGP_PEER_GRACEFUL_RESTART_CAPABLE(peer)) { +				if (bgp_debug_neighbor_events(peer)) +					zlog_debug( +						"%pBP configured Graceful-Restart, skipping unconfig notification", +						peer); +				continue; +			} +			if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->status))  				bgp_notify_send(peer, BGP_NOTIFY_CEASE,  						BGP_NOTIFY_CEASE_PEER_UNCONFIG); +		}  	}  	if (bm->listen_sockets)  | 
