]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
drop v4-to-v6 conversions of loopback addresses from /etc/hosts
authorAlexandre Oliva <aoliva@redhat.com>
Sat, 27 Sep 2014 10:13:20 +0000 (07:13 -0300)
committerAlexandre Oliva <aoliva@redhat.com>
Fri, 7 Nov 2014 09:18:53 +0000 (07:18 -0200)
for ChangeLog

* nss/nss_files/files-hosts.c (LINE_PARSER): Drop family
conversion of loopback addresses from IPv4 to IPv6.

nss/nss_files/files-hosts.c

index 49656bc61d1c173fbba188cced805afe2227180b..639345a6726d7559b36d57b9948486de5df2d1f2 100644 (file)
@@ -43,6 +43,9 @@ struct hostent_data
     char *h_addr_ptrs[2];      /* Points to that and null terminator.  */
   };
 
+#define IN_IS_ADDR_LOOPBACK(addr) \
+  (((const char *)(addr))[0] == IN_LOOPBACKNET)
+
 #define TRAILING_LIST_MEMBER           h_aliases
 #define TRAILING_LIST_SEPARATOR_P      isspace
 #include "files-parse.c"
@@ -60,7 +63,8 @@ LINE_PARSER
    else
      {
        if (af == AF_INET6 && (flags & AI_V4MAPPED) != 0
-          && inet_pton (AF_INET, addr, entdata->host_addr) > 0)
+          && inet_pton (AF_INET, addr, entdata->host_addr) > 0
+          && !IN_IS_ADDR_LOOPBACK (entdata->host_addr))
         map_v4v6_address ((char *) entdata->host_addr,
                           (char *) entdata->host_addr);
        else if (af == AF_INET