|
|
3d953c |
From 12f9f8472d0f8cfc026352906b8e5342df2846cc Mon Sep 17 00:00:00 2001
|
|
|
3d953c |
From: Donatas Abraitis <donatas@opensourcerouting.org>
|
|
|
3d953c |
Date: Tue, 27 Sep 2022 17:30:16 +0300
|
|
|
3d953c |
Subject: [PATCH] bgpd: Do not send Deconfig/Shutdown message when restarting
|
|
|
3d953c |
|
|
|
3d953c |
We might disable sending unconfig/shutdown notifications when
|
|
|
3d953c |
Graceful-Restart is enabled and negotiated.
|
|
|
3d953c |
|
|
|
3d953c |
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
|
|
|
3d953c |
---
|
|
|
3d953c |
bgpd/bgpd.c | 35 ++++++++++++++++++++++++++---------
|
|
|
3d953c |
1 file changed, 26 insertions(+), 9 deletions(-)
|
|
|
3d953c |
|
|
|
3d953c |
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
|
|
|
3d953c |
index 3d4ef7c..f8089c6 100644
|
|
|
3d953c |
--- a/bgpd/bgpd.c
|
|
|
3d953c |
+++ b/bgpd/bgpd.c
|
|
|
3d953c |
@@ -2564,11 +2564,34 @@ int peer_group_remote_as(struct bgp *bgp, const char *group_name, as_t *as,
|
|
|
3d953c |
|
|
|
3d953c |
void peer_notify_unconfig(struct peer *peer)
|
|
|
3d953c |
{
|
|
|
3d953c |
+ if (BGP_PEER_GRACEFUL_RESTART_CAPABLE(peer)) {
|
|
|
3d953c |
+ if (bgp_debug_neighbor_events(peer))
|
|
|
3d953c |
+ zlog_debug(
|
|
|
3d953c |
+ "%pBP configured Graceful-Restart, skipping unconfig notification",
|
|
|
3d953c |
+ peer);
|
|
|
3d953c |
+ return;
|
|
|
3d953c |
+ }
|
|
|
3d953c |
+
|
|
|
3d953c |
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->status))
|
|
|
3d953c |
bgp_notify_send(peer, BGP_NOTIFY_CEASE,
|
|
|
3d953c |
BGP_NOTIFY_CEASE_PEER_UNCONFIG);
|
|
|
3d953c |
}
|
|
|
3d953c |
|
|
|
3d953c |
+static void peer_notify_shutdown(struct peer *peer)
|
|
|
3d953c |
+{
|
|
|
3d953c |
+ if (BGP_PEER_GRACEFUL_RESTART_CAPABLE(peer)) {
|
|
|
3d953c |
+ if (bgp_debug_neighbor_events(peer))
|
|
|
3d953c |
+ zlog_debug(
|
|
|
3d953c |
+ "%pBP configured Graceful-Restart, skipping shutdown notification",
|
|
|
3d953c |
+ peer);
|
|
|
3d953c |
+ return;
|
|
|
3d953c |
+ }
|
|
|
3d953c |
+
|
|
|
3d953c |
+ if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->status))
|
|
|
3d953c |
+ bgp_notify_send(peer, BGP_NOTIFY_CEASE,
|
|
|
3d953c |
+ BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN);
|
|
|
3d953c |
+}
|
|
|
3d953c |
+
|
|
|
3d953c |
void peer_group_notify_unconfig(struct peer_group *group)
|
|
|
3d953c |
{
|
|
|
3d953c |
struct peer *peer, *other;
|
|
|
3d953c |
@@ -3380,11 +3403,8 @@ int bgp_delete(struct bgp *bgp)
|
|
|
3d953c |
}
|
|
|
3d953c |
|
|
|
3d953c |
/* Inform peers we're going down. */
|
|
|
3d953c |
- for (ALL_LIST_ELEMENTS(bgp->peer, node, next, peer)) {
|
|
|
3d953c |
- if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->status))
|
|
|
3d953c |
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
|
|
|
3d953c |
- BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN);
|
|
|
3d953c |
- }
|
|
|
3d953c |
+ for (ALL_LIST_ELEMENTS(bgp->peer, node, next, peer))
|
|
|
3d953c |
+ peer_notify_shutdown(peer);
|
|
|
3d953c |
|
|
|
3d953c |
/* Delete static routes (networks). */
|
|
|
3d953c |
bgp_static_delete(bgp);
|
|
|
3d953c |
@@ -7238,11 +7258,7 @@ void bgp_terminate(void)
|
|
|
3d953c |
|
|
|
3d953c |
for (ALL_LIST_ELEMENTS(bm->bgp, mnode, mnnode, bgp))
|
|
|
3d953c |
for (ALL_LIST_ELEMENTS(bgp->peer, node, nnode, peer))
|
|
|
3d953c |
- if (peer->status == Established
|
|
|
3d953c |
- || peer->status == OpenSent
|
|
|
3d953c |
- || peer->status == OpenConfirm)
|
|
|
3d953c |
- bgp_notify_send(peer, BGP_NOTIFY_CEASE,
|
|
|
3d953c |
- BGP_NOTIFY_CEASE_PEER_UNCONFIG);
|
|
|
3d953c |
+ peer_notify_unconfig(peer);
|
|
|
3d953c |
|
|
|
3d953c |
if (bm->process_main_queue)
|
|
|
3d953c |
work_queue_free_and_null(&bm->process_main_queue);
|