]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: fix dynamic peer graceful restart race condition
authorLouis Scalbert <louis.scalbert@6wind.com>
Thu, 16 May 2024 13:08:09 +0000 (15:08 +0200)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Fri, 17 May 2024 06:40:51 +0000 (06:40 +0000)
bgp_llgr topotest sometimes fails at step 8:

> topo: STEP 8: 'Check if we can see 172.16.1.2/32 after R4 (dynamic peer) was killed'

R4 neighbor is deleted on R2 because it fails to re-connect:

> 14:33:40.128048 BGP: [HKWM3-ZC5QP] 192.168.3.1 fd -1 went from Established to Clearing
> 14:33:40.128154 BGP: [MJ1TJ-HEE3V] 192.168.3.1(r4) graceful restart timer expired
> 14:33:40.128158 BGP: [ZTA2J-YRKGY] 192.168.3.1(r4) graceful restart stalepath timer stopped
> 14:33:40.128162 BGP: [H917J-25EWN] 192.168.3.1(r4) Long-lived stale timer (IPv4 Unicast) started for 20 sec
> 14:33:40.128168 BGP: [H5X66-NXP9S] 192.168.3.1(r4) Long-lived set stale community (LLGR_STALE) for: 172.16.1.2/32
> 14:33:40.128220 BGP: [H5X66-NXP9S] 192.168.3.1(r4) Long-lived set stale community (LLGR_STALE) for: 192.168.3.0/24
> [...]
> 14:33:41.138869 BGP: [RGGAC-RJ6WG] 192.168.3.1 [Event] Connect failed 111(Connection refused)
> 14:33:41.138906 BGP: [ZWCSR-M7FG9] 192.168.3.1 [FSM] TCP_connection_open_failed (Connect->Active), fd 23
> 14:33:41.138912 BGP: [JA9RP-HSD1K] 192.168.3.1 (dynamic neighbor) deleted (bgp_connect_fail)
> 14:33:41.139126 BGP: [P98A2-2RDFE] 192.168.3.1(r4) graceful restart stalepath timer stopped

af8496af08 ("bgpd: Do not delete BGP dynamic peers if graceful restart
kicks in") forgot to modify bgp_connect_fail()

Do not delete the peer in bgp_connect_fail() if Non-Stop-Forwarding is
in progress.

Fixes: af8496af08 ("bgpd: Do not delete BGP dynamic peers if graceful restart kicks in")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
(cherry picked from commit e446308d76b4ac8f26149db982bf5ed5ac93d5f5)

bgpd/bgp_fsm.c

index 502648697cab9f84665dc9fe82054cd2fd2aed40..5043439945b8635d54eea91cb6213a154cffcff9 100644 (file)
@@ -1777,7 +1777,7 @@ bgp_connect_fail(struct peer_connection *connection)
 {
        struct peer *peer = connection->peer;
 
-       if (peer_dynamic_neighbor(peer)) {
+       if (peer_dynamic_neighbor_no_nsf(peer)) {
                if (bgp_debug_neighbor_events(peer))
                        zlog_debug("%s (dynamic neighbor) deleted (%s)",
                                   peer->host, __func__);