getaddrinfo fails with numerical IPv6 values

Bug #239701 reported by Sebastien Decugis
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fix Released
Linux Mint
glibc (Ubuntu)

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;
$ 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
  Installed: 2.7-10ubuntu3
  Candidate: 2.7-10ubuntu3
  Version table:
 *** 2.7-10ubuntu3 0
        500 hardy/main Packages
        100 /var/lib/dpkg/status

Related branches

Revision history for this message
Sebastien Decugis (sdecugis-nict) wrote :

I just noticed this discussion: 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...

Revision history for this message
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
Revision history for this message
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.


Revision history for this message
Patrick (oc3an) wrote :

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


Revision history for this message
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
Revision history for this message
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)
tags: added: ipv6
Changed in glibc:
status: New → Fix Released
Revision history for this message
Pavel Šimerda (pavlix-a) wrote :

This problem is described in and is present in glibc. I would be very much interested in your fix if you actually have any.

Revision history for this message
chemicalfan (mike-lumsden) wrote :

Does this bug apply to any of the currently supported releases (i.e. Maya/12.04, Petra/13.10 or Qiana/14.04)? If not, this bug should be closed.

Changed in linuxmint:
status: New → Invalid
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.