net: net.ListenUDP() only binds to IPv4 when 127.0.0.1 is not present #61310
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
When running on a system with no IPv4 loopback address(127.0.0.1) present
net.ListenUDP("udp", &net.UDPAddr{Port: 1234})
binds to0.0.0.0:1234
instead of[::]:1234
. On IPv6 only systems with no IPv4 loopback this is undesirable.What did you expect to see?
net.ListenUDP("udp", &net.UDPAddr{Port: 1234})
should bind to[::]:1234
when no IPv4 loopback is present on IPv6 only systems. Manually specifying the IPv6 wildcard address::
in the net.UDPAddr struct works as expected. This is only present when no bind address is given.What did you see instead?
net.ListenUDP("udp", &net.UDPAddr{Port: 1234})
binds to0.0.0.0:1234
even though only IPv6 is present.The text was updated successfully, but these errors were encountered: