Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Jul 2007 06:12:25 +1000 (EST)
From:      Mark Andrews <marka@isc.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   standards/114910: getaddrinfo() fails to set ai_canonname
Message-ID:  <200707252012.l6PKCP9d047284@drugs.dv.isc.org>
Resent-Message-ID: <200707252020.l6PKK2J8025380@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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@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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200707252012.l6PKCP9d047284>