[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#435646: libc6: resolver considers IPv6 enabled when any IPv6 address is configured



On Thu, 2007-08-02 at 12:30 +0200, Aurelien Jarno wrote:
> 
> I have already been given the link to this patch. It sounds reasonable,
> but first I would like to know if it is in use on more than one machine,
> for both IPv4 and IPv4 + IPv6 setups?
> 
> I don't really want to apply a patch that can cause regressions.

Indeed not!

I have built current libc6 from source, and applied the patch.  It
didn't apply cleanly, and I looked at the bit that didn't apply and
decided that not applying that particular part was correct...

I attach an updated patch, which *does* apply cleanly to the current
libc6 packages :-)

I have tested this on my laptop, as follows:

With IPv6 Fully Working
=======================
Enable query logging on my DNS
Start iceweasel

Browse to www.kame.net
Observe that there is an AAAA query for www.kame.net before any A query
and the turtle moves.

Browse to ipv4.generic.website
Observe that there is an AAAA query, with negative response, followed by
an A query, which gets a v4 address.


With IPv6 Presnt, but only localhost and link local addresses
=============================================================
Enable query logging on my DNS
Start iceweasel

Browse to www.kame.net
Observe that there is only an A query, and that the turtle does not
move.

Browse to ipv4.generic.website
Observe that there is only an A query, which gets a v4 address.

Browse to ipv6.geek.nz (there is no A record for this domain).
Observe that there is only an A query, and we get the "host not found"
page in Iceweasel.


I don't have access to any IPv4 boxes at present, but if I disable all
IPv6 addresses (including the loopback and link-local addresses) I see
the same behaviour as when only loopback and link-local addresses are
present above.


I've got someone else who will test this in a couple more environments,
but I guess it would be nice to find some more volunteers :-)

Regards,
					Andrew McMillan.

-------------------------------------------------------------------------
Andrew @ Catalyst .Net .NZ  Ltd,  PO Box 11-053, Manners St,  Wellington
WEB: http://catalyst.net.nz/            PHYS: Level 2, 150-154 Willis St
DDI: +64(4)803-2201      MOB: +64(272)DEBIAN      OFFICE: +64(4)499-2267
                Day of inquiry.  You will be subpoenaed.
-------------------------------------------------------------------------

diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index adb3c4f..d12835c 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -263,7 +263,7 @@ extern service_user *__nss_hosts_database attribute_hidden;
 static int
 gaih_inet (const char *name, const struct gaih_service *service,
 	   const struct addrinfo *req, struct addrinfo **pai,
-	   unsigned int *naddrs)
+	   unsigned int *naddrs, bool usable_ipv6)
 {
   const struct gaih_typeproto *tp = gaih_inet_typeproto;
   struct gaih_servtuple *st = (struct gaih_servtuple *) &nullserv;
@@ -706,7 +706,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
 	      if (fct != NULL)
 		{
 		  if (req->ai_family == AF_INET6
-		      || req->ai_family == AF_UNSPEC)
+		      || (req->ai_family == AF_UNSPEC && usable_ipv6))
 		    {
 		      gethosts (AF_INET6, struct in6_addr);
 		      no_inet6_data = no_data;
@@ -1903,7 +1903,7 @@ getaddrinfo (const char *name, const char *service,
   if (hints->ai_family == AF_UNSPEC || hints->ai_family == AF_INET
       || hints->ai_family == AF_INET6)
     {
-      last_i = gaih_inet (name, pservice, hints, end, &naddrs);
+      last_i = gaih_inet (name, pservice, hints, end, &naddrs, seen_ipv6);
       if (last_i != 0)
 	{
 	  freeaddrinfo (p);
diff --git a/sysdeps/unix/sysv/linux/check_pf.c b/sysdeps/unix/sysv/linux/check_pf.c
index 46161a8..5287ed0 100644
--- a/sysdeps/unix/sysv/linux/check_pf.c
+++ b/sysdeps/unix/sysv/linux/check_pf.c
@@ -146,7 +146,10 @@ make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6,
 		  *seen_ipv4 = true;
 		  break;
 		case AF_INET6:
-		  *seen_ipv6 = true;
+		  if (ifam->ifa_scope < RT_SCOPE_LINK)
+		    {
+		      *seen_ipv6 = true;
+		    }
 
 		  if (ifam->ifa_flags & (IFA_F_DEPRECATED
 					 | IFA_F_TEMPORARY

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: