net: LookupIP("127.0.0.1") does not work when CGO_ENABLED=1 #11335
Comments
I think this is expected behavior from go1.5, and a consequence of the new feature described in 4a0ba7a. |
@ianlancetaylor, @rsc, any opinions on this? Apparently glibc lets you do a DNS lookup on an IP address? Is that part of the net.LookupIP contract? Do we care if this behavior changes? |
It wasn't intended but I think it's probably worth keeping. |
That is, we should keep the 1.4 behavior. |
Easy enough. I assume we can just recognize IP literals (IPv4 or IPv6) and return them immediately, without regard to the system's nsswitch.conf or resolv.conf, etc. I hope that glibc isn't doing anything fancier? @mikioh, do you know? |
That is what glibc's getaddrinfo function does: it calls inet_aton on the name, and, if that succeeds, returns the result. |
CL https://golang.org/cl/11420 mentions this issue. |
The net.LookupIP docs are unclear on what it does with IPs as opposed to hostnames, but changing the behavior seems wrong.
The text was updated successfully, but these errors were encountered: