1 .\" SPDX-License-Identifier: Linux-man-pages-1-para
3 .\" This man page is Copyright (C) 2000 Andi Kleen <ak@muc.de>.
5 .\" $Id: ipv6.7,v 1.3 2000/12/20 18:10:31 ak Exp $
7 .\" The following socket options are undocumented
8 .\" All of the following are from:
9 .\" commit 333fad5364d6b457c8d837f7d05802d2aaf8a961
10 .\" Author: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
11 .\" Support several new sockopt / ancillary data in Advanced API (RFC3542).
12 .\" IPV6_2292PKTINFO (2.6.14)
13 .\" Formerly IPV6_PKTINFO
14 .\" IPV6_2292HOPOPTS (2.6.14)
15 .\" Formerly IPV6_HOPOPTS, which is documented
16 .\" IPV6_2292DSTOPTS (2.6.14)
17 .\" Formerly IPV6_DSTOPTS, which is documented
18 .\" IPV6_2292RTHDR (2.6.14)
19 .\" Formerly IPV6_RTHDR, which is documented
20 .\" IPV6_2292PKTOPTIONS (2.6.14)
21 .\" Formerly IPV6_PKTOPTIONS
22 .\" IPV6_2292HOPLIMIT (2.6.14)
23 .\" Formerly IPV6_HOPLIMIT, which is documented
25 .\" IPV6_RECVHOPLIMIT (2.6.14)
26 .\" IPV6_RECVHOPOPTS (2.6.14)
27 .\" IPV6_RTHDRDSTOPTS (2.6.14)
28 .\" IPV6_RECVRTHDR (2.6.14)
29 .\" IPV6_RECVDSTOPTS (2.6.14)
31 .\" IPV6_RECVPATHMTU (Linux 2.6.35, flag value added in Linux 2.6.14)
32 .\" commit 793b14731686595a741d9f47726ad8b9a235385a
33 .\" Author: Brian Haley <brian.haley@hp.com>
34 .\" IPV6_PATHMTU (Linux 2.6.35, flag value added in Linux 2.6.14)
35 .\" commit 793b14731686595a741d9f47726ad8b9a235385a
36 .\" Author: Brian Haley <brian.haley@hp.com>
37 .\" IPV6_DONTFRAG (Linux 2.6.35, flag value added in Linux 2.6.14)
38 .\" commit 793b14731686595a741d9f47726ad8b9a235385a
39 .\" Author: Brian Haley <brian.haley@hp.com>
40 .\" commit 4b340ae20d0e2366792abe70f46629e576adaf5e
41 .\" Author: Brian Haley <brian.haley@hp.com>
43 .\" IPV6_RECVTCLASS (Linux 2.6.14)
44 .\" commit 41a1f8ea4fbfcdc4232f023732584aae2220de31
45 .\" Author: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
46 .\" Based on patch from David L Stevens <dlstevens@us.ibm.com>
48 .\" IPV6_CHECKSUM (Linux 2.2)
49 .\" IPV6_NEXTHOP (Linux 2.2)
50 .\" IPV6_JOIN_ANYCAST (Linux 2.4.21 / Linux 2.6)
51 .\" IPV6_LEAVE_ANYCAST (Linux 2.4.21 / Linux 2.6)
52 .\" IPV6_FLOWLABEL_MGR (Linux 2.2.7 / Linux 2.4)
53 .\" IPV6_FLOWINFO_SEND (Linux 2.2.7 / Linux 2.4)
54 .\" IPV6_IPSEC_POLICY (Linux 2.6)
55 .\" IPV6_XFRM_POLICY (Linux 2.6)
56 .\" IPV6_TCLASS (Linux 2.6)
58 .\" IPV6_ADDR_PREFERENCES (Linux 2.6.26)
59 .\" commit 7cbca67c073263c179f605bdbbdc565ab29d801d
60 .\" Author: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
61 .\" IPV6_MINHOPCOUNT (Linux 2.6.35)
62 .\" commit e802af9cabb011f09b9c19a82faef3dd315f27eb
63 .\" Author: Stephen Hemminger <shemminger@vyatta.com>
64 .\" IPV6_ORIGDSTADDR (Linux 2.6.37)
65 .\" Actually a CMSG rather than a sockopt?
66 .\" In header file, we have IPV6_RECVORIGDSTADDR == IPV6_ORIGDSTADDR
67 .\" commit 6c46862280c5f55eda7750391bc65cd7e08c7535
68 .\" Author: Balazs Scheidler <bazsi@balabit.hu>
69 .\" IPV6_RECVORIGDSTADDR (Linux 2.6.37)
70 .\" commit 6c46862280c5f55eda7750391bc65cd7e08c7535
71 .\" Author: Balazs Scheidler <bazsi@balabit.hu>
72 .\" Support for IPV6_RECVORIGDSTADDR sockopt for UDP sockets
73 .\" were contributed by Harry Mason.
74 .\" IPV6_TRANSPARENT (Linux 2.6.37)
75 .\" commit 6c46862280c5f55eda7750391bc65cd7e08c7535
76 .\" Author: Balazs Scheidler <bazsi@balabit.hu>
77 .\" IPV6_UNICAST_IF (Linux 3.4)
78 .\" commit c4062dfc425e94290ac427a98d6b4721dd2bc91f
79 .\" Author: Erich E. Hoover <ehoover@mines.edu>
81 .TH ipv6 7 (date) "Linux man-pages (unreleased)"
83 ipv6 \- Linux IPv6 protocol implementation
86 .B #include <sys/socket.h>
87 .B #include <netinet/in.h>
89 .IB tcp6_socket " = socket(AF_INET6, SOCK_STREAM, 0);"
90 .IB raw6_socket " = socket(AF_INET6, SOCK_RAW, " protocol ");"
91 .IB udp6_socket " = socket(AF_INET6, SOCK_DGRAM, " protocol ");"
94 Linux 2.2 optionally implements the Internet Protocol, version 6.
95 This man page contains a description of the IPv6 basic API as
96 implemented by the Linux kernel and glibc 2.1.
98 is based on the BSD sockets interface; see
101 The IPv6 API aims to be mostly compatible with the
104 Only differences are described in this man page.
108 socket to any process, the local address should be copied from the
113 In static initializations,
115 may also be used, which expands to a constant expression.
116 Both of them are in network byte order.
118 The IPv6 loopback address (::1) is available in the global
122 .B IN6ADDR_LOOPBACK_INIT
125 IPv4 connections can be handled with the v6 API by using the
126 v4-mapped-on-v6 address type;
127 thus a program needs to support only this API type to
128 support both protocols.
129 This is handled transparently by the address
130 handling functions in the C library.
132 IPv4 and IPv6 share the local port space.
133 When you get an IPv4 connection
134 or packet to an IPv6 socket,
135 its source address will be mapped to v6.
139 struct sockaddr_in6 {
140 sa_family_t sin6_family; /* AF_INET6 */
141 in_port_t sin6_port; /* port number */
142 uint32_t sin6_flowinfo; /* IPv6 flow information */
143 struct in6_addr sin6_addr; /* IPv6 address */
144 uint32_t sin6_scope_id; /* Scope ID (new in Linux 2.4) */
148 unsigned char s6_addr[16]; /* IPv6 address */
157 is the protocol port (see
162 is the IPv6 flow identifier;
164 is the 128-bit IPv6 address.
166 is an ID depending on the scope of the address.
167 It is new in Linux 2.4.
168 Linux supports it only for link-local addresses, in that case
170 contains the interface index (see
173 IPv6 supports several address types: unicast to address a single
174 host, multicast to address a group of hosts,
175 anycast to address the nearest member of a group of hosts
176 (not implemented in Linux), IPv4-on-IPv6 to
177 address an IPv4 host, and other reserved address types.
179 The address notation for IPv6 is a group of 8 4-digit hexadecimal
180 numbers, separated with a \[aq]:\[aq].
181 \&"::" stands for a string of 0 bits.
182 Special addresses are ::1 for loopback and ::FFFF:<IPv4 address>
183 for IPv4-mapped-on-IPv6.
185 The port space of IPv6 is shared with IPv4.
187 IPv6 supports some protocol-specific socket options that can be set with
191 The socket option level for IPv6 is
193 A boolean integer flag is zero when it is false, otherwise true.
198 socket into a socket of a different address family.
201 is currently supported for that.
202 It is allowed only for IPv6 sockets
203 that are connected and bound to a v4-mapped-on-v6 address.
204 The argument is a pointer to an integer containing
206 This is useful to pass v4-mapped sockets as file descriptors to
207 programs that don't know how to deal with the IPv6 API.
209 .B IPV6_ADD_MEMBERSHIP, IPV6_DROP_MEMBERSHIP
210 Control membership in multicast groups.
211 Argument is a pointer to a
212 .IR "struct ipv6_mreq" .
216 Retrieve the current known path MTU of the current socket.
217 Valid only when the socket has been connected.
221 Set the MTU to be used for the socket.
222 The MTU is limited by the device
223 MTU or the path MTU when path MTU discovery is enabled.
224 Argument is a pointer to integer.
227 Control path-MTU discovery on the socket.
234 .B IPV6_MULTICAST_HOPS
235 Set the multicast hop limit for the socket.
236 Argument is a pointer to an
238 \-1 in the value means use the route default, otherwise it should be
242 Set the device for outgoing multicast packets on the socket.
243 This is allowed only for
248 The argument is a pointer to an interface index (see
252 .B IPV6_MULTICAST_LOOP
253 Control whether the socket sees multicast packets that it has send itself.
254 Argument is a pointer to boolean.
256 .BR IPV6_RECVPKTINFO " (since Linux 2.6.14)"
259 control message on incoming datagrams.
260 Such control messages contain a
261 .IR "struct in6_pktinfo" ,
268 Argument is a pointer to a boolean value in an integer.
270 .B \%IPV6_RTHDR, \%IPV6_AUTHHDR, \%IPV6_DSTOPTS, \%IPV6_HOPOPTS, \
271 \%IPV6_FLOWINFO, \%IPV6_HOPLIMIT
272 Set delivery of control messages for incoming datagrams containing
273 extension headers from the received packet.
275 delivers the routing header,
277 delivers the authentication header,
279 delivers the destination options,
281 delivers the hop options,
283 delivers an integer containing the flow ID,
285 delivers an integer containing the hop count of the packet.
286 The control messages have the same type as the socket option.
287 All these header options can also be set for outgoing packets
288 by putting the appropriate control message into the control buffer of
295 Argument is a pointer to a boolean value.
298 Control receiving of asynchronous error options.
304 Argument is a pointer to boolean.
307 Pass forwarded packets containing a router alert hop-by-hop option to
312 The tapped packets are not forwarded by the kernel, it is the
313 user's responsibility to send them out again.
314 Argument is a pointer to an integer.
315 A positive integer indicates a router alert option value to intercept.
316 Packets carrying a router alert option with a value field containing
317 this integer will be delivered to the socket.
318 A negative integer disables delivery of packets with router alert options
322 Set the unicast hop limit for the socket.
323 Argument is a pointer to an integer.
324 \-1 in the value means use the route default,
325 otherwise it should be between 0 and 255.
327 .BR IPV6_V6ONLY " (since Linux 2.4.21 and 2.6)"
329 If this flag is set to true (nonzero), then the socket is restricted
330 to sending and receiving IPv6 packets only.
331 In this case, an IPv4 and an IPv6 application can bind
332 to a single port at the same time.
334 If this flag is set to false (zero),
335 then the socket can be used to send and receive packets
336 to and from an IPv6 address or an IPv4-mapped IPv6 address.
338 The argument is a pointer to a boolean value in an integer.
340 The default value for this flag is defined by the contents of the file
341 .IR /proc/sys/net/ipv6/bindv6only .
342 The default value for that file is 0 (false).
343 .\" FLOWLABEL_MGR, FLOWINFO_SEND
349 to a link-local IPv6 address, but the
353 structure is not a valid
356 Linux 2.4 will break binary compatibility for the
359 hosts by changing the alignment of
361 and adding an additional
364 The kernel interfaces stay compatible, but a program including
368 into other structures may not be.
370 a problem for 32-bit hosts like i386.
374 field is new in Linux 2.4.
375 It is transparently passed/read by the kernel
376 when the passed address length contains it.
377 Some programs that pass a longer address buffer and then
378 check the outgoing address length may break.
382 structure is bigger than the generic
384 Programs that assume that all address types can be stored safely in a
386 need to be changed to use
387 .I struct sockaddr_storage
395 socket options are nonportable variants of
400 The IPv6 extended API as in RFC\ 2292 is currently only partly
402 although the 2.2 kernel has near complete support for receiving options,
403 the macros for generating IPv6 options are missing in glibc 2.1.
405 IPSec support for EH and AH headers is missing.
407 Flow label management is not complete and not documented here.
409 This man page is not complete.
414 RFC\ 2553: IPv6 BASIC API;
415 Linux tries to be compliant to this.
416 RFC\ 2460: IPv6 specification.