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