Files
EasyTier/easytier/src
KKRainbow c7e636f918 fix(udp): keep native UDP bindings exclusive by default (#2731)
* fix(udp): honor exclusive bind defaults for native sockets

Stop enabling SO_REUSEADDR implicitly for UDP listeners, proxy NAT
sockets and port forwards. Let UdpBindOptions own the reuse request so
independent receivers cannot bind the same endpoint or receive another
network instance's traffic.

Cover occupied IPv4/IPv6 endpoints, release and rebinding, and packet
isolation across concurrent ephemeral listeners, NAT and forward sockets.
The occupied-listener regression fails on the parent revision; all nine
native UDP socket tests pass with the fix.

* test(udp): reject duplicate WireGuard listener bindings

Update the WireGuard listener test to expect AddrInUse now that native
UDP sockets honor the exclusive bind default. Allocate the first port
from the kernel so the test does not depend on a fixed endpoint.

* test(udp): preserve dual-stack WireGuard port sharing

Verify IPv6-only and IPv4 wildcard listeners can use the same port
number while exact duplicate endpoints remain rejected. This preserves
the dual-stack bind scenario without enabling UDP address reuse.
2026-10-21 00:22:40 +08:00
..