summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoritojun <>2000-07-25 04:52:55 +0000
committeritojun <>2000-07-25 04:52:55 +0000
commit6afa76b65a3aa2af4e29d09a0e9e05488ca45fe0 (patch)
tree2ae4cc5ac3c9cd944db078ffd952c13cfd0f140c
parent54c97ce0436f95932c9da449373d9cddbdef8aba (diff)
downloadopenbsd-6afa76b65a3aa2af4e29d09a0e9e05488ca45fe0.tar.gz
openbsd-6afa76b65a3aa2af4e29d09a0e9e05488ca45fe0.tar.bz2
openbsd-6afa76b65a3aa2af4e29d09a0e9e05488ca45fe0.zip
document pitfall cases in argument parsing. sync with kame.
-rw-r--r--src/lib/libc/net/getaddrinfo.367
1 files changed, 64 insertions, 3 deletions
diff --git a/src/lib/libc/net/getaddrinfo.3 b/src/lib/libc/net/getaddrinfo.3
index 9aac4c32c7..bff0344848 100644
--- a/src/lib/libc/net/getaddrinfo.3
+++ b/src/lib/libc/net/getaddrinfo.3
@@ -1,5 +1,5 @@
1.\" $OpenBSD: getaddrinfo.3,v 1.9 2000/06/30 16:52:44 itojun Exp $ 1.\" $OpenBSD: getaddrinfo.3,v 1.10 2000/07/25 04:52:55 itojun Exp $
2.\" $KAME: getaddrinfo.3,v 1.15 2000/06/30 16:46:00 itojun Exp $ 2.\" $KAME: getaddrinfo.3,v 1.21 2000/07/25 04:49:42 itojun Exp $
3.\" 3.\"
4.\" Copyright (c) 1983, 1987, 1991, 1993 4.\" Copyright (c) 1983, 1987, 1991, 1993
5.\" The Regents of the University of California. All rights reserved. 5.\" The Regents of the University of California. All rights reserved.
@@ -251,6 +251,67 @@ is returned.
251This flag prevents any type of name resolution service (e.g., the DNS) 251This flag prevents any type of name resolution service (e.g., the DNS)
252from being called. 252from being called.
253.Pp 253.Pp
254The arguments to
255.Fn getaddrinfo
256must sufficiently be consistent and unambiguous.
257Here are pitfall cases you may encounter:
258.Bl -bullet
259.It
260.Fn getaddrinfo
261will raise error if members in
262.Fa hints
263structure is not consistent.
264For example, for internet address families,
265.Fn getaddrinfo
266will raise error if you specify
267.Dv SOCK_STREAM
268to
269.Fa ai_socktype
270while you specify
271.Dv IPPROTO_UDP
272to
273.Fa ai_protocol .
274.It
275If you specify a
276.Fa servname
277which is defined only for certain
278.Fa ai_socktype ,
279.Fn getaddrinfo
280will raise error because the arguments are not consistent.
281For example,
282.Fn getaddrinfo
283will raise error if you ask for
284.Dq Li tftp
285service on
286.Dv SOCK_STREAM .
287.It
288For internet address families, if you specify
289.Fa servname
290while you set
291.Fa ai_socktype
292to
293.Dv SOCK_RAW ,
294.Fn getaddrinfo
295will raise error, because service names are not defined for the internet
296.Dv SOCK_RAW
297space.
298.It
299If you specify numeric
300.Fa servname ,
301while leaving
302.Fa ai_socktype
303and
304.Fa ai_protocol
305unspecified,
306.Fn getaddrinfo
307will raise error.
308This is because the numeric
309.Fa servname
310does not identify any socket type, and
311.Fn getaddrinfo
312is not allowed to glob the argument in such case.
313.El
314.Pp
254All of the information returned by 315All of the information returned by
255.Fn getaddrinfo 316.Fn getaddrinfo
256is dynamically allocated: 317is dynamically allocated:
@@ -498,7 +559,7 @@ indicate an unknown error.
498.%A Atsushi Onoe 559.%A Atsushi Onoe
499.%T "An Extension of Format for IPv6 Scoped Addresses" 560.%T "An Extension of Format for IPv6 Scoped Addresses"
500.%R internet draft 561.%R internet draft
501.%N draft-ietf-ipngwg-scopedaddr-format-01.txt 562.%N draft-ietf-ipngwg-scopedaddr-format-02.txt
502.%O work in progress material 563.%O work in progress material
503.Re 564.Re
504.Rs 565.Rs