diff options
author | itojun <> | 2000-07-25 04:52:55 +0000 |
---|---|---|
committer | itojun <> | 2000-07-25 04:52:55 +0000 |
commit | 6afa76b65a3aa2af4e29d09a0e9e05488ca45fe0 (patch) | |
tree | 2ae4cc5ac3c9cd944db078ffd952c13cfd0f140c | |
parent | 54c97ce0436f95932c9da449373d9cddbdef8aba (diff) | |
download | openbsd-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.3 | 67 |
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. | |||
251 | This flag prevents any type of name resolution service (e.g., the DNS) | 251 | This flag prevents any type of name resolution service (e.g., the DNS) |
252 | from being called. | 252 | from being called. |
253 | .Pp | 253 | .Pp |
254 | The arguments to | ||
255 | .Fn getaddrinfo | ||
256 | must sufficiently be consistent and unambiguous. | ||
257 | Here are pitfall cases you may encounter: | ||
258 | .Bl -bullet | ||
259 | .It | ||
260 | .Fn getaddrinfo | ||
261 | will raise error if members in | ||
262 | .Fa hints | ||
263 | structure is not consistent. | ||
264 | For example, for internet address families, | ||
265 | .Fn getaddrinfo | ||
266 | will raise error if you specify | ||
267 | .Dv SOCK_STREAM | ||
268 | to | ||
269 | .Fa ai_socktype | ||
270 | while you specify | ||
271 | .Dv IPPROTO_UDP | ||
272 | to | ||
273 | .Fa ai_protocol . | ||
274 | .It | ||
275 | If you specify a | ||
276 | .Fa servname | ||
277 | which is defined only for certain | ||
278 | .Fa ai_socktype , | ||
279 | .Fn getaddrinfo | ||
280 | will raise error because the arguments are not consistent. | ||
281 | For example, | ||
282 | .Fn getaddrinfo | ||
283 | will raise error if you ask for | ||
284 | .Dq Li tftp | ||
285 | service on | ||
286 | .Dv SOCK_STREAM . | ||
287 | .It | ||
288 | For internet address families, if you specify | ||
289 | .Fa servname | ||
290 | while you set | ||
291 | .Fa ai_socktype | ||
292 | to | ||
293 | .Dv SOCK_RAW , | ||
294 | .Fn getaddrinfo | ||
295 | will raise error, because service names are not defined for the internet | ||
296 | .Dv SOCK_RAW | ||
297 | space. | ||
298 | .It | ||
299 | If you specify numeric | ||
300 | .Fa servname , | ||
301 | while leaving | ||
302 | .Fa ai_socktype | ||
303 | and | ||
304 | .Fa ai_protocol | ||
305 | unspecified, | ||
306 | .Fn getaddrinfo | ||
307 | will raise error. | ||
308 | This is because the numeric | ||
309 | .Fa servname | ||
310 | does not identify any socket type, and | ||
311 | .Fn getaddrinfo | ||
312 | is not allowed to glob the argument in such case. | ||
313 | .El | ||
314 | .Pp | ||
254 | All of the information returned by | 315 | All of the information returned by |
255 | .Fn getaddrinfo | 316 | .Fn getaddrinfo |
256 | is dynamically allocated: | 317 | is 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 |