mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-18 08:16:39 +00:00
[client] Fix legacy routing exclusion routes in kernel mode (#4167)
This commit is contained in:
@@ -120,17 +120,8 @@ func (c *UDPConn) Close() error {
|
||||
return closeConn(c.ID, c.UDPConn)
|
||||
}
|
||||
|
||||
// WrapUDPConn wraps an existing *net.UDPConn with nbnet functionality
|
||||
func WrapUDPConn(conn *net.UDPConn) *UDPConn {
|
||||
return &UDPConn{
|
||||
UDPConn: conn,
|
||||
ID: GenerateConnID(),
|
||||
seenAddrs: &sync.Map{},
|
||||
}
|
||||
}
|
||||
|
||||
// RemoveAddress removes an address from the seen cache and triggers removal hooks.
|
||||
func (c *UDPConn) RemoveAddress(addr string) {
|
||||
func (c *PacketConn) RemoveAddress(addr string) {
|
||||
if _, exists := c.seenAddrs.LoadAndDelete(addr); !exists {
|
||||
return
|
||||
}
|
||||
@@ -159,6 +150,16 @@ func (c *UDPConn) RemoveAddress(addr string) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// WrapPacketConn wraps an existing net.PacketConn with nbnet functionality
|
||||
func WrapPacketConn(conn net.PacketConn) *PacketConn {
|
||||
return &PacketConn{
|
||||
PacketConn: conn,
|
||||
ID: GenerateConnID(),
|
||||
seenAddrs: &sync.Map{},
|
||||
}
|
||||
}
|
||||
|
||||
func callWriteHooks(id ConnectionID, seenAddrs *sync.Map, b []byte, addr net.Addr) {
|
||||
// Lookup the address in the seenAddrs map to avoid calling the hooks for every write
|
||||
if _, loaded := seenAddrs.LoadOrStore(addr.String(), true); !loaded {
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"net"
|
||||
)
|
||||
|
||||
// WrapUDPConn on iOS just returns the original connection since iOS handles its own networking
|
||||
func WrapUDPConn(conn *net.UDPConn) *net.UDPConn {
|
||||
// WrapPacketConn on iOS just returns the original connection since iOS handles its own networking
|
||||
func WrapPacketConn(conn *net.UDPConn) *net.UDPConn {
|
||||
return conn
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user