diff --git a/man3/getaddrinfo.3 b/man3/getaddrinfo.3 index 06ac5c7c0..0b4d34c35 100644 --- a/man3/getaddrinfo.3 +++ b/man3/getaddrinfo.3 @@ -21,6 +21,10 @@ .\" the source, must acknowledge the copyright and authors of this work. .\" .\" References: RFC 2553 +.\" +.\" 2005-08-09, mtk, added AI_ALL, AI_ADDRCONFIG, AI_V4MAPPED, +.\" and AI_NUMERICSERV. +.\" .TH getaddrinfo 3 2000-12-18 "Linux Man Page" "Linux Programmer's Manual" .SH NAME getaddrinfo, freeaddrinfo, gai_strerror \- network address and service translation @@ -116,9 +120,9 @@ function returns socket addresses in either IPv4 or IPv6 address family, .RI "(" "ai_family" will be set to either -.B PF_INET +.B AF_INET or -.BR PF_INET6 ). +.BR AF_INET6 ). .PP The .I hints @@ -127,9 +131,7 @@ the preferred socket type, or protocol. A NULL .I hints specifies that any network address or protocol is acceptable. -If this parameter is not -.B NULL -it points to an +If this parameter is not NULL it points to an .B addrinfo structure whose @@ -138,7 +140,7 @@ whose and .I ai_protocol members specify the preferred socket type. -.B PF_UNSPEC +.B AF_UNSPEC in .I ai_family specifies any protocol family (either IPv4 or IPv6, for example). @@ -165,11 +167,9 @@ parameter, but not both, may be NULL. specifies either a numerical network address (dotted-decimal format for IPv4, hexadecimal format for IPv6) or a network hostname, whose network addresses are looked up and resolved. -If the -.I ai_flags -member in the -.I hints -parameter contains the +If +.I hints.ai_flags +contains the .B AI_NUMERICHOST flag then the .I node @@ -191,9 +191,7 @@ The field of the first of these .B addrinfo structures is set to point to the official name of the host, if -.I ai_flags -in -.I hints +.I hints.ai_flags includes the .B AI_CANONNAME flag. @@ -219,11 +217,8 @@ is NULL, the network address in each socket structure is initialized according to the .B AI_PASSIVE -flag, which is set in the -.I ai_flags -member of the -.I hints -parameter. +flag, which is set in +.IR hints.ai_flags . The network address in each socket structure will be left unspecified if .B AI_PASSIVE @@ -237,11 +232,57 @@ flag is not set. This is used by client applications, which intend to connect to a server running on the same network host. .PP +If +.I hints.ai_flags +includes the +.B AI_ADDRCONFIG +flag, then IPv4 addresses are returned in the list pointed to by +.I result +only if the local system has at least has at least one +IPv4 address configured, and IPv6 addresses are only returned +if the local system has at least one IPv6 address configured. +.PP +If +.I hint.ai_flags +specifies the +.B AI_V4MAPPED +flag, and +.I hints.ai_family +was specified as +.BR AF_INET6 , +and no matching IPv6 addresses could be found, +then return IPv4-mapped IPv6 addresses in the list pointed to by +.IR result . +If both +.B AI_V4MAPPED +and +.B AI_ALL +are specified in +.IR hints.ai_family , +then return both IPv6 and IPv4-mapped IPv6 addresses +in the list pointed to by +.IR result . +.B AI_ALL +is ignored if +.B AI_V4MAPPED +is not also specified. +.PP .I service sets the port number in the network address of each socket structure. If .I service is NULL the port number will be left uninitialized. +If +.B AI_NUMERICSERV +is specified in +.IR hints.ai_flags +and +.I service +is not NULL, then +.I service +must point to a string containing a numeric port number. +This flag is used to inhibit the invocation of a name resolution service +in cases where it is known not to be required. .PP The .BR freeaddrinfo (3) @@ -267,12 +308,17 @@ The .I node or .I service -is not known. -This error is also returned if both +is not known; or both .I node and .I service -are NULL. +are NULL; or +.B AI_NUMERICSERV +was specified in +.I hints.ai_flags +and +.I service +was not a numeric port-number string. .TP .B EAI_SERVICE The requested service is not available for the requested socket type. @@ -310,6 +356,14 @@ POSIX 1003.1-2003. The .B getaddrinfo() function is documented in RFC\ 2553. +.SH "NOTES" +.BR AI_ADDRCONFIG , +.BR AI_ALL, +and +.BR AI_V4MAPPED +are available since glibc 2.3.3. +.BR AI_NUMERICSERV +is available since glibc 2.3.4. .SH "SEE ALSO" .BR getipnodebyaddr (3), .BR getipnodebyname (3)