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,14 +53,23 @@ static void bfd_session_status_update(struct bfd_session_params *bsp,
peer->host); peer->host);
return; return;
} }
peer->last_reset = PEER_DOWN_BFD_DOWN;
/* rfc9384 */ /* Once the BFD session is UP, and later BGP session is UP,
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status)) * BFD notices that peer->su_local changed, and BFD session goes down.
bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE, * We should trigger BGP session reset if BFD session is UP
BGP_NOTIFY_CEASE_BFD_DOWN); * 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 */
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status))
bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_BFD_DOWN);
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 &&