Ralph Seichter: > Gentoo Linux's default /etc/nsswitch.conf contains "hosts: files dns", > and the corresponding test program output looks like this: > > $ ./getaddrinfo monthu.horus-it.com > Hostname: monthu.horus-it.com > Addresses: 176.9.43.216 > > When I change the setting to "hosts: dns files", the output changes to > the following: > > $ ./getaddrinfo monthu.horus-it.com > Hostname: monthu.horus-it.com > Addresses: 2a01:4f8:150:54c1::b009:2bd8 176.9.43.216 > > Isn't this an odd result with the given contents of /etc/hosts?
If you have ""hosts: files dns", and you have only one address in /etc/hosts, you'll get only one address from getaddrinfo(). To support multiple IP addresses per name in /etc/hosts, specify "multi on" in /etc/host.conf. Given that we're in the early 21st century where a host can have both IPv4 and IPv6, I think that "multi on" should be the default. Wietse