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

Bug#442157: marked as done (getaddrinfo() does not prefer IPv6 address over IPv4 one)



Your message dated Thu, 13 Sep 2007 17:58:43 +0200
with message-id <46E95E33.9040109@aurel32.net>
and subject line Bug#442157: getaddrinfo() does not prefer IPv6 address over IPv4 one
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--- Begin Message ---
Package: libc6
Version: 2.3.6.ds1-13
Severity: important

getaddrinfo() does not prefer IPv6 addresses, even though it should
according to RFC 3484.  I have debugged the issue and it all boils down
to match_prefix() in sysdeps/posix/getaddrinfo.c.  The prefix test runs
like this:

      while (bits > 8)
        {
          if (*mask != *val)
            break;

          ++mask;
	  ++val;
	  bits -= 8;
	}

      if (bits < 8)
        {
          if ((*mask & (0xff00 >> bits)) == (*val & (0xff00 >> bits)))
            /* Match!  */
	    break;
	}

Of course, for prefix lengths which are a multiple of 8 the loop ends
prematurely and the subsequent test returns 8, so there is never a match
for these lengths. Since the prefix for IPv4 addresses is 96 bits long
(see default_precedence), IPv4 addresses get the default priority (40)
and not the correct one (10). I was able to fix this by changing the
condition to:

      while (bits >= 8)

Since match_prefix() is used for labels as well, this bug probably also
breaks RFC 3484 rule 5 (Prefer matching label).

-- System Information:
Debian Release: 4.0
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.20.3
Locale: LANG=cs_CZ.UTF-8, LC_CTYPE=cs_CZ.UTF-8 (charmap=UTF-8)

Versions of packages libc6 depends on:
ii  tzdata                        2007b-1    Time Zone and Daylight Saving Time

libc6 recommends no packages.

-- no debconf information




--- End Message ---
--- Begin Message ---
Version: 2.4-1

Petr Tesarik a écrit :
> Package: libc6
> Version: 2.3.6.ds1-13
> Severity: important
> 
> getaddrinfo() does not prefer IPv6 addresses, even though it should
> according to RFC 3484.  I have debugged the issue and it all boils down
> to match_prefix() in sysdeps/posix/getaddrinfo.c.  The prefix test runs
> like this:
> 
>       while (bits > 8)
>         {
>           if (*mask != *val)
>             break;
> 
>           ++mask;
> 	  ++val;
> 	  bits -= 8;
> 	}
> 
>       if (bits < 8)
>         {
>           if ((*mask & (0xff00 >> bits)) == (*val & (0xff00 >> bits)))
>             /* Match!  */
> 	    break;
> 	}
> 
> Of course, for prefix lengths which are a multiple of 8 the loop ends
> prematurely and the subsequent test returns 8, so there is never a match
> for these lengths. Since the prefix for IPv4 addresses is 96 bits long
> (see default_precedence), IPv4 addresses get the default priority (40)
> and not the correct one (10). I was able to fix this by changing the
> condition to:
> 
>       while (bits >= 8)
> 
> Since match_prefix() is used for labels as well, this bug probably also
> breaks RFC 3484 rule 5 (Prefer matching label).
> 

This is fixed since glibc version 2.4-1.

-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32@debian.org         | aurelien@aurel32.net
   `-    people.debian.org/~aurel32 | www.aurel32.net


--- End Message ---

Reply to: