|
|
51f0aa |
Upstream commit:
|
|
|
ce426f |
|
|
|
51f0aa |
commit 894f3f1049135dcbeaab8f18690973663ef3147c
|
|
|
51f0aa |
Author: Allan McRae <allan@archlinux.org>
|
|
|
51f0aa |
Date: Fri Oct 25 14:25:38 2013 +1000
|
|
|
ce426f |
|
|
|
51f0aa |
Fix incorrect getaddrinfo assertion trigger
|
|
|
51f0aa |
|
|
|
51f0aa |
[BZ #9954]
|
|
|
ce426f |
|
|
|
ce426f |
--- glibc-2.17-c758a686/sysdeps/posix/getaddrinfo.c
|
|
|
ce426f |
+++ glibc-2.17-c758a686/sysdeps/posix/getaddrinfo.c
|
|
|
ce426f |
@@ -1456,13 +1456,13 @@
|
|
|
ce426f |
|
|
|
ce426f |
/* Fill in the results in all the records. */
|
|
|
ce426f |
for (int i = 0; i < src->nresults; ++i)
|
|
|
ce426f |
- if (src->results[i].index == a1_index)
|
|
|
ce426f |
+ if (a1_index != -1 && src->results[i].index == a1_index)
|
|
|
ce426f |
{
|
|
|
ce426f |
assert (src->results[i].native == -1
|
|
|
ce426f |
|| src->results[i].native == a1_native);
|
|
|
ce426f |
src->results[i].native = a1_native;
|
|
|
ce426f |
}
|
|
|
ce426f |
- else if (src->results[i].index == a2_index)
|
|
|
ce426f |
+ else if (a2_index != -1 && src->results[i].index == a2_index)
|
|
|
ce426f |
{
|
|
|
ce426f |
assert (src->results[i].native == -1
|
|
|
ce426f |
|| src->results[i].native == a2_native);
|
|
|
ce426f |
|
|
|
ce426f |
2009-03-15 Aurelien Jarno <aurelien@aurel32.net>
|
|
|
ce426f |
|
|
|
ce426f |
* sysdeps/posix/getaddrinfo.c (getaddrinfo): correctly detect
|
|
|
ce426f |
interface for all 127.X.Y.Z addresses.
|
|
|
ce426f |
|
|
|
ce426f |
---
|
|
|
ce426f |
sysdeps/posix/getaddrinfo.c | 9 ++++++++-
|
|
|
ce426f |
1 file changed, 8 insertions(+), 1 deletion(-)
|
|
|
ce426f |
|
|
|
ce426f |
--- glibc-2.17-c758a686/sysdeps/posix/getaddrinfo.c
|
|
|
ce426f |
+++ glibc-2.17-c758a686/sysdeps/posix/getaddrinfo.c
|
|
|
ce426f |
@@ -2265,7 +2265,14 @@
|
|
|
ce426f |
tmp.addr[0] = 0;
|
|
|
ce426f |
tmp.addr[1] = 0;
|
|
|
ce426f |
tmp.addr[2] = htonl (0xffff);
|
|
|
ce426f |
- tmp.addr[3] = sinp->sin_addr.s_addr;
|
|
|
ce426f |
+ /* Special case for lo interface, the source address
|
|
|
ce426f |
+ being possibly different than the interface
|
|
|
ce426f |
+ address. */
|
|
|
ce426f |
+ if ((ntohl(sinp->sin_addr.s_addr) & 0xff000000)
|
|
|
ce426f |
+ == 0x7f000000)
|
|
|
ce426f |
+ tmp.addr[3] = htonl(0x7f000001);
|
|
|
ce426f |
+ else
|
|
|
ce426f |
+ tmp.addr[3] = sinp->sin_addr.s_addr;
|
|
|
ce426f |
}
|
|
|
ce426f |
else
|
|
|
ce426f |
{
|