Commit edc666f837 for frr
commit edc666f837ca9c0c97b94f8889e8bf1c773074e7
Author: Johan Linder <johan.linder@tele2.com>
Date: Wed Nov 11 15:15:08 2026 +0100
lib: reset BFD state when a session key changes
When a session's key changes, it is deregistered and registered again
but keeps its old state. If it was Up, the new registration's first
Down reaches the protocol as Up -> Down, and BGP resets a working
session. Reset the state in _bfd_sess_remove().
Fixes: a099abe55b9b ("lib: new BFD integration API")
Signed-off-by: Johan Linder <johan.linder@tele2.com>
diff --git a/lib/bfd.c b/lib/bfd.c
index d2e4b2f0de..1e38136d05 100644
--- a/lib/bfd.c
+++ b/lib/bfd.c
@@ -553,6 +553,10 @@ static void _bfd_sess_remove(struct bfd_session_params *bsp)
/* Cancel any pending installation request. */
event_cancel(&bsp->installev);
+ /* A replacement session reports its own initial state. */
+ bsp->bss.state = BSS_UNKNOWN;
+ bsp->bss.previous_state = BSS_UNKNOWN;
+
/* Not installed, nothing to do. */
if (!bsp->installed)
return;