From 0702ddb3c94e2f7cf2b0d0ef7886d8e21bf61bed Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Sat, 18 Jan 2025 14:16:06 +0200 Subject: [PATCH 1/2] bgpd: Do not show "Waiting for OPEN" as last reset This is actually not reset, and should be ignored showing it as last reset under `show bgp neighbor`. Fixes: 1e91f1d1193003cb325a2bf595c8a9273740e2f0 ("bgpd: Update failed reason to distinguish some NHT scenario") Signed-off-by: Donatas Abraitis --- bgpd/bgp_fsm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index 0e3ed9f0d1fb..1a30cb37f4da 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -2163,6 +2163,9 @@ bgp_establish(struct peer_connection *connection) peer->established++; bgp_fsm_change_status(connection, Established); + if (peer->last_reset == PEER_DOWN_WAITING_OPEN) + peer->last_reset = 0; + /* bgp log-neighbor-changes of neighbor Up */ if (CHECK_FLAG(peer->bgp->flags, BGP_FLAG_LOG_NEIGHBOR_CHANGES)) { struct vrf *vrf = vrf_lookup_by_id(peer->bgp->vrf_id); From 9a5be111916cecf6b4c9c680c52634271c4bf9cc Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Sat, 18 Jan 2025 14:54:20 +0200 Subject: [PATCH 2/2] bgpd: Set last reset `No AFI/SAFI activated for peer` after we do defaults Move checking if the peer is active only after we apply defaults for address families. If the family got activated after applying the defaults we should reset last_reset reason. Signed-off-by: Donatas Abraitis --- bgpd/bgpd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index c2254ae791e9..db74dd68d0d2 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -2026,8 +2026,11 @@ struct peer *peer_create(union sockunion *su, const char *conf_if, if (bgp->autoshutdown) peer_flag_set(peer, PEER_FLAG_SHUTDOWN); /* Set up peer's events and timers. */ - else if (!active && peer_active(peer->connection)) + else if (!active && peer_active(peer->connection)) { + if (peer->last_reset == PEER_DOWN_NOAFI_ACTIVATED) + peer->last_reset = 0; bgp_timer_set(peer->connection); + } bgp_peer_gr_flags_update(peer); BGP_GR_ROUTER_DETECT_AND_SEND_CAPABILITY_TO_ZEBRA(bgp, bgp->peer);