mirror of
https://github.com/netbirdio/netbird.git
synced 2026-09-14 10:49:07 +02:00
pqkem: recover from persistent rekey failure by re-bootstrapping over signal
OnRekeyFailed now re-runs the KEM bootstrap over Signal (conn.RequestReoffer -> handshaker.SendOffer) instead of only logging: a fresh signalling offer starts a new exchange that overwrites the stalled PSK on both sides, resyncing after a persistent data-path desync. Chosen over a responder-side awaitingAck revert (which fights the confirm-less ack timing) and a full tunnel teardown (heavier). The tunnel stays up on the previous PSK meanwhile since Signal is independent of the broken data path.
This commit is contained in:
@@ -726,6 +726,22 @@ func (conn *Conn) onGuardEvent() {
|
||||
}
|
||||
}
|
||||
|
||||
// RequestReoffer sends a fresh signalling offer for the peer, re-running the
|
||||
// post-quantum bootstrap over Signal. Used to recover from a persistent data-path
|
||||
// rekey failure: a new exchange overwrites the stalled PSK on both sides. No-op if the
|
||||
// connection is not open yet.
|
||||
func (conn *Conn) RequestReoffer() {
|
||||
conn.mu.Lock()
|
||||
h := conn.handshaker
|
||||
conn.mu.Unlock()
|
||||
if h == nil {
|
||||
return
|
||||
}
|
||||
if err := h.SendOffer(); err != nil {
|
||||
conn.Log.Debugf("pqkem: recovery re-offer failed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func (conn *Conn) onWGDisconnected(watcherCtx context.Context) {
|
||||
conn.mu.Lock()
|
||||
defer conn.mu.Unlock()
|
||||
|
||||
Reference in New Issue
Block a user