mirror of
https://github.com/netbirdio/netbird.git
synced 2026-07-20 07:21:27 +02: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())
|
||||
if err := d.wgIface.RemovePeer(d.peerCfg.PublicKey); err != nil {
|
||||
d.peerCfg.Log.Errorf("failed to remove endpoint: %s", err)
|
||||
if !d.wgIface.IsUserspaceBind() {
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user