Merge pull request #17344 from opensourcerouting/fix/reset_bgp_session_only_if_bfd_is_properly_working

bgpd: Reset BGP session only if it was a real BFD DOWN event
This commit is contained in:
Russ White 2024-11-12 09:53:40 -05:00 committed by GitHub
commit d18337f4bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -53,8 +53,16 @@ static void bfd_session_status_update(struct bfd_session_params *bsp,
peer->host); peer->host);
return; return;
} }
peer->last_reset = PEER_DOWN_BFD_DOWN;
/* Once the BFD session is UP, and later BGP session is UP,
* BFD notices that peer->su_local changed, and BFD session goes down.
* We should trigger BGP session reset if BFD session is UP
* only when BGP session is UP already.
* Otherwise, we end up resetting BGP session when BFD session is UP,
* when the source address is changed, e.g. 0.0.0.0 -> 10.0.0.1.
*/
if (bss->last_event > peer->uptime) {
peer->last_reset = PEER_DOWN_BFD_DOWN;
/* rfc9384 */ /* rfc9384 */
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status)) if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status))
bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE, bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
@ -62,6 +70,7 @@ static void bfd_session_status_update(struct bfd_session_params *bsp,
BGP_EVENT_ADD(peer->connection, BGP_Stop); BGP_EVENT_ADD(peer->connection, BGP_Stop);
} }
}
if (bss->state == BSS_UP && bss->previous_state != BSS_UP && if (bss->state == BSS_UP && bss->previous_state != BSS_UP &&
!peer_established(peer->connection)) { !peer_established(peer->connection)) {