net/udprelay: apply netns Control func to server socket(s)

To prevent peer relay servers from sending packets *over* Tailscale.

Updates tailscale/corp#35651

Signed-off-by: Jordan Whited <jordan@tailscale.com>
This commit is contained in:
Jordan Whited
2026-01-07 15:17:38 -08:00
committed by Jordan Whited
parent 4c37141ab7
commit 5f34f14e14
3 changed files with 30 additions and 6 deletions
+1 -2
View File
@@ -12,11 +12,10 @@ import (
"golang.org/x/sys/unix"
)
func listenControl(_ string, _ string, c syscall.RawConn) error {
func trySetReusePort(_ string, _ string, c syscall.RawConn) {
c.Control(func(fd uintptr) {
unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_REUSEPORT, 1)
})
return nil
}
func isReusableSocket(uc *net.UDPConn) bool {