Bug 120248

Summary: [patch] getaddrinfo() implementation on FreeBSD 7 is incomplete, but no mention in getaddrinfo.3
Product: Documentation Reporter: Heiko Wundram <wundram>
Component: Books & ArticlesAssignee: Daniel Gerzo <danger>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Heiko Wundram 2008-02-04 09:40:00 UTC
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.

Fix: See the attached patch to add documentation that the flags AI_V4MAPPED
and AI_ALL aren't implemented.

Patch attached with submission follows:
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.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2008-02-05 01:32:06 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-doc

Make this a docs PR and note patch.
Comment 2 dfilter service freebsd_committer freebsd_triage 2008-07-01 23:59:33 UTC
danger      2008-07-01 22:59:20 UTC

  FreeBSD src repository

  Modified files:
    lib/libc/net         getaddrinfo.3 
  Log:
  SVN rev 180162 on 2008-07-01 22:59:20Z by danger
  
  - AI_ALL and AI_V4MAPPED flags are currently not supported
  
  PR:             docs/120248
  Submitted by:   Heiko Wundram <wundram (a) beenic.net>
  
  Revision  Changes    Path
  1.34      +18 -1     src/lib/libc/net/getaddrinfo.3
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 3 Daniel Gerzo freebsd_committer freebsd_triage 2008-07-01 23:59:34 UTC
Responsible Changed
From-To: freebsd-doc->danger

Track
Comment 4 Daniel Gerzo freebsd_committer freebsd_triage 2008-07-01 23:59:50 UTC
State Changed
From-To: open->patched

I have committed slightly modified diff, however thank you for your 
submission!
Comment 5 dfilter service freebsd_committer freebsd_triage 2009-01-06 13:09:34 UTC
Author: danger (doc committer)
Date: Tue Jan  6 13:09:19 2009
New Revision: 186818
URL: http://svn.freebsd.org/changeset/base/186818

Log:
  MFC r180162:
  
  - AI_ALL and AI_V4MAPPED flags are currently not supported
  
  PR:		docs/120248
  Submitted by:	Heiko Wundram <wundram (a) beenic.net>

Modified:
  stable/7/lib/libc/   (props changed)
  stable/7/lib/libc/net/getaddrinfo.3
  stable/7/lib/libc/string/ffsll.c   (props changed)
  stable/7/lib/libc/string/flsll.c   (props changed)

Modified: stable/7/lib/libc/net/getaddrinfo.3
==============================================================================
--- stable/7/lib/libc/net/getaddrinfo.3	Tue Jan  6 13:05:58 2009	(r186817)
+++ stable/7/lib/libc/net/getaddrinfo.3	Tue Jan  6 13:09:19 2009	(r186818)
@@ -18,7 +18,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 6, 2007
+.Dd July 1, 2008
 .Dt GETADDRINFO 3
 .Os
 .Sh NAME
@@ -237,6 +237,11 @@ flag shall be ignored unless
 .Fa ai_family
 equals
 .Dv AF_INET6 .
+Note: this flag is currently
+.Em not
+supported, see the
+.Sx BUGS
+section.
 .El
 .El
 .Pp
@@ -485,6 +490,18 @@ freeaddrinfo(res0);
 .%B "Proceedings of the freenix track: 2000 USENIX annual technical conference"
 .%D June 2000
 .Re
+.Sh BUGS
+The
+.Nm
+function as implemented in
+.Fx
+currently does not support
+.Dv AI_ALL
+and
+.Dv AI_V4MAPPED
+flags and returns
+.Dv EAI_BADFLAGS
+if one of them is specified.
 .Sh STANDARDS
 The
 .Fn getaddrinfo
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 6 Daniel Gerzo freebsd_committer freebsd_triage 2009-01-06 13:12:31 UTC
State Changed
From-To: patched->closed

now documented in both stable/6 and stable/7
Comment 7 dfilter service freebsd_committer freebsd_triage 2009-01-06 13:12:41 UTC
Author: danger (doc committer)
Date: Tue Jan  6 13:12:26 2009
New Revision: 186820
URL: http://svn.freebsd.org/changeset/base/186820

Log:
  MFC r180162:
  
  - AI_ALL and AI_V4MAPPED flags are currently not supported
  
  PR:		docs/120248
  Submitted by:	Heiko Wundram <wundram (a) beenic.net>

Modified:
  stable/6/lib/libc/   (props changed)
  stable/6/lib/libc/inet/inet_net_pton.c   (props changed)
  stable/6/lib/libc/net/getaddrinfo.3
  stable/6/lib/libc/sys/   (props changed)

Modified: stable/6/lib/libc/net/getaddrinfo.3
==============================================================================
--- stable/6/lib/libc/net/getaddrinfo.3	Tue Jan  6 13:10:15 2009	(r186819)
+++ stable/6/lib/libc/net/getaddrinfo.3	Tue Jan  6 13:12:26 2009	(r186820)
@@ -18,7 +18,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 6, 2007
+.Dd July 1, 2008
 .Dt GETADDRINFO 3
 .Os
 .Sh NAME
@@ -237,6 +237,11 @@ flag shall be ignored unless
 .Fa ai_family
 equals
 .Dv AF_INET6 .
+Note: this flag is currently
+.Em not
+supported, see the
+.Sx BUGS
+section.
 .El
 .El
 .Pp
@@ -485,6 +490,18 @@ freeaddrinfo(res0);
 .%B "Proceedings of the freenix track: 2000 USENIX annual technical conference"
 .%D June 2000
 .Re
+.Sh BUGS
+The
+.Nm
+function as implemented in
+.Fx
+currently does not support
+.Dv AI_ALL
+and
+.Dv AI_V4MAPPED
+flags and returns
+.Dv EAI_BADFLAGS
+if one of them is specified.
 .Sh STANDARDS
 The
 .Fn getaddrinfo
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"