This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
nss_files and IPv6 localhost
- From: Petr Baudis <pasky at suse dot cz>
- To: drepper at redhat dot com
- Cc: libc-alpha at sourceware dot org
- Date: Tue, 21 Aug 2007 17:13:25 +0200
- Subject: nss_files and IPv6 localhost
Hi,
on Nov 20 a change in nss/nss_files/files-hosts.c:LINE_PARSER was
introduced to treat ::1 the same way as 127.0.0.1. I didn't find this
mandated by any standard (I might have missed it), so I wonder what's
the reasoning behind this change? A lot of Linux systems have
127.0.0.1 localhost
::1 localhost
in their /etc/hosts (though most have ip6-localhost for ::1 instead).
Then, this can break things subtly as gethostbyname() (gethostbyname2(),
getaddrinfo(), ...) will return duplicate 127.0.0.1 in h_addr_list[] and
some applications do not explect duplicate entries in this array (e.g.
OpenLDAP).
Why was this behaviour introduced? Should the new "non-legacy" setup
be to have only ::1 for localhost in /etc/hosts? Or shall we just call
applications that rely on h_addr_list[] not having duplicate entries
"broken"?
--
Petr "Pasky" Baudis
Ever try. Ever fail. No matter. // Try again. Fail again. Fail better.
-- Samuel Beckett