|
|
|
|
@ -6,6 +6,7 @@ package netns |
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
|
"encoding/binary" |
|
|
|
|
"strings" |
|
|
|
|
"syscall" |
|
|
|
|
"unsafe" |
|
|
|
|
|
|
|
|
|
@ -28,6 +29,13 @@ func interfaceIndex(iface *winipcfg.IPAdapterAddresses) uint32 { |
|
|
|
|
// control binds c to the Windows interface that holds a default
|
|
|
|
|
// route, and is not the Tailscale WinTun interface.
|
|
|
|
|
func control(network, address string, c syscall.RawConn) error { |
|
|
|
|
if strings.HasPrefix(address, "127.") { |
|
|
|
|
// Don't bind to an interface for localhost connections,
|
|
|
|
|
// otherwise we get:
|
|
|
|
|
// connectex: The requested address is not valid in its context
|
|
|
|
|
// (The derphttp tests were failing)
|
|
|
|
|
return nil |
|
|
|
|
} |
|
|
|
|
canV4, canV6 := false, false |
|
|
|
|
switch network { |
|
|
|
|
case "tcp", "udp": |
|
|
|
|
|