mirror of
https://github.com/netbirdio/netbird.git
synced 2025-03-03 09:21:12 +01:00
Fix eBPF conn close logic
This commit is contained in:
parent
aa1a482669
commit
e5f8ecdeb7
@ -556,6 +556,12 @@ func (conn *Conn) onWorkerRelayStateDisconnected() {
|
||||
defer conn.mu.Unlock()
|
||||
|
||||
if conn.wgProxyRelay != nil {
|
||||
log.Debugf("relayed connection is closed, clean up WireGuard config")
|
||||
err := conn.config.WgConfig.WgInterface.RemovePeer(conn.config.WgConfig.RemoteKey)
|
||||
if err != nil {
|
||||
conn.log.Errorf("failed to remove wg endpoint: %v", err)
|
||||
}
|
||||
|
||||
conn.endpointRelay = nil
|
||||
_ = conn.wgProxyRelay.CloseConn()
|
||||
conn.wgProxyRelay = nil
|
||||
|
@ -181,8 +181,8 @@ func (p *WGEBPFProxy) proxyToRemote() {
|
||||
conn, ok := p.turnConnStore[uint16(addr.Port)]
|
||||
p.turnConnMutex.Unlock()
|
||||
if !ok {
|
||||
log.Infof("turn conn not found by port, exit form proxy: %d", addr.Port)
|
||||
return // todo replace it to return. For debug troubleshooting keep it
|
||||
log.Debugf("turn conn not found by port because conn already has been closed: %d", addr.Port)
|
||||
continue
|
||||
}
|
||||
|
||||
_, err = conn.Write(buf[:n])
|
||||
|
Loading…
Reference in New Issue
Block a user