Skip to content

Commit d8a5311

Browse files
committed
wgengine/magicsock: quiet an IPv6 warning in tests
In tests, we force binding to localhost to avoid OS firewall warning dialogs. But for IPv6, we were trying (and failing) to bind to 127.0.0.1. You'd think we'd just say "localhost", but that's apparently ill defined. See https://tools.ietf.org/html/draft-ietf-dnsop-let-localhost-be-localhost and golang/go#22826. (It's bitten me in the past, but I can't remember specific bugs.) So use "::1" explicitly for "udp6", which makes the test quieter. (cherry picked from commit 450cfed)
1 parent c73c300 commit d8a5311

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

wgengine/magicsock/magicsock.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2492,6 +2492,9 @@ func (c *Conn) bind1(ruc **RebindingUDPConn, which string) error {
24922492
host := ""
24932493
if inTest() && !c.simulatedNetwork {
24942494
host = "127.0.0.1"
2495+
if which == "udp6" {
2496+
host = "::1"
2497+
}
24952498
}
24962499
var pc net.PacketConn
24972500
var err error

0 commit comments

Comments
 (0)