mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-29 13:05:46 +00:00
net/netns: don't bind to device for localhost connections
Fixes derphttp test failures on Windows (for #50).
This commit is contained in:
parent
746f03669c
commit
551e1e99e9
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
@ -28,6 +29,13 @@ func interfaceIndex(iface *winipcfg.IPAdapterAddresses) uint32 {
|
|||||||
// control binds c to the Windows interface that holds a default
|
// control binds c to the Windows interface that holds a default
|
||||||
// route, and is not the Tailscale WinTun interface.
|
// route, and is not the Tailscale WinTun interface.
|
||||||
func control(network, address string, c syscall.RawConn) error {
|
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
|
canV4, canV6 := false, false
|
||||||
switch network {
|
switch network {
|
||||||
case "tcp", "udp":
|
case "tcp", "udp":
|
||||||
|
Loading…
Reference in New Issue
Block a user