mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-25 13:59:08 +01:00
[client] Gate RemovePeer call on kernel mode in UDPListener
In userspace bind mode, the WireGuard-go patch triggers SendStagedPackets automatically via IpcSet/handlePostConfig when the peer endpoint is updated, so RemovePeer is not needed. Only call RemovePeer for kernel mode where the kernel WireGuard implementation requires it to force a new handshake.
This commit is contained in:
@@ -67,8 +67,10 @@ func (d *UDPListener) ReadPackets() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
d.peerCfg.Log.Debugf("removing lazy endpoint: %s", d.endpoint.String())
|
d.peerCfg.Log.Debugf("removing lazy endpoint: %s", d.endpoint.String())
|
||||||
if err := d.wgIface.RemovePeer(d.peerCfg.PublicKey); err != nil {
|
if !d.wgIface.IsUserspaceBind() {
|
||||||
d.peerCfg.Log.Errorf("failed to remove endpoint: %s", err)
|
if err := d.wgIface.RemovePeer(d.peerCfg.PublicKey); err != nil {
|
||||||
|
d.peerCfg.Log.Errorf("failed to remove endpoint: %s", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ignore close error as it may return "use of closed network connection" if already closed.
|
// Ignore close error as it may return "use of closed network connection" if already closed.
|
||||||
|
|||||||
Reference in New Issue
Block a user