Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/net give pitfall examples.
details: https://anonhg.NetBSD.org/src/rev/7fe63a0561ac
branches: trunk
changeset: 495256:7fe63a0561ac
user: itojun <itojun%NetBSD.org@localhost>
date: Tue Jul 25 02:33:29 2000 +0000
description:
give pitfall examples.
in response to couple of PRs including 10666. sync with kame.
diffstat:
lib/libc/net/getaddrinfo.3 | 73 ++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 70 insertions(+), 3 deletions(-)
diffs (94 lines):
diff -r 97e527950d2e -r 7fe63a0561ac lib/libc/net/getaddrinfo.3
--- a/lib/libc/net/getaddrinfo.3 Tue Jul 25 01:39:22 2000 +0000
+++ b/lib/libc/net/getaddrinfo.3 Tue Jul 25 02:33:29 2000 +0000
@@ -1,5 +1,5 @@
-.\" $NetBSD: getaddrinfo.3,v 1.12 2000/06/30 16:48:47 itojun Exp $
-.\" $KAME: getaddrinfo.3,v 1.15 2000/06/30 16:46:00 itojun Exp $
+.\" $NetBSD: getaddrinfo.3,v 1.13 2000/07/25 02:33:30 itojun Exp $
+.\" $KAME: getaddrinfo.3,v 1.19 2000/07/25 02:27:44 itojun Exp $
.\"
.\" Copyright (c) 1983, 1987, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -169,6 +169,73 @@
set to
.Dv PF_UNSPEC .
.Pp
+Though the
+.Fa hints
+argument allows you to leave
+.Fa ai_socktype
+or
+.Fa ai_protocol
+unspecified
+.Pq by setting those members to zero ,
+the arguments 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 ,
+.Fa 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
Upon successful return a pointer to a linked list of one or more
.Li addrinfo
structures is returned through the final argument.
@@ -518,7 +585,7 @@
.%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
Home |
Main Index |
Thread Index |
Old Index