[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commits] r2539 - in /fsf/trunk/libc: ChangeLog sysdeps/unix/sysv/linux/check_pf.c
- To: commits@xxxxxxxxxx
- Subject: [commits] r2539 - in /fsf/trunk/libc: ChangeLog sysdeps/unix/sysv/linux/check_pf.c
- From: eglibc@xxxxxxxxxx
- Date: Sun, 17 Jun 2007 07:02:39 -0000
Author: eglibc
Date: Sun Jun 17 00:02:36 2007
New Revision: 2539
Log:
Import glibc-mainline for 2007-06-17
Modified:
fsf/trunk/libc/ChangeLog
fsf/trunk/libc/sysdeps/unix/sysv/linux/check_pf.c
Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Sun Jun 17 00:02:36 2007
@@ -1,3 +1,10 @@
+2007-06-16 Ulrich Drepper <drepper@xxxxxxxxxx>
+
+ [BZ #4599]
+ * sysdeps/unix/sysv/linux/check_pf.c (make_request): When
+ determining whether there are IPv4/IPv6 addresses, ignore loopback
+ addresses.
+
2007-06-14 Uros Bizjak <ubizjak@xxxxxxxxx>
* soft-fp/soft-fp.h (CMPtype): Define to "int" if undefined.
Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/check_pf.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/check_pf.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/check_pf.c Sun Jun 17 00:02:36 2007
@@ -139,40 +139,72 @@
if (nlmh->nlmsg_type == RTM_NEWADDR)
{
struct ifaddrmsg *ifam = (struct ifaddrmsg *) NLMSG_DATA (nlmh);
+ struct rtattr *rta = IFA_RTA (ifam);
+ size_t len = nlmh->nlmsg_len - NLMSG_LENGTH (sizeof (*ifam));
switch (ifam->ifa_family)
{
+ const void *local;
+ const void *address;
+
case AF_INET:
- *seen_ipv4 = true;
+ 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_v4;
+ }
+
+ rta = RTA_NEXT (rta, len);
+ }
+
+ if (local != NULL)
+ {
+ out_v4:
+ if (*(const in_addr_t *) (address ?: local)
+ != htonl (INADDR_LOOPBACK))
+ *seen_ipv4 = true;
+ }
break;
+
case AF_INET6:
- *seen_ipv6 = true;
+ 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)
+ {
+ out_v6:
+ if (!IN6_IS_ADDR_LOOPBACK (address ?: local))
+ *seen_ipv6 = true;
+ }
if (ifam->ifa_flags & (IFA_F_DEPRECATED
| IFA_F_TEMPORARY
| IFA_F_HOMEADDRESS))
{
- struct rtattr *rta = IFA_RTA (ifam);
- size_t len = (nlmh->nlmsg_len
- - NLMSG_LENGTH (sizeof (*ifam)));
- void *local = NULL;
- void *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);
- break;
- }
-
- rta = RTA_NEXT (rta, len);
- }
-
struct in6ailist *newp = alloca (sizeof (*newp));
newp->info.flags = (((ifam->ifa_flags & IFA_F_DEPRECATED)
? in6ai_deprecated : 0)
@@ -203,7 +235,7 @@
close_not_cancel_no_status (fd);
- if (in6ailist != NULL)
+ if (*seen_ipv6 && in6ailist != NULL)
{
*in6ai = malloc (in6ailistlen * sizeof (**in6ai));
if (*in6ai == NULL)