From 9e50da321b96567e688b68b7a1d9510c20642766 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Wed, 12 Apr 2023 10:24:17 -0700 Subject: [PATCH] client/tailscale: dial LocalAPI at 127.0.0.1 on macOS Updates #7851 Change-Id: Ib53cf53cdfee277ef42f7833352bc51ecb5db959 Signed-off-by: Brad Fitzpatrick --- client/tailscale/localclient.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/tailscale/localclient.go b/client/tailscale/localclient.go index 9224f0843..611a49b29 100644 --- a/client/tailscale/localclient.go +++ b/client/tailscale/localclient.go @@ -96,8 +96,9 @@ func (lc *LocalClient) defaultDialer(ctx context.Context, network, addr string) // a TCP server on a random port, find the random port. For HTTP connections, // we don't send the token. It gets added in an HTTP Basic-Auth header. if port, _, err := safesocket.LocalTCPPortAndToken(); err == nil { + // We use 127.0.0.1 and not "localhost" (issue 7851). var d net.Dialer - return d.DialContext(ctx, "tcp", "localhost:"+strconv.Itoa(port)) + return d.DialContext(ctx, "tcp", "127.0.0.1:"+strconv.Itoa(port)) } } s := safesocket.DefaultConnectionStrategy(lc.socket())