From 457b559e2ec7bd66c6da9e99d27f0d1723da4874 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 24 Sep 2006 17:14:11 +0000 Subject: * 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. --- sysdeps/posix/getaddrinfo.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'sysdeps/posix/getaddrinfo.c') diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c index 185957be6a..dd5a57d9e0 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) -- cgit 1.4.1