aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/posix
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-09-24 17:14:11 +0000
committerUlrich Drepper <drepper@redhat.com>2006-09-24 17:14:11 +0000
commit457b559e2ec7bd66c6da9e99d27f0d1723da4874 (patch)
tree7cef3d8309f8ce3b683daeed319918a25ea03ce0 /sysdeps/posix
parent4a132246b1a34c6fe5d777a810e332236977e66a (diff)
downloadglibc-457b559e2ec7bd66c6da9e99d27f0d1723da4874.zip
glibc-457b559e2ec7bd66c6da9e99d27f0d1723da4874.tar.gz
glibc-457b559e2ec7bd66c6da9e99d27f0d1723da4874.tar.bz2
* sysdeps/posix/getaddrinfo.c (rfc3484_sort): Implement rule 4,
home addresses. * sysdeps/unix/sysv/linux/check_pf.c (make_request): Recognize IFA_F_HOMEADDRESS flag for interfaces. * include/ifaddrs.h (struct in6addrinfo): Define in6ai_homeaddress.
Diffstat (limited to 'sysdeps/posix')
-rw-r--r--sysdeps/posix/getaddrinfo.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 185957b..dd5a57d 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -1390,8 +1390,16 @@ rfc3484_sort (const void *p1, const void *p2)
return 1;
}
- /* Rule 4: Prefer home addresses.
- Another thing only the kernel can decide. */
+ /* Rule 4: Prefer home addresses. */
+ if (a1->got_source_addr)
+ {
+ if (!(a1->source_addr_flags & in6ai_homeaddress)
+ && (a2->source_addr_flags & in6ai_homeaddress))
+ return -1;
+ if ((a1->source_addr_flags & in6ai_homeaddress)
+ && !(a2->source_addr_flags & in6ai_homeaddress))
+ return 1;
+ }
/* Rule 5: Prefer matching label. */
if (a1->got_source_addr)