Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
net: IPv6 lookup fails when IPv4 hosts entry is present #20327
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
I understand your point, but I disagree. I think when an IPv4 host is added to a host file the system is being instructed to use that IP as a preferred IP. However if an IPv6 address is specifically requested and there isn't one present in the hosts file, but is via DNS, then it should be expected that the request will return the IPv6 address available via DNS.
This is how python acts:
It is also how ssh, ping6 etc work:
I'm fine with relaxing the existing behavior of Lookup API by following some external configuration such as nsswitch.conf.
Also fine to revisit the existing behavior. I can imagine it's pretty tough for people under some heterogenous environments to manage /etc/hosts, internal and public namespaces consistently.