summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_fsm.c
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2024-07-25 12:22:27 +0200
committerDonatas Abraitis <donatas@opensourcerouting.org>2024-07-25 12:22:27 +0200
commitfa9bd07ae5e93479ff4e7b81791393ab883cc722 (patch)
tree5daef5d05ef1764886bb493ace6e382f40514003 /bgpd/bgp_fsm.c
parentbgpd: Set the last_reset if we change the password also (diff)
downloadfrr-fa9bd07ae5e93479ff4e7b81791393ab883cc722.tar.xz
frr-fa9bd07ae5e93479ff4e7b81791393ab883cc722.zip
bgpd: Keep the last reset reason before we reset the peer
If we send a notification, there is no point setting the last_reset, because bgp_notify_send() sets last_reset to PEER_DOWN_NOTIFY_SEND (almost everywhere). Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to 'bgpd/bgp_fsm.c')
-rw-r--r--bgpd/bgp_fsm.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c
index e911c2d18..1eeb14115 100644
--- a/bgpd/bgp_fsm.c
+++ b/bgpd/bgp_fsm.c
@@ -2740,14 +2740,15 @@ static void bgp_gr_update_mode_of_all_peers(struct bgp *bgp,
peer, peer->peer_gr_new_status_flag,
peer->flags);
+ peer->last_reset = PEER_DOWN_CAPABILITY_CHANGE;
+
/* Reset session to match with behavior for other peer
* configs that require the session to be re-setup.
*/
- if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status)) {
- peer->last_reset = PEER_DOWN_CAPABILITY_CHANGE;
+ if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status))
bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
- } else
+ else
bgp_session_reset(peer);
}
}
@@ -2968,14 +2969,15 @@ unsigned int bgp_peer_gr_action(struct peer *peer, enum peer_mode old_state,
bgp_peer_move_to_gr_mode(peer, new_state);
if (session_reset) {
+ peer->last_reset = PEER_DOWN_CAPABILITY_CHANGE;
+
/* Reset session to match with behavior for other peer
* configs that require the session to be re-setup.
*/
- if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status)) {
- peer->last_reset = PEER_DOWN_CAPABILITY_CHANGE;
+ if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status))
bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
- } else
+ else
bgp_session_reset(peer);
}