misc/120248: getaddrinfo() implementation on FreeBSD 7 is
incomplete, but no mention in manpage
Heiko Wundram
wundram at beenic.net
Mon Feb 4 01:40:01 PST 2008
>Number: 120248
>Category: misc
>Synopsis: getaddrinfo() implementation on FreeBSD 7 is incomplete, but no mention in manpage
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: doc-bug
>Submitter-Id: current-users
>Arrival-Date: Mon Feb 04 09:40:00 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator: Heiko Wundram
>Release: FreeBSD 7.0-PRERELEASE
>Organization:
Beenic Networks GmbH
>Environment:
FreeBSD phoenix.modelnine.org 7.0-PRERELEASE FreeBSD 7.0-PRERELEASE #0: Sat Feb 2 22:23:33 CET 2008 root at phoenix.modelnine.org:/usr/obj/usr/src/sys/HEIKO i386
>Description:
The getaddrinfo()-function as implemented in FreeBSD's libc is incomplete, as it is missing support for AI_ALL and AI_V4MAPPED. These flags are nevertheless documented in the manpage for the function, and no mention is given to the deficiency (because getaddrinfo() simply returns EAI_BADFLAGS, this is more than misleading).
The attached patch resolves the documentation bug.
>How-To-Repeat:
Compile and run the following test program:
---
#include <sys/socket.h>
#include <sys/types.h>
#include <netdb.h>
#include <netinet/in.h>
#include <stdio.h>
#include <string.h>
int main(int argc, char** argv)
{
struct addrinfo hints;
struct addrinfo* res;
int rv;
memset(&hints,0,sizeof(hints));
hints.ai_flags = AI_V4MAPPED;
hints.ai_family = AF_INET6;
hints.ai_socktype = SOCK_STREAM;
if( ( rv = getaddrinfo("www.kame.net","http",&hints,&res) ) ) {
printf("Error: %s.\n",gai_strerror(rv));
return 1;
}
printf("Got address(es)\n");
freeaddrinfo(res);
return 0;
}
---
This should print "Got address(es)," but instead prints "Error: Invalid value for ai_flags," which is non-conformant to the documentation.
>Fix:
See the attached patch to add documentation that the flags AI_V4MAPPED and AI_ALL aren't implemented.
Patch attached with submission follows:
--- /usr/src/lib/libc/net/getaddrinfo.3 2007-10-20 12:06:39.000000000 +0200
+++ man3/getaddrinfo.3 2008-02-04 10:22:31.000000000 +0100
@@ -493,3 +493,11 @@
specification and documented in
.Dv "RFC 3493" ,
.Dq Basic Socket Interface Extensions for IPv6 .
+.Sh BUGS
+The getaddrinfo function as implemented in FreeBSD currently does not support
+.Dv AI_ALL
+and
+.Dv AI_V4MAPPED ,
+and returns
+.Dv EAI_BADFLAGS
+if you specify one of them.
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list