r2811 - glibc-package/trunk/debian/patches/any
Author: aurel32
Date: 2008-02-12 21:52:09 +0000 (Tue, 12 Feb 2008)
New Revision: 2811
Modified:
glibc-package/trunk/debian/patches/any/cvs-rfc3484.diff
Log:
Add missing parts
Modified: glibc-package/trunk/debian/patches/any/cvs-rfc3484.diff
===================================================================
--- glibc-package/trunk/debian/patches/any/cvs-rfc3484.diff 2008-02-12 21:37:08 UTC (rev 2810)
+++ glibc-package/trunk/debian/patches/any/cvs-rfc3484.diff 2008-02-12 21:52:09 UTC (rev 2811)
@@ -1,5 +1,8 @@
2007-11-12 Ulrich Drepper <drepper@redhat.com>
+ * include/ifaddrs.c (struct in6addrinfo): Add prefixlen field.
+ * sysdeps/unix/sysv/linux/check_pf.c (make_request): Always return
+ list of interfaces. Also store prefix length.
* sysdeps/posix/getaddrinfo.c (sort_result): Add prefixlen element.
(rfc3484_sort): In rule 9, for IPv4 addresses count only matching
prefix if source and destination address are in the same subnet.
@@ -260,3 +263,171 @@
}
}
else if (errno == EAFNOSUPPORT && af == AF_INET6
+===================================================================
+RCS file: /cvs/glibc/libc/include/ifaddrs.h,v
+retrieving revision 1.5
+retrieving revision 1.6
+diff -u -r1.5 -r1.6
+--- libc/include/ifaddrs.h 2006/09/24 16:49:19 1.5
++++ libc/include/ifaddrs.h 2007/11/12 23:55:15 1.6
+@@ -12,7 +12,9 @@
+ in6ai_deprecated = 1,
+ in6ai_temporary = 2,
+ in6ai_homeaddress = 4
+- } flags;
++ } flags:8;
++ uint8_t prefixlen;
++ uint16_t :16;
+ uint32_t addr[4];
+ };
+
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/check_pf.c,v
+retrieving revision 1.12
+retrieving revision 1.13
+diff -u -r1.12 -r1.13
+--- libc/sysdeps/unix/sysv/linux/check_pf.c 2007/08/29 16:49:45 1.12
++++ libc/sysdeps/unix/sysv/linux/check_pf.c 2007/11/12 23:55:31 1.13
+@@ -145,92 +145,69 @@
+ struct rtattr *rta = IFA_RTA (ifam);
+ size_t len = nlmh->nlmsg_len - NLMSG_LENGTH (sizeof (*ifam));
+
+- switch (ifam->ifa_family)
++ if (ifam->ifa_family != AF_INET
++ && ifam->ifa_family != AF_INET6)
++ continue;
++
++ const void *local = NULL;
++ const void *address = NULL;
++ while (RTA_OK (rta, len))
+ {
+- const void *local;
+- const void *address;
+-
+- case AF_INET:
+- local = NULL;
+- address = NULL;
+- while (RTA_OK (rta, len))
++ switch (rta->rta_type)
+ {
+- switch (rta->rta_type)
+- {
+- case IFA_LOCAL:
+- local = RTA_DATA (rta);
+- break;
+-
+- case IFA_ADDRESS:
+- address = RTA_DATA (rta);
+- goto out_v4;
+- }
+-
+- rta = RTA_NEXT (rta, len);
++ case IFA_LOCAL:
++ local = RTA_DATA (rta);
++ break;
++
++ case IFA_ADDRESS:
++ address = RTA_DATA (rta);
++ goto out;
+ }
+
+- if (local != NULL)
++ rta = RTA_NEXT (rta, len);
++ }
++
++ if (local != NULL)
++ {
++ address = local;
++ out:
++ if (ifam->ifa_family != AF_INET)
+ {
+- out_v4:
+- if (*(const in_addr_t *) (address ?: local)
++ if (*(const in_addr_t *) address
+ != htonl (INADDR_LOOPBACK))
+ *seen_ipv4 = true;
+ }
+- break;
+-
+- case AF_INET6:
+- local = NULL;
+- address = NULL;
+- while (RTA_OK (rta, len))
+- {
+- switch (rta->rta_type)
+- {
+- case IFA_LOCAL:
+- local = RTA_DATA (rta);
+- break;
+-
+- case IFA_ADDRESS:
+- address = RTA_DATA (rta);
+- goto out_v6;
+- }
+-
+- rta = RTA_NEXT (rta, len);
+- }
+-
+- if (local != NULL)
++ else
+ {
+- out_v6:
+- if (!IN6_IS_ADDR_LOOPBACK (address ?: local))
++ if (!IN6_IS_ADDR_LOOPBACK (address))
+ *seen_ipv6 = true;
+ }
++ }
+
+- if (ifam->ifa_flags & (IFA_F_DEPRECATED
+- | IFA_F_TEMPORARY
+- | IFA_F_HOMEADDRESS
+- | IFA_F_OPTIMISTIC))
+- {
+- struct in6ailist *newp = alloca (sizeof (*newp));
+- newp->info.flags = (((ifam->ifa_flags
+- & (IFA_F_DEPRECATED
+- | IFA_F_OPTIMISTIC))
+- ? in6ai_deprecated : 0)
+- | ((ifam->ifa_flags
+- & IFA_F_TEMPORARY)
+- ? in6ai_temporary : 0)
+- | ((ifam->ifa_flags
+- & IFA_F_HOMEADDRESS)
+- ? in6ai_homeaddress : 0));
+- memcpy (newp->info.addr, address ?: local,
+- sizeof (newp->info.addr));
+- newp->next = in6ailist;
+- in6ailist = newp;
+- ++in6ailistlen;
+- }
+- break;
+- default:
+- /* Ignore. */
+- break;
++ struct in6ailist *newp = alloca (sizeof (*newp));
++ newp->info.flags = (((ifam->ifa_flags
++ & (IFA_F_DEPRECATED
++ | IFA_F_OPTIMISTIC))
++ ? in6ai_deprecated : 0)
++ | ((ifam->ifa_flags
++ & IFA_F_TEMPORARY)
++ ? in6ai_temporary : 0)
++ | ((ifam->ifa_flags
++ & IFA_F_HOMEADDRESS)
++ ? in6ai_homeaddress : 0));
++ newp->info.prefixlen = ifam->ifa_prefixlen;
++ if (ifam->ifa_family == AF_INET)
++ {
++ newp->info.addr[0] = 0;
++ newp->info.addr[1] = 0;
++ newp->info.addr[2] = htonl (0xffff);
++ newp->info.addr[3] = *(const in_addr_t *) address;
+ }
++ else
++ memcpy (newp->info.addr, address, sizeof (newp->info.addr));
++ newp->next = in6ailist;
++ in6ailist = newp;
++ ++in6ailistlen;
+ }
+ else if (nlmh->nlmsg_type == NLMSG_DONE)
+ /* We found the end, leave the loop. */
Reply to: