1 .\" $NetBSD: inet6.4,v 1.28 2003/09/07 16:22:27 wiz Exp $
2 .\" $KAME: inet6.4,v 1.18 2000/11/24 08:50:32 itojun Exp $
4 .\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
5 .\" All rights reserved.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in the
14 .\" documentation and/or other materials provided with the distribution.
15 .\" 3. Neither the name of the project nor the names of its contributors
16 .\" may be used to endorse or promote products derived from this software
17 .\" without specific prior written permission.
19 .\" THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
20 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
23 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 .Nd Internet protocol version 6 family
43 family is an updated version of
48 implements Internet Protocol version 4,
50 implements Internet Protocol version 6.
53 is a collection of protocols layered atop the
54 .Em Internet Protocol version 6
56 transport layer, and using the IPv6 address format.
59 family provides protocol support for the
60 .Dv SOCK_STREAM , SOCK_DGRAM ,
65 interface provides access to the
69 IPv6 addresses are 16 byte quantities, stored in network standard byteorder.
73 as a discriminated union.
77 family use the following addressing structure:
78 .Bd -literal -offset indent
81 sa_family_t sin6_family;
83 uint32_t sin6_flowinfo;
84 struct in6_addr sin6_addr;
85 uint32_t sin6_scope_id;
89 Sockets may be created with the local address
92 which is equal to IPv6 address
97 matching on incoming messages.
99 The IPv6 specification defines scoped addresses,
100 like link-local or site-local addresses.
101 A scoped address is ambiguous to the kernel,
102 if it is specified without a scope identifier.
103 To manipulate scoped addresses properly from the userland,
104 programs must use the advanced API defined in RFC 2292.
105 A compact description of the advanced API is available in
107 If a scoped address is specified without an explicit scope,
108 the kernel may raise an error.
109 Note that scoped addresses are not for daily use at this moment,
110 both from a specification and an implementation point of view.
112 The KAME implementation supports an extended numeric IPv6 address notation
113 for link-local addresses,
123 This notation is supported by
127 Some of normal userland programs, such as
131 are able to use this notation.
132 With special programs
135 you can specify the outgoing interface by an extra command line option
136 to disambiguate scoped addresses.
138 Scoped addresses are handled specially in the kernel.
139 In kernel structures like routing tables or interface structures,
140 a scoped address will have its interface index embedded into the address.
142 the address in some kernel structures is not the same as that on the wire.
143 The embedded index will become visible through a
145 socket, kernel memory accesses via
147 and on some other occasions.
148 HOWEVER, users should never use the embedded form.
149 For details please consult
150 .Pa http://www.kame.net/dev/cvsweb.cgi/kame/IMPLEMENTATION .
151 Note that the above URL describes the situation with the latest KAME tree,
160 network protocol, Internet Control
161 Message Protocol version 6
163 Transmission Control Protocol
165 and User Datagram Protocol
168 is used to support the
172 is used to support the
186 by creating an Internet socket of type
190 message protocol is accessible from a raw socket.
192 .\" The 128-bit IPv6 address contains both network and host parts.
193 .\" However, direct examination of addresses is discouraged.
194 .\" For those programs which absolutely need to break addresses
195 .\" into their component parts, the following
197 .\" commands are provided for a datagram socket in the
199 .\" domain; they have the same form as the
204 .\" .Bl -tag -width SIOCSIFNETMASK
205 .\" .It Dv SIOCSIFNETMASK
206 .\" Set interface network mask.
207 .\" The network mask defines the network part of the address;
208 .\" if it contains more of the address than the address type would indicate,
209 .\" then subnets are in use.
210 .\" .It Dv SIOCGIFNETMASK
211 .\" Get interface network mask.
214 .\" The current implementation of Internet protocols includes some routing-table
215 .\" adaptations to provide enhanced caching of certain end-to-end
216 .\" information necessary for Transaction TCP and Path MTU Discovery. The
217 .\" following changes are the most significant:
220 .\" All IP routes, except those with the
222 .\" flag and those to multicast destinations, have the
223 .\" .Dv RTF_PRCLONING
224 .\" flag forcibly enabled (they are thus said to be
225 .\" .Dq "protocol cloning" ).
227 .\" When the last reference to an IP route is dropped, the route is
228 .\" examined to determine if it was created by cloning such a route. If
229 .\" this is the case, the
231 .\" flag is turned on, and the expiration timer is initialized to go off
232 .\" in net.inet.ip.rtexpire seconds. If such a route is re-referenced,
233 .\" the flag and expiration timer are reset.
235 .\" A kernel timeout runs once every ten minutes, or sooner if there are
236 .\" soon-to-expire routes in the kernel routing table, and deletes the
240 .\" A dynamic process is in place to modify the value of
241 .\" net.inet.ip.rtexpire if the number of cached routes grows too large.
242 .\" If after an expiration run there are still more than
243 .\" net.inet.ip.rtmaxcache unreferenced routes remaining, the rtexpire
244 .\" value is multiplied by 3/4, and any routes which have longer
245 .\" expiration times have those times adjusted. This process is damped
246 .\" somewhat by specification of a minimum rtexpire value
247 .\" (net.inet.ip.rtminexpire), and by restricting the reduction to once in
248 .\" a ten-minute period.
250 .\" If some external process deletes the original route from which a
251 .\" protocol-cloned route was generated, the ``child route'' is deleted.
252 .\" (This is actually a generic mechanism in the routing code support for
253 .\" protocol-requested cloning.)
255 .\" No attempt is made to manage routes which were not created by protocol
256 .\" cloning; these are assumed to be static, under the management of an
257 .\" external routing process, or under the management of a link layer
262 .\" Only certain types of network activity will result in the cloning of a
263 .\" route using this mechanism. Specifically, those protocols (such as
267 .\" which themselves cache a long-lasting reference to route for a destination
268 .\" will trigger the mechanism; whereas raw
270 .\" packets, whether locally-generated or forwarded, will not.
271 .Ss Interaction between IPv4/v6 sockets
274 does not route IPv4 traffic to
277 The default behavior intentionally violates RFC 2553 for security reasons.
278 Listen to two sockets if you want to accept both IPv4 and IPv6 traffic.
279 IPv4 traffic may be routed with certain
280 per-socket/per-node configuration, however, it is not recommended to do so.
287 TCP/UDP socket is documented in RFC 2553.
288 Basically, it says this:
291 A specific bind on an
296 with an address specified
298 should accept IPv6 traffic to that address only.
300 If you perform a wildcard bind
309 and there is no wildcard bind
311 socket on that TCP/UDP port, IPv6 traffic as well as IPv4 traffic
312 should be routed to that
315 IPv4 traffic should be seen as if it came from an IPv6 address like
316 .Li ::ffff:10.1.1.1 .
317 This is called an IPv4 mapped address.
319 If there are both a wildcard bind
321 socket and a wildcard bind
323 socket on one TCP/UDP port, they should behave separately.
324 IPv4 traffic should be routed to the
326 socket and IPv6 should be routed to the
331 However, RFC 2553 does not define the ordering constraint between calls to
333 nor how IPv4 TCP/UDP port numbers and IPv6 TCP/UDP port numbers
336 should they be integrated or separated
338 Implemented behavior is very different from kernel to kernel.
339 Therefore, it is unwise to rely too much upon the behavior of
341 wildcard bind sockets.
342 It is recommended to listen to two sockets, one for
346 when you would like to accept both IPv4 and IPv6 traffic.
348 It should also be noted that
349 malicious parties can take advantage of the complexity presented above,
350 and are able to bypass access control,
351 if the target node routes IPv4 traffic to
354 Users are advised to take care handling connections
355 from IPv4 mapped address to
371 .%T "An Extension of Format for IPv6 Scoped Addresses"
374 .%N draft-ietf-ipngwg-scopedaddr-format-02.txt
375 .%O work in progress material
380 protocol interfaces are defined in RFC 2553 and RFC 2292.
381 The implementation described herein appeared in the WIDE/KAME project.
383 The IPv6 support is subject to change as the Internet protocols develop.
384 Users should not depend on details of the current implementation,
385 but rather the services exported.
387 Users are suggested to implement
388 .Dq version independent
389 code as much as possible, as you will need to support both