1 2011-06-28 Andreas Schwab <schwab@redhat.com>
3 * sysdeps/posix/getaddrinfo.c (gaih_inet): Don't use gethostbyaddr
4 to determine canonical name.
6 2011-06-22 Andreas Schwab <schwab@redhat.com>
8 * sysdeps/posix/getaddrinfo.c (gaih_inet): Fix last change.
10 2011-06-21 Ulrich Drepper <drepper@gmail.com>
13 * sysdeps/posix/getaddrinfo.c (gaih_inet): When looking up only IPv6
14 addresses using gethostbyname4_r ignore IPv4 addresses.
16 Index: glibc-2.12-2-gc4ccff1/sysdeps/posix/getaddrinfo.c
17 ===================================================================
18 --- glibc-2.12-2-gc4ccff1.orig/sysdeps/posix/getaddrinfo.c
19 +++ glibc-2.12-2-gc4ccff1/sysdeps/posix/getaddrinfo.c
20 @@ -512,10 +512,11 @@ gaih_inet (const char *name, const struc
22 /* If we do not have to look for IPv4 and IPv6 together, use
23 the simple, old functions. */
24 - if (req->ai_family == AF_INET
25 - || (req->ai_family == AF_INET6
26 - && ((req->ai_flags & AI_V4MAPPED) == 0
27 - || (req->ai_flags & AI_ALL) == 0)))
28 + if ((req->ai_family == AF_INET
29 + || (req->ai_family == AF_INET6
30 + && ((req->ai_flags & AI_V4MAPPED) == 0
31 + || (req->ai_flags & AI_ALL) == 0)))
32 + && (req->ai_flags & AI_CANONNAME) == 0)
34 int family = req->ai_family;
35 size_t tmpbuflen = 512;
36 @@ -731,16 +732,44 @@ gaih_inet (const char *name, const struc
37 tmpbuflen, 2 * tmpbuflen);
40 - no_inet6_data = no_data;
42 if (status == NSS_STATUS_SUCCESS)
47 if ((req->ai_flags & AI_CANONNAME) != 0 && canon == NULL)
51 - pat = &((*pat)->next);
53 + if ((*pat)->family == AF_INET
54 + && req->ai_family == AF_INET6
55 + && (req->ai_flags & AI_V4MAPPED) != 0)
57 + uint32_t *pataddr = (*pat)->addr;
58 + (*pat)->family = AF_INET6;
59 + pataddr[3] = pataddr[0];
60 + pataddr[2] = htonl (0xffff);
63 + pat = &((*pat)->next);
66 + else if (req->ai_family == AF_UNSPEC
67 + || (*pat)->family == req->ai_family)
69 + pat = &((*pat)->next);
72 + if (req->ai_family == AF_INET6)
76 + *pat = ((*pat)->next);
80 + no_inet6_data = no_data;
84 @@ -905,39 +934,9 @@ gaih_inet (const char *name, const struc
88 - struct hostent *h = NULL;
91 - size_t tmpbuflen = 512;
92 - char *tmpbuf = NULL;
96 - tmpbuf = extend_alloca (tmpbuf, tmpbuflen, tmpbuflen * 2);
97 - rc = __gethostbyaddr_r (at2->addr,
98 - ((at2->family == AF_INET6)
99 - ? sizeof (struct in6_addr)
100 - : sizeof (struct in_addr)),
101 - at2->family, &th, tmpbuf,
102 - tmpbuflen, &h, &herrno);
104 - while (rc == ERANGE && herrno == NETDB_INTERNAL);
106 - if (rc != 0 && herrno == NETDB_INTERNAL)
108 - __set_h_errno (herrno);
109 - return -EAI_SYSTEM;
116 - assert (orig_name != NULL);
117 - /* If the canonical name cannot be determined, use
118 - the passed in string. */
121 + /* If the canonical name cannot be determined, use
122 + the passed in string. */