diff options
author | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2000-07-25 04:52:56 +0000 |
---|---|---|
committer | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2000-07-25 04:52:56 +0000 |
commit | b3b6c54ec0a0fc8447c97f85c44d307e4f45ba76 (patch) | |
tree | d8a211445cb8dfafecbd2b1aa41d0c84b11daf8e /lib | |
parent | 7a9a7a202eb493090fb91a205a2c0122590086f9 (diff) |
document pitfall cases in argument parsing. sync with kame.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/net/getaddrinfo.3 | 67 |
1 files changed, 64 insertions, 3 deletions
diff --git a/lib/libc/net/getaddrinfo.3 b/lib/libc/net/getaddrinfo.3 index 9aac4c32c7e..bff0344848c 100644 --- a/lib/libc/net/getaddrinfo.3 +++ b/lib/libc/net/getaddrinfo.3 @@ -1,5 +1,5 @@ -.\" $OpenBSD: getaddrinfo.3,v 1.9 2000/06/30 16:52:44 itojun Exp $ -.\" $KAME: getaddrinfo.3,v 1.15 2000/06/30 16:46:00 itojun Exp $ +.\" $OpenBSD: getaddrinfo.3,v 1.10 2000/07/25 04:52:55 itojun Exp $ +.\" $KAME: getaddrinfo.3,v 1.21 2000/07/25 04:49:42 itojun Exp $ .\" .\" Copyright (c) 1983, 1987, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -251,6 +251,67 @@ is returned. This flag prevents any type of name resolution service (e.g., the DNS) from being called. .Pp +The arguments to +.Fn getaddrinfo +must sufficiently be consistent and unambiguous. +Here are pitfall cases you may encounter: +.Bl -bullet +.It +.Fn getaddrinfo +will raise error if members in +.Fa hints +structure is not consistent. +For example, for internet address families, +.Fn getaddrinfo +will raise error if you specify +.Dv SOCK_STREAM +to +.Fa ai_socktype +while you specify +.Dv IPPROTO_UDP +to +.Fa ai_protocol . +.It +If you specify a +.Fa servname +which is defined only for certain +.Fa ai_socktype , +.Fn getaddrinfo +will raise error because the arguments are not consistent. +For example, +.Fn getaddrinfo +will raise error if you ask for +.Dq Li tftp +service on +.Dv SOCK_STREAM . +.It +For internet address families, if you specify +.Fa servname +while you set +.Fa ai_socktype +to +.Dv SOCK_RAW , +.Fn getaddrinfo +will raise error, because service names are not defined for the internet +.Dv SOCK_RAW +space. +.It +If you specify numeric +.Fa servname , +while leaving +.Fa ai_socktype +and +.Fa ai_protocol +unspecified, +.Fn getaddrinfo +will raise error. +This is because the numeric +.Fa servname +does not identify any socket type, and +.Fn getaddrinfo +is not allowed to glob the argument in such case. +.El +.Pp All of the information returned by .Fn getaddrinfo is dynamically allocated: @@ -498,7 +559,7 @@ indicate an unknown error. .%A Atsushi Onoe .%T "An Extension of Format for IPv6 Scoped Addresses" .%R internet draft -.%N draft-ietf-ipngwg-scopedaddr-format-01.txt +.%N draft-ietf-ipngwg-scopedaddr-format-02.txt .%O work in progress material .Re .Rs |