From a4286562801a33c66df8468f25732b4c7acdf412 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Thu, 28 May 2020 14:16:23 -0700 Subject: [PATCH] wgengine/magicsock: don't report v4 localhost addresses on IPv6-only systems Updates #376 --- wgengine/magicsock/magicsock.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/wgengine/magicsock/magicsock.go b/wgengine/magicsock/magicsock.go index aeaafeec6..230ee3a2b 100644 --- a/wgengine/magicsock/magicsock.go +++ b/wgengine/magicsock/magicsock.go @@ -547,9 +547,10 @@ func (c *Conn) determineEndpoints(ctx context.Context) (ipPorts []string, reason return nil, nil, err } reason := "localAddresses" - if len(ips) == 0 { + if len(ips) == 0 && len(eps) == 0 { // Only include loopback addresses if we have no - // interfaces at all to use as endpoints. This allows + // interfaces at all to use as endpoints and don't + // have a public IPv4 or IPv6 address. This allows // for localhost testing when you're on a plane and // offline, for example. ips = loopback