getaddrinfo bug: hosts without A rekords
Artur Frysiak
wiget@pld.org.pl
Thu Dec 2 07:56:00 GMT 1999
>Submitter-Id: net
>Originator: Artur Frysiak
>Organization: PLD
>Confidential: no
>Synopsis: getaddrinfo don't return AAAA rekord is host not have A rekords
>Severity: serious
>Priority: medium
>Category: libc
>Class: sw-bug
>Release: libc-2.1.2
>Environment:
i686-pld-linux-gnu
glibc 2.1.2 with lates patches for getaddrinfo.c and dns-host.c
obtained via cvsweb
Host type: i686-pld-linux-gnu
System: Linux wiget 2.2.13 #1 sob Nov 27 11:51:29 CET 1999 i686 pld
Architecture: i686
Addons: crypt linuxthreads
Build CFLAGS: -O2 -Wall -Winline -Wstrict-prototypes -Wwrite-strings -mpentiumpro
Build CC: gcc
Compiler version: 2.95.2 19991024 (release)
Kernel headers: 2.2.13
Symbol versioning: yes
Build static: yes
Build shared: yes
Build pic-default: no
Build profile: yes
Build omitfp: no
Build bounded: no
Build static-nss: no
Stdio: libio
>Description:
getaddrinfo returns "No address associated with hostname" if host have AAAA
rekords but don't have A rekords.
>How-To-Repeat:
Run this test program:
------ cut ------
/*
* wiget@wiget wiget$ host -t any wiget.ipv6.t17.dhs.org.
* wiget.ipv6.t17.dhs.org mail is handled (pri=10) by wiget.ipv6.t17.dhs.org
* wiget.ipv6.t17.dhs.org mail is handled (pri=20) by wiget.t17.dhs.org
* wiget.ipv6.t17.dhs.org host information Intel/Pentium75 Linux 2.2
* wiget.ipv6.t17.dhs.org IPv6 address 3ffe:902:11:17::1:10
*
*/
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
int main()
{
struct addrinfo hints, *ai, *aitop;
int gaierr;
char addr[100];
memset(&hints, 0, sizeof(hints));
hints.ai_family = PF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
if ((gaierr = getaddrinfo("wiget.ipv6.t17.dhs.org", "54321", &hints, &aitop)) != 0) {
printf("Error\t%s\n", gai_strerror(gaierr));
exit(1);
}
for (ai = aitop; ai; ai = ai->ai_next) {
if (ai->ai_family == AF_UNIX)
continue;
getnameinfo(ai->ai_addr, ai->ai_addrlen, addr, sizeof(addr),
NULL, 0, NI_NUMERICHOST);
printf("Returned address:\t%s\n", addr);
}
freeaddrinfo(aitop);
}
------ cut ------
wiget@wiget wiget$ ./gtest
Error No address associated with hostname
>Fix:
More information about the Libc-alpha
mailing list