]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - share/man/man4/inet6.4
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / share / man / man4 / inet6.4
1 .\"     $KAME: inet6.4,v 1.21 2001/04/05 01:00:18 itojun Exp $
2 .\"
3 .\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
4 .\" All rights reserved.
5 .\"
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
8 .\" are met:
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\"    notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\"    notice, this list of conditions and the following disclaimer in the
13 .\"    documentation and/or other materials provided with the distribution.
14 .\" 3. Neither the name of the project nor the names of its contributors
15 .\"    may be used to endorse or promote products derived from this software
16 .\"    without specific prior written permission.
17 .\"
18 .\" THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
19 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
22 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 .\" SUCH DAMAGE.
29 .\"
30 .\" $FreeBSD$
31 .\"
32 .Dd September 2, 2009
33 .Dt INET6 4
34 .Os
35 .Sh NAME
36 .Nm inet6
37 .Nd Internet protocol version 6 family
38 .Sh SYNOPSIS
39 .In sys/types.h
40 .In netinet/in.h
41 .Sh DESCRIPTION
42 The
43 .Nm
44 family is an updated version of
45 .Xr inet 4
46 family.
47 While
48 .Xr inet 4
49 implements Internet Protocol version 4,
50 .Nm
51 implements Internet Protocol version 6.
52 .Pp
53 .Nm
54 is a collection of protocols layered atop the
55 .Em Internet Protocol version 6
56 .Pq Tn IPv6
57 transport layer, and utilizing the IPv6 address format.
58 The
59 .Nm
60 family provides protocol support for the
61 .Dv SOCK_STREAM , SOCK_DGRAM ,
62 and
63 .Dv SOCK_RAW
64 socket types; the
65 .Dv SOCK_RAW
66 interface provides access to the
67 .Tn IPv6
68 protocol.
69 .Sh ADDRESSING
70 IPv6 addresses are 16 byte quantities, stored in network standard byteorder.
71 The include file
72 .In netinet/in.h
73 defines this address
74 as a discriminated union.
75 .Pp
76 Sockets bound to the
77 .Nm
78 family utilize the following addressing structure:
79 .Bd -literal -offset indent
80 struct sockaddr_in6 {
81         uint8_t         sin6_len;
82         sa_family_t     sin6_family;
83         in_port_t       sin6_port;
84         uint32_t        sin6_flowinfo;
85         struct in6_addr sin6_addr;
86         uint32_t        sin6_scope_id;
87 };
88 .Ed
89 .Pp
90 Sockets may be created with the local address
91 .Dq Dv ::
92 (which is equal to IPv6 address
93 .Dv 0:0:0:0:0:0:0:0 )
94 to affect
95 .Dq wildcard
96 matching on incoming messages.
97 .Pp
98 The IPv6 specification defines scoped addresses,
99 like link-local or site-local addresses.
100 A scoped address is ambiguous to the kernel,
101 if it is specified without a scope identifier.
102 To manipulate scoped addresses properly from the userland,
103 programs must use the advanced API defined in RFC2292.
104 A compact description of the advanced API is available in
105 .Xr ip6 4 .
106 If a scoped address is specified without an explicit scope,
107 the kernel may raise an error.
108 Note that scoped addresses are not for daily use at this moment,
109 both from a specification and an implementation point of view.
110 .Pp
111 The KAME implementation supports an extended numeric IPv6 address notation
112 for link-local addresses,
113 like
114 .Dq Li fe80::1%de0
115 to specify
116 .Do
117 .Li fe80::1
118 on
119 .Li de0
120 interface
121 .Dc .
122 This notation is supported by
123 .Xr getaddrinfo 3
124 and
125 .Xr getnameinfo 3 .
126 Some of normal userland programs, such as
127 .Xr telnet 1
128 or
129 .Xr ftp 1 ,
130 are able to use this notation.
131 With special programs
132 like
133 .Xr ping6 8 ,
134 you can specify the outgoing interface by an extra command line option
135 to disambiguate scoped addresses.
136 .Pp
137 Scoped addresses are handled specially in the kernel.
138 In kernel structures like routing tables or interface structures,
139 a scoped address will have its interface index embedded into the address.
140 Therefore,
141 the address in some kernel structures is not the same as that on the wire.
142 The embedded index will become visible through a
143 .Dv PF_ROUTE
144 socket, kernel memory accesses via
145 .Xr kvm 3
146 and on some other occasions.
147 HOWEVER, users should never use the embedded form.
148 For details please consult
149 .Pa IMPLEMENTATION
150 supplied with KAME kit.
151 .Sh PROTOCOLS
152 The
153 .Nm
154 family is comprised of the
155 .Tn IPv6
156 network protocol, Internet Control
157 Message Protocol version 6
158 .Pq Tn ICMPv6 ,
159 Transmission Control Protocol
160 .Pq Tn TCP ,
161 and User Datagram Protocol
162 .Pq Tn UDP .
163 .Tn TCP
164 is used to support the
165 .Dv SOCK_STREAM
166 abstraction while
167 .Tn UDP
168 is used to support the
169 .Dv SOCK_DGRAM
170 abstraction.
171 Note that
172 .Tn TCP
173 and
174 .Tn UDP
175 are common to
176 .Xr inet 4
177 and
178 .Nm .
179 A raw interface to
180 .Tn IPv6
181 is available
182 by creating an Internet socket of type
183 .Dv SOCK_RAW .
184 The
185 .Tn ICMPv6
186 message protocol is accessible from a raw socket.
187 .Ss MIB Variables
188 A number of variables are implemented in the net.inet6 branch of the
189 .Xr sysctl 3
190 MIB.
191 In addition to the variables supported by the transport protocols
192 (for which the respective manual pages may be consulted),
193 the following general variables are defined:
194 .Bl -tag -width IPV6CTL_MAXFRAGPACKETS
195 .It Dv IPV6CTL_FORWARDING
196 .Pq ip6.forwarding
197 Boolean: enable/disable forwarding of
198 .Tn IPv6
199 packets.
200 Also, identify if the node is acting as a router.
201 Defaults to off.
202 .It Dv IPV6CTL_SENDREDIRECTS
203 .Pq ip6.redirect
204 Boolean: enable/disable sending of
205 .Tn ICMPv6
206 redirects in response to unforwardable
207 .Tn IPv6
208 packets.
209 This option is ignored unless the node is routing
210 .Tn IPv6
211 packets,
212 and should normally be enabled on all systems.
213 Defaults to on.
214 .It Dv IPV6CTL_DEFHLIM
215 .Pq ip6.hlim
216 Integer: default hop limit value to use for outgoing
217 .Tn IPv6
218 packets.
219 This value applies to all the transport protocols on top of
220 .Tn IPv6 .
221 There are APIs to override the value.
222 .It Dv IPV6CTL_MAXFRAGPACKETS
223 .Pq ip6.maxfragpackets
224 Integer: default maximum number of fragmented packets the node will accept.
225 0 means that the node will not accept any fragmented packets.
226 -1 means that the node will accept as many fragmented packets as it receives.
227 The flag is provided basically for avoiding possible DoS attacks.
228 .It Dv IPV6CTL_ACCEPT_RTADV
229 .Pq ip6.accept_rtadv
230 Boolean: the default value of a per-interface flag to
231 enable/disable receiving of
232 .Tn ICMPv6
233 router advertisement packets,
234 and autoconfiguration of address prefixes and default routers.
235 The node must be a host
236 (not a router)
237 for the option to be meaningful.
238 Defaults to off.
239 .It Dv IPV6CTL_AUTO_LINKLOCAL
240 .Pq ip6.auto_linklocal
241 Boolean: the default value of a per-interface flag to
242 enable/disable performing automatic link-local address configuration.
243 Defaults to on.
244 .It Dv IPV6CTL_KEEPFAITH
245 .Pq ip6.keepfaith
246 Boolean: enable/disable
247 .Dq FAITH
248 TCP relay IPv6-to-IPv4 translator code in the kernel.
249 Refer
250 .Xr faith 4
251 and
252 .Xr faithd 8
253 for detail.
254 Defaults to off.
255 .It Dv IPV6CTL_LOG_INTERVAL
256 .Pq ip6.log_interval
257 Integer: default interval between
258 .Tn IPv6
259 packet forwarding engine log output
260 (in seconds).
261 .It Dv IPV6CTL_HDRNESTLIMIT
262 .Pq ip6.hdrnestlimit
263 Integer: default number of the maximum
264 .Tn IPv6
265 extension headers
266 permitted on incoming
267 .Tn IPv6
268 packets.
269 If set to 0, the node will accept as many extension headers as possible.
270 .It Dv IPV6CTL_DAD_COUNT
271 .Pq ip6.dad_count
272 Integer: default number of
273 .Tn IPv6
274 DAD
275 .Pq duplicated address detection
276 probe packets.
277 The packets will be generated when
278 .Tn IPv6
279 interface addresses are configured.
280 .It Dv IPV6CTL_AUTO_FLOWLABEL
281 .Pq ip6.auto_flowlabel
282 Boolean: enable/disable automatic filling of
283 .Tn IPv6
284 flowlabel field, for outstanding connected transport protocol packets.
285 The field might be used by intermediate routers to identify packet flows.
286 Defaults to on.
287 .It Dv IPV6CTL_DEFMCASTHLIM
288 .Pq ip6.defmcasthlim
289 Integer: default hop limit value for an
290 .Tn IPv6
291 multicast packet sourced by the node.
292 This value applies to all the transport protocols on top of
293 .Tn IPv6 .
294 There are APIs to override the value as documented in
295 .Xr ip6 4 .
296 .It Dv IPV6CTL_GIF_HLIM
297 .Pq ip6.gifhlim
298 Integer: default maximum hop limit value for an
299 .Tn IPv6
300 packet generated by
301 .Xr gif 4
302 tunnel interface.
303 .It Dv IPV6CTL_KAME_VERSION
304 .Pq ip6.kame_version
305 String: identifies the version of KAME
306 .Tn IPv6
307 stack implemented in the kernel.
308 .It Dv IPV6CTL_USE_DEPRECATED
309 .Pq ip6.use_deprecated
310 Boolean: enable/disable use of deprecated address,
311 specified in RFC2462 5.5.4.
312 Defaults to on.
313 .It Dv IPV6CTL_RR_PRUNE
314 .Pq ip6.rr_prune
315 Integer: default interval between
316 .Tn IPv6
317 router renumbering prefix babysitting, in seconds.
318 .It Dv IPV6CTL_V6ONLY
319 .Pq ip6.v6only
320 Boolean: enable/disable the prohibited use of
321 .Tn IPv4
322 mapped address on
323 .Dv AF_INET6
324 sockets.
325 Defaults to on.
326 .It Dv IPV6CTL_RTEXPIRE
327 .Pq ip6.rtexpire
328 Integer: lifetime in seconds of protocol-cloned
329 .Tn IP
330 routes after the last reference drops (default one hour).
331 .\"This value varies dynamically as described above.
332 .It Dv IPV6CTL_RTMINEXPIRE
333 .Pq ip6.rtminexpire
334 Integer: minimum value of ip.rtexpire (default ten seconds).
335 .\"This value has no effect on user modifications, but restricts the dynamic
336 .\"adaptation described above.
337 .It Dv IPV6CTL_RTMAXCACHE
338 .Pq ip6.rtmaxcache
339 Integer: trigger level of cached, unreferenced, protocol-cloned routes
340 which initiates dynamic adaptation (default 128).
341 .El
342 .Ss Interaction between IPv4/v6 sockets
343 By default,
344 .Fx
345 does not route IPv4 traffic to
346 .Dv AF_INET6
347 sockets.
348 The default behavior intentionally violates RFC2553 for security reasons.
349 Listen to two sockets if you want to accept both IPv4 and IPv6 traffic.
350 IPv4 traffic may be routed with certain
351 per-socket/per-node configuration, however, it is not recommended to do so.
352 Consult
353 .Xr ip6 4
354 for details.
355 .Pp
356 The behavior of
357 .Dv AF_INET6
358 TCP/UDP socket is documented in RFC2553.
359 Basically, it says this:
360 .Bl -bullet -compact
361 .It
362 A specific bind on an
363 .Dv AF_INET6
364 socket
365 .Xr ( bind 2
366 with an address specified)
367 should accept IPv6 traffic to that address only.
368 .It
369 If you perform a wildcard bind
370 on an
371 .Dv AF_INET6
372 socket
373 .Xr ( bind 2
374 to IPv6 address
375 .Li :: ) ,
376 and there is no wildcard bind
377 .Dv AF_INET
378 socket on that TCP/UDP port, IPv6 traffic as well as IPv4 traffic
379 should be routed to that
380 .Dv AF_INET6
381 socket.
382 IPv4 traffic should be seen as if it came from an IPv6 address like
383 .Li ::ffff:10.1.1.1 .
384 This is called an IPv4 mapped address.
385 .It
386 If there are both a wildcard bind
387 .Dv AF_INET
388 socket and a wildcard bind
389 .Dv AF_INET6
390 socket on one TCP/UDP port, they should behave separately.
391 IPv4 traffic should be routed to the
392 .Dv AF_INET
393 socket and IPv6 should be routed to the
394 .Dv AF_INET6
395 socket.
396 .El
397 .Pp
398 However, RFC2553 does not define the ordering constraint between calls to
399 .Xr bind 2 ,
400 nor how IPv4 TCP/UDP port numbers and IPv6 TCP/UDP port numbers
401 relate to each other
402 (should they be integrated or separated).
403 Implemented behavior is very different from kernel to kernel.
404 Therefore, it is unwise to rely too much upon the behavior of
405 .Dv AF_INET6
406 wildcard bind sockets.
407 It is recommended to listen to two sockets, one for
408 .Dv AF_INET
409 and another for
410 .Dv AF_INET6 ,
411 when you would like to accept both IPv4 and IPv6 traffic.
412 .Pp
413 It should also be noted that
414 malicious parties can take advantage of the complexity presented above,
415 and are able to bypass access control,
416 if the target node routes IPv4 traffic to
417 .Dv AF_INET6
418 socket.
419 Users are advised to take care handling connections
420 from IPv4 mapped address to
421 .Dv AF_INET6
422 sockets.
423 .Sh SEE ALSO
424 .Xr ioctl 2 ,
425 .Xr socket 2 ,
426 .Xr sysctl 3 ,
427 .Xr icmp6 4 ,
428 .Xr intro 4 ,
429 .Xr ip6 4 ,
430 .Xr tcp 4 ,
431 .Xr udp 4
432 .Sh STANDARDS
433 .Rs
434 .%A Tatsuya Jinmei
435 .%A Atsushi Onoe
436 .%T "An Extension of Format for IPv6 Scoped Addresses"
437 .%R internet draft
438 .%D June 2000
439 .%N draft-ietf-ipngwg-scopedaddr-format-02.txt
440 .%O work in progress material
441 .Re
442 .Sh HISTORY
443 The
444 .Nm
445 protocol interfaces are defined in RFC2553 and RFC2292.
446 The implementation described herein appeared in the WIDE/KAME project.
447 .Sh BUGS
448 The IPv6 support is subject to change as the Internet protocols develop.
449 Users should not depend on details of the current implementation,
450 but rather the services exported.
451 .Pp
452 Users are suggested to implement
453 .Dq version independent
454 code as much as possible, as you will need to support both
455 .Xr inet 4
456 and
457 .Nm .