standards/114910: getaddrinfo() fails to set ai_canonname
Mark Andrews
marka at isc.org
Wed Jul 25 20:20:02 UTC 2007
>Number: 114910
>Category: standards
>Synopsis: getaddrinfo() fails to set ai_canonname
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-standards
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed Jul 25 20:20:02 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator: Mark Andrews
>Release: FreeBSD 6.2-STABLE i386
>Organization:
ISC
>Environment:
System: FreeBSD drugs.dv.isc.org 6.2-STABLE FreeBSD 6.2-STABLE #16: Fri Apr 27 13:32:57 EST 2007 marka at drugs.dv.isc.org:/usr/obj/usr/src/sys/DRUGS i386
>Description:
getaddrinfo() fails to set ai->ai_canonname when requested.
>How-To-Repeat:
Run the following. It will fail one time in two, I suspect that
it is related to the AAAA address and their return order.
flag.ep.net. 167913 IN A 198.32.4.13
flag.ep.net. 81490 IN AAAA 2001:478:6:0:2d0:b7ff:fee8:c4d9
flag.ep.net. 81490 IN AAAA 3ffe:805::2d0:b7ff:fee8:c4d9
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <stdio.h>
int
main () {
struct addrinfo hints, *ai = NULL, *cur;
int result;
memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_CANONNAME;
hints.ai_family = PF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = 0;
result = getaddrinfo("FLAG.EP.NET", NULL, &hints, &ai);
if ((result && ai) || (result == 0 && (ai == NULL || ai->ai_canonname == NULL)))
fprintf(stderr, "getaddrinfo %d %p %p\n", result, ai, ai?ai->ai_canonname:NULL);
exit(0);
};
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-standards
mailing list