|
|
b40826 |
2011-06-28 Andreas Schwab <schwab@redhat.com>
|
|
|
b40826 |
|
|
|
b40826 |
* sysdeps/posix/getaddrinfo.c (gaih_inet): Don't use gethostbyaddr
|
|
|
b40826 |
to determine canonical name.
|
|
|
b40826 |
|
|
|
b40826 |
2011-06-22 Andreas Schwab <schwab@redhat.com>
|
|
|
b40826 |
|
|
|
b40826 |
* sysdeps/posix/getaddrinfo.c (gaih_inet): Fix last change.
|
|
|
b40826 |
|
|
|
b40826 |
2011-06-21 Ulrich Drepper <drepper@gmail.com>
|
|
|
b40826 |
|
|
|
b40826 |
[BZ #12885]
|
|
|
b40826 |
* sysdeps/posix/getaddrinfo.c (gaih_inet): When looking up only IPv6
|
|
|
b40826 |
addresses using gethostbyname4_r ignore IPv4 addresses.
|
|
|
b40826 |
|
|
|
b40826 |
Index: glibc-2.12-2-gc4ccff1/sysdeps/posix/getaddrinfo.c
|
|
|
b40826 |
===================================================================
|
|
|
b40826 |
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/posix/getaddrinfo.c
|
|
|
b40826 |
+++ glibc-2.12-2-gc4ccff1/sysdeps/posix/getaddrinfo.c
|
|
|
b40826 |
@@ -512,10 +512,11 @@ gaih_inet (const char *name, const struc
|
|
|
b40826 |
|
|
|
b40826 |
/* If we do not have to look for IPv4 and IPv6 together, use
|
|
|
b40826 |
the simple, old functions. */
|
|
|
b40826 |
- if (req->ai_family == AF_INET
|
|
|
b40826 |
- || (req->ai_family == AF_INET6
|
|
|
b40826 |
- && ((req->ai_flags & AI_V4MAPPED) == 0
|
|
|
b40826 |
- || (req->ai_flags & AI_ALL) == 0)))
|
|
|
b40826 |
+ if ((req->ai_family == AF_INET
|
|
|
b40826 |
+ || (req->ai_family == AF_INET6
|
|
|
b40826 |
+ && ((req->ai_flags & AI_V4MAPPED) == 0
|
|
|
b40826 |
+ || (req->ai_flags & AI_ALL) == 0)))
|
|
|
b40826 |
+ && (req->ai_flags & AI_CANONNAME) == 0)
|
|
|
b40826 |
{
|
|
|
b40826 |
int family = req->ai_family;
|
|
|
b40826 |
size_t tmpbuflen = 512;
|
|
|
b40826 |
@@ -731,16 +732,44 @@ gaih_inet (const char *name, const struc
|
|
|
b40826 |
tmpbuflen, 2 * tmpbuflen);
|
|
|
b40826 |
}
|
|
|
b40826 |
|
|
|
b40826 |
- no_inet6_data = no_data;
|
|
|
b40826 |
-
|
|
|
b40826 |
if (status == NSS_STATUS_SUCCESS)
|
|
|
b40826 |
{
|
|
|
b40826 |
+ assert (!no_data);
|
|
|
b40826 |
+ no_data = 1;
|
|
|
b40826 |
+
|
|
|
b40826 |
if ((req->ai_flags & AI_CANONNAME) != 0 && canon == NULL)
|
|
|
b40826 |
canon = (*pat)->name;
|
|
|
b40826 |
|
|
|
b40826 |
while (*pat != NULL)
|
|
|
b40826 |
- pat = &((*pat)->next);
|
|
|
b40826 |
+ {
|
|
|
b40826 |
+ if ((*pat)->family == AF_INET
|
|
|
b40826 |
+ && req->ai_family == AF_INET6
|
|
|
b40826 |
+ && (req->ai_flags & AI_V4MAPPED) != 0)
|
|
|
b40826 |
+ {
|
|
|
b40826 |
+ uint32_t *pataddr = (*pat)->addr;
|
|
|
b40826 |
+ (*pat)->family = AF_INET6;
|
|
|
b40826 |
+ pataddr[3] = pataddr[0];
|
|
|
b40826 |
+ pataddr[2] = htonl (0xffff);
|
|
|
b40826 |
+ pataddr[1] = 0;
|
|
|
b40826 |
+ pataddr[0] = 0;
|
|
|
b40826 |
+ pat = &((*pat)->next);
|
|
|
b40826 |
+ no_data = 0;
|
|
|
b40826 |
+ }
|
|
|
b40826 |
+ else if (req->ai_family == AF_UNSPEC
|
|
|
b40826 |
+ || (*pat)->family == req->ai_family)
|
|
|
b40826 |
+ {
|
|
|
b40826 |
+ pat = &((*pat)->next);
|
|
|
b40826 |
+
|
|
|
b40826 |
+ no_data = 0;
|
|
|
b40826 |
+ if (req->ai_family == AF_INET6)
|
|
|
b40826 |
+ got_ipv6 = true;
|
|
|
b40826 |
+ }
|
|
|
b40826 |
+ else
|
|
|
b40826 |
+ *pat = ((*pat)->next);
|
|
|
b40826 |
+ }
|
|
|
b40826 |
}
|
|
|
b40826 |
+
|
|
|
b40826 |
+ no_inet6_data = no_data;
|
|
|
b40826 |
}
|
|
|
b40826 |
else
|
|
|
b40826 |
{
|
|
|
b40826 |
@@ -905,39 +934,9 @@ gaih_inet (const char *name, const struc
|
|
|
b40826 |
{
|
|
|
b40826 |
if (canon == NULL)
|
|
|
b40826 |
{
|
|
|
b40826 |
- struct hostent *h = NULL;
|
|
|
b40826 |
- int herrno;
|
|
|
b40826 |
- struct hostent th;
|
|
|
b40826 |
- size_t tmpbuflen = 512;
|
|
|
b40826 |
- char *tmpbuf = NULL;
|
|
|
b40826 |
-
|
|
|
b40826 |
- do
|
|
|
b40826 |
- {
|
|
|
b40826 |
- tmpbuf = extend_alloca (tmpbuf, tmpbuflen, tmpbuflen * 2);
|
|
|
b40826 |
- rc = __gethostbyaddr_r (at2->addr,
|
|
|
b40826 |
- ((at2->family == AF_INET6)
|
|
|
b40826 |
- ? sizeof (struct in6_addr)
|
|
|
b40826 |
- : sizeof (struct in_addr)),
|
|
|
b40826 |
- at2->family, &th, tmpbuf,
|
|
|
b40826 |
- tmpbuflen, &h, &herrno);
|
|
|
b40826 |
- }
|
|
|
b40826 |
- while (rc == ERANGE && herrno == NETDB_INTERNAL);
|
|
|
b40826 |
-
|
|
|
b40826 |
- if (rc != 0 && herrno == NETDB_INTERNAL)
|
|
|
b40826 |
- {
|
|
|
b40826 |
- __set_h_errno (herrno);
|
|
|
b40826 |
- return -EAI_SYSTEM;
|
|
|
b40826 |
- }
|
|
|
b40826 |
-
|
|
|
b40826 |
- if (h != NULL)
|
|
|
b40826 |
- canon = h->h_name;
|
|
|
b40826 |
- else
|
|
|
b40826 |
- {
|
|
|
b40826 |
- assert (orig_name != NULL);
|
|
|
b40826 |
- /* If the canonical name cannot be determined, use
|
|
|
b40826 |
- the passed in string. */
|
|
|
b40826 |
- canon = orig_name;
|
|
|
b40826 |
- }
|
|
|
b40826 |
+ /* If the canonical name cannot be determined, use
|
|
|
b40826 |
+ the passed in string. */
|
|
|
b40826 |
+ canon = orig_name;
|
|
|
b40826 |
}
|
|
|
b40826 |
|
|
|
b40826 |
#ifdef HAVE_LIBIDN
|