Ubuntu

getaddrinfo fails with numerical IPv6 values

Reported by Sebastien Decugis on 2008-06-13
18
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GLibC
Fix Released
Unknown
Linux Mint
Undecided
Unassigned
glibc (Ubuntu)
Undecided
Unassigned

Bug Description

Binary package hint: libc6

The function "getaddrinfo" returns an error when it receives a numerical IPv6 value as hostname.

The following sample demonstrates the bug:
$ cat > bug.c <<EOF
#include <stdio.h>
#include <sys/socket.h>
#include <netdb.h>
const char * candidate="2001:db8::1";
int main(int argc, char * argv[])
{
 int ret=0;
 struct addrinfo *ai = NULL;
 ret = getaddrinfo(candidate, NULL, NULL, &ai);
 if (ai) freeaddrinfo(ai);
 if (ret != 0) printf("Error on '%s': %s.\n", candidate, gai_strerror(ret));
 return 0;
}
EOF
$ gcc -o bug bug.c
$ ./bug
Error on '2001:db8::1': Address family for hostname not supported.

I have tested the same code on a Debian Etch and the bug does not appear.

I am running a Ubuntu Hardy with latest updates. My libc6 package is 2.7-10ubuntu3.

$ lsb_release -rd
Description: Ubuntu 8.04
Release: 8.04

$ apt-cache policy libc6
libc6:
  Installed: 2.7-10ubuntu3
  Candidate: 2.7-10ubuntu3
  Version table:
 *** 2.7-10ubuntu3 0
        500 http://ubuntutym.u-toyama.ac.jp hardy/main Packages
        100 /var/lib/dpkg/status

Related branches

I just noticed this discussion: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=435646 which is most likely related to what I am seeing (I have no global IPv6 on my test machine). So maybe this is not a bug but a feature... hum...

Matthias Klose (doko) wrote :

this patch is applied in Ubuntu; Tollef, could you have a look at this one?

Changed in glibc:
status: New → Incomplete
Changed in glibc:
status: Unknown → New
Patrick (oc3an) wrote :

Still present in Jaunty!?

Looks like this is caused by the same (stupid) patch that is causing #374674.

AFAIK glibc2.9 no longer requires this patch as it implements a unified A/AAAA lookup mechanism. Upstream is no longer applying the patch to the best of my knowledge.

-Patrick

Patrick (oc3an) wrote :

This has been fixed in Thierry Carrez's PPA version of glibc6

https://launchpad.net/~ttx/+archive/ppa

-Patrick

Matthias Klose (doko) wrote :

eglibc (2.10.1-0ubuntu2) karmic; urgency=low

  * Merge with Debian (r3733, eglibc-2.10 branch).
  * Update to r8758 from the eglibc-2.10 branch.
  * Remove testcases from expected results, which don't fail anymore (ia64).
  * Mark test-memchr.out as failing on sparc.
  * patches/any/local-ipv6-lookup.diff: Don't apply. LP: #239701, #374674.
  * Work around Ubuntu buildd limitation: allow just 2.6.15 for libc6
    installation, although 2.6.18 is required for some patches (requested by
    soyuz maintainers).

 -- Matthias Klose < <email address hidden>> Tue, 04 Aug 2009 00:36:31 +0200

Changed in glibc (Ubuntu):
status: Incomplete → Fix Released
Laurent Bigonville (bigon) wrote :

Reopening as the patch has been reverted to fix bug #417757

Changed in glibc (Ubuntu):
status: Fix Released → New
Emmet Hikory (persia) on 2010-03-10
tags: added: ipv6
Changed in glibc:
status: New → Fix Released
Pavel Šimerda (pavlix-a) wrote :

This problem is described in https://fedoraproject.org/wiki/Networking/NameResolution/ADDRCONFIG#Problem_1:_Node-local_and_link-local_networking and is present in glibc. I would be very much interested in your fix if you actually have any.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.