]> git.saurik.com Git - apple/xnu.git/blame - bsd/man/man4/ip6.4
xnu-2422.115.4.tar.gz
[apple/xnu.git] / bsd / man / man4 / ip6.4
CommitLineData
91447636
A
1.\" $NetBSD: ip6.4,v 1.20 2005/01/11 06:01:41 itojun Exp $
2.\" $KAME: ip6.4,v 1.23 2005/01/11 05:56:25 itojun Exp $
3.\" $OpenBSD: ip6.4,v 1.21 2005/01/06 03:50:46 itojun Exp $
9bccf70c
A
4.\"
5.\" Copyright (c) 1983, 1991, 1993
6.\" The Regents of the University of California. All rights reserved.
7.\"
8.\" Redistribution and use in source and binary forms, with or without
9.\" modification, are permitted provided that the following conditions
10.\" are met:
11.\" 1. Redistributions of source code must retain the above copyright
12.\" notice, this list of conditions and the following disclaimer.
13.\" 2. Redistributions in binary form must reproduce the above copyright
14.\" notice, this list of conditions and the following disclaimer in the
15.\" documentation and/or other materials provided with the distribution.
91447636 16.\" 3. Neither the name of the University nor the names of its contributors
9bccf70c
A
17.\" may be used to endorse or promote products derived from this software
18.\" without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
91447636 31.Dd December 29, 2004
9bccf70c
A
32.Dt IP6 4
33.Os
9bccf70c
A
34.Sh NAME
35.Nm ip6
91447636 36.Nd Internet Protocol version 6 (IPv6) network layer
9bccf70c 37.Sh SYNOPSIS
9bccf70c
A
38.In sys/socket.h
39.In netinet/in.h
40.Ft int
41.Fn socket AF_INET6 SOCK_RAW proto
9bccf70c 42.Sh DESCRIPTION
91447636
A
43The IPv6 network layer is used by the IPv6 protocol family for
44transporting data.
45IPv6 packets contain an IPv6 header that is not provided as part of the
46payload contents when passed to an application.
47IPv6 header options affect the behavior of this protocol and may be used
48by high-level protocols (such as the
49.Xr tcp 4
9bccf70c 50and
91447636
A
51.Xr udp 4
52protocols) as well as directly by
53.Dq raw sockets ,
54which process IPv6 messages at a lower-level and may be useful for
55developing new protocols and special-purpose applications.
56.Ss Header
57All IPv6 packets begin with an IPv6 header.
58When data received by the kernel are passed to the application, this
59header is not included in buffer, even when raw sockets are being used.
60Likewise, when data are sent to the kernel for transmit from the
61application, the buffer is not examined for an IPv6 header:
62the kernel always constructs the header.
63To directly access IPv6 headers from received packets and specify them
64as part of the buffer passed to the kernel, link-level access
65.Po
66.Xr bpf 4 ,
67for example
68.Pc
69must instead be utilized.
9bccf70c 70.Pp
91447636 71The header has the following definition:
9bccf70c 72.Bd -literal -offset indent
91447636
A
73struct ip6_hdr {
74 union {
75 struct ip6_hdrctl {
76 u_int32_t ip6_un1_flow; /* 20 bits of flow ID */
77 u_int16_t ip6_un1_plen; /* payload length */
78 u_int8_t ip6_un1_nxt; /* next header */
79 u_int8_t ip6_un1_hlim; /* hop limit */
80 } ip6_un1;
81 u_int8_t ip6_un2_vfc; /* version and class */
82 } ip6_ctlun;
83 struct in6_addr ip6_src; /* source address */
84 struct in6_addr ip6_dst; /* destination address */
85} __packed;
86
87#define ip6_vfc ip6_ctlun.ip6_un2_vfc
88#define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow
89#define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen
90#define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt
91#define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim
92#define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim
9bccf70c
A
93.Ed
94.Pp
91447636
A
95All fields are in network-byte order.
96Any options specified (see
97.Sx Options
98below) must also be specified in network-byte order.
99.Pp
100.Va ip6_flow
101specifies the flow ID.
102.Va ip6_plen
103specifies the payload length.
104.Va ip6_nxt
105specifies the type of the next header.
106.Va ip6_hlim
107specifies the hop limit.
108.Pp
109The top 4 bits of
110.Va ip6_vfc
111specify the class and the bottom 4 bits specify the version.
112.Pp
113.Va ip6_src
9bccf70c 114and
91447636
A
115.Va ip6_dst
116specify the source and destination addresses.
9bccf70c 117.Pp
91447636
A
118The IPv6 header may be followed by any number of extension headers that start
119with the following generic definition:
9bccf70c 120.Bd -literal -offset indent
91447636
A
121struct ip6_ext {
122 u_int8_t ip6e_nxt;
123 u_int8_t ip6e_len;
124} __packed;
9bccf70c 125.Ed
91447636
A
126.Ss Options
127IPv6 allows header options on packets to manipulate the behavior of the
128protocol.
129These options and other control requests are accessed with the
130.Xr getsockopt 2
131and
132.Xr setsockopt 2
133system calls at level
134.Dv IPPROTO_IPV6
135and by using ancillary data in
136.Xr recvmsg 2
137and
138.Xr sendmsg 2 .
139They can be used to access most of the fields in the IPv6 header and
140extension headers.
141.Pp
142The following socket options are supported:
143.Bl -tag -width Ds
144.\" .It Dv IPV6_OPTIONS
145.It Dv IPV6_UNICAST_HOPS Fa "int *"
146Get or set the default hop limit header field for outgoing unicast
147datagrams sent on this socket.
148A value of \-1 resets to the default value.
149.\" .It Dv IPV6_RECVOPTS Fa "int *"
150.\" Get or set the status of whether all header options will be
151.\" delivered along with the datagram when it is received.
152.\" .It Dv IPV6_RECVRETOPTS Fa "int *"
153.\" Get or set the status of whether header options will be delivered
154.\" for reply.
155.\" .It Dv IPV6_RECVDSTADDR Fa "int *"
156.\" Get or set the status of whether datagrams are received with
157.\" destination addresses.
158.\" .It Dv IPV6_RETOPTS
159.\" Get or set IPv6 options.
160.It Dv IPV6_MULTICAST_IF Fa "u_int *"
161Get or set the interface from which multicast packets will be sent.
162For hosts with multiple interfaces, each multicast transmission is sent
163from the primary network interface.
164The interface is specified as its index as provided by
165.Xr if_nametoindex 3 .
166A value of zero specifies the default interface.
167.It Dv IPV6_MULTICAST_HOPS Fa "int *"
168Get or set the default hop limit header field for outgoing multicast
169datagrams sent on this socket.
170This option controls the scope of multicast datagram transmissions.
171.Pp
172Datagrams with a hop limit of 1 are not forwarded beyond the local
173network.
174Multicast datagrams with a hop limit of zero will not be transmitted on
175any network but may be delivered locally if the sending host belongs to
176the destination group and if multicast loopback (see below) has not been
177disabled on the sending socket.
178Multicast datagrams with a hop limit greater than 1 may be forwarded to
179the other networks if a multicast router (such as
180.Xr mrouted 8 )
181is attached to the local network.
182.It Dv IPV6_MULTICAST_LOOP Fa "u_int *"
183Get or set the status of whether multicast datagrams will be looped back
184for local delivery when a multicast datagram is sent to a group to which
185the sending host belongs.
186.Pp
187This option improves performance for applications that may have no more
188than one instance on a single host (such as a router daemon) by
189eliminating the overhead of receiving their own transmissions.
190It should generally not be used by applications for which there may be
191more than one instance on a single host (such as a conferencing program)
192or for which the sender does not belong to the destination group
193(such as a time-querying program).
194.Pp
195A multicast datagram sent with an initial hop limit greater than 1 may
196be delivered to the sending host on a different interface from that on
197which it was sent if the host belongs to the destination group on that
198other interface.
199The multicast loopback control option has no effect on such delivery.
200.It Dv IPV6_JOIN_GROUP Fa "struct ipv6_mreq *"
201Join a multicast group.
9bccf70c
A
202A host must become a member of a multicast group before it can receive
203datagrams sent to the group.
91447636
A
204.Bd -literal
205struct ipv6_mreq {
206 struct in6_addr ipv6mr_multiaddr;
207 unsigned int ipv6mr_interface;
208};
9bccf70c
A
209.Ed
210.Pp
91447636
A
211.Va ipv6mr_interface
212may be set to zeroes to choose the default multicast interface or to the
213index of a particular multicast-capable interface if the host is
214multihomed.
215Membership is associated with a single interface; programs running on
216multihomed hosts may need to join the same group on more than one
217interface.
218.Pp
219If the multicast address is unspecified (i.e., all zeroes), messages
220from all multicast addresses will be accepted by this group.
221Note that setting to this value requires superuser privileges.
222.It Dv IPV6_LEAVE_GROUP Fa "struct ipv6_mreq *"
223Drop membership from the associated multicast group.
224Memberships are automatically dropped when the socket is closed or when
225the process exits.
226.It Dv IPV6_PORTRANGE Fa "int *"
227Get or set the allocation policy of ephemeral ports for when the kernel
228automatically binds a local address to this socket.
229The following values are available:
230.Pp
231.Bl -tag -width IPV6_PORTRANGE_DEFAULT -compact
232.It Dv IPV6_PORTRANGE_DEFAULT
233Use the regular range of non-reserved ports (varies, see
234.Xr sysctl 8 ) .
235.It Dv IPV6_PORTRANGE_HIGH
236Use a high range (varies, see
237.Xr sysctl 8 ) .
238.It Dv IPV6_PORTRANGE_LOW
239Use a low, reserved range (600\-1023).
240.El
241.It Dv IPV6_PKTINFO Fa "int *"
242Get or set whether additional information about subsequent packets will
243be provided as ancillary data along with the payload in subsequent
244.Xr recvmsg 2
245calls.
246The information is stored in the following structure in the ancillary
247data returned:
248.Bd -literal
249struct in6_pktinfo {
250 struct in6_addr ipi6_addr; /* src/dst IPv6 address */
251 unsigned int ipi6_ifindex; /* send/recv if index */
9bccf70c
A
252};
253.Ed
91447636
A
254.It Dv IPV6_HOPLIMIT Fa "int *"
255Get or set whether the hop limit header field from subsequent packets
256will be provided as ancillary data along with the payload in subsequent
257.Xr recvmsg 2
258calls.
259The value is stored as an
260.Vt int
261in the ancillary data returned.
262.\" .It Dv IPV6_NEXTHOP Fa "int *"
263.\" Get or set whether the address of the next hop for subsequent
264.\" packets will be provided as ancillary data along with the payload in
265.\" subsequent
266.\" .Xr recvmsg 2
267.\" calls.
268.\" The option is stored as a
269.\" .Vt sockaddr
270.\" structure in the ancillary data returned.
271.\" .Pp
272.\" This option requires superuser privileges.
273.It Dv IPV6_HOPOPTS Fa "int *"
274Get or set whether the hop-by-hop options from subsequent packets will be
275provided as ancillary data along with the payload in subsequent
276.Xr recvmsg 2
277calls.
278The option is stored in the following structure in the ancillary data
279returned:
280.Bd -literal
281struct ip6_hbh {
282 u_int8_t ip6h_nxt; /* next header */
283 u_int8_t ip6h_len; /* length in units of 8 octets */
284/* followed by options */
285} __packed;
286.Ed
9bccf70c 287.Pp
91447636
A
288The
289.Fn inet6_option_space
290routine and family of routines may be used to manipulate this data.
9bccf70c 291.Pp
91447636
A
292This option requires superuser privileges.
293.It Dv IPV6_DSTOPTS Fa "int *"
294Get or set whether the destination options from subsequent packets will
295be provided as ancillary data along with the payload in subsequent
296.Xr recvmsg 2
297calls.
298The option is stored in the following structure in the ancillary data
299returned:
300.Bd -literal
301struct ip6_dest {
302 u_int8_t ip6d_nxt; /* next header */
303 u_int8_t ip6d_len; /* length in units of 8 octets */
304/* followed by options */
305} __packed;
9bccf70c
A
306.Ed
307.Pp
91447636
A
308The
309.Fn inet6_option_space
310routine and family of routines may be used to manipulate this data.
9bccf70c 311.Pp
91447636
A
312This option requires superuser privileges.
313.It Dv IPV6_RTHDR Fa "int *"
314Get or set whether the routing header from subsequent packets will be
315provided as ancillary data along with the payload in subsequent
316.Xr recvmsg 2
317calls.
318The header is stored in the following structure in the ancillary data
319returned:
320.Bd -literal
321struct ip6_rthdr {
322 u_int8_t ip6r_nxt; /* next header */
323 u_int8_t ip6r_len; /* length in units of 8 octets */
324 u_int8_t ip6r_type; /* routing type */
325 u_int8_t ip6r_segleft; /* segments left */
326/* followed by routing-type-specific data */
327} __packed;
9bccf70c
A
328.Ed
329.Pp
91447636
A
330The
331.Fn inet6_option_space
332routine and family of routines may be used to manipulate this data.
333.Pp
334This option requires superuser privileges.
335.It Dv IPV6_PKTOPTIONS Fa "struct cmsghdr *"
336Get or set all header options and extension headers at one time on the
337last packet sent or received on the socket.
338All options must fit within the size of an mbuf (see
339.Xr mbuf 9 ) .
340Options are specified as a series of
341.Vt cmsghdr
342structures followed by corresponding values.
343.Va cmsg_level
344is set to
345.Dv IPPROTO_IPV6 ,
346.Va cmsg_type
347to one of the other values in this list, and trailing data to the option
348value.
349When setting options, if the length
350.Va optlen
351to
352.Xr setsockopt 2
353is zero, all header options will be reset to their default values.
354Otherwise, the length should specify the size the series of control
355messages consumes.
9bccf70c 356.Pp
91447636
A
357Instead of using
358.Xr sendmsg 2
359to specify option values, the ancillary data used in these calls that
360correspond to the desired header options may be directly specified as
361the control message in the series of control messages provided as the
362argument to
363.Xr setsockopt 2 .
364.It Dv IPV6_CHECKSUM Fa "int *"
365Get or set the byte offset into a packet where the 16-bit checksum is
366located.
367When set, this byte offset is where incoming packets will be expected
368to have checksums of their data stored and where outgoing packets will
369have checksums of their data computed and stored by the kernel.
370A value of \-1 specifies that no checksums will be checked on incoming
371packets and that no checksums will be computed or stored on outgoing
372packets.
373The offset of the checksum for ICMPv6 sockets cannot be relocated or
374turned off.
375.It Dv IPV6_V6ONLY Fa "int *"
376Get or set whether only IPv6 connections can be made to this socket.
377For wildcard sockets, this can restrict connections to IPv6 only.
378.\"With
379.\".Ox
380.\"IPv6 sockets are always IPv6-only, so the socket option is read-only
381.\"(not modifiable).
316670eb
A
382.\".It Dv IPV6_FAITH Fa "int *"
383.\"Get or set the status of whether
384.\".Xr faith 4
385.\"connections can be made to this socket.
91447636
A
386.It Dv IPV6_USE_MIN_MTU Fa "int *"
387Get or set whether the minimal IPv6 maximum transmission unit (MTU) size
388will be used to avoid fragmentation from occurring for subsequent
389outgoing datagrams.
390.It Dv IPV6_AUTH_LEVEL Fa "int *"
391Get or set the
392.Xr ipsec 4
393authentication level.
394.It Dv IPV6_ESP_TRANS_LEVEL Fa "int *"
395Get or set the ESP transport level.
396.It Dv IPV6_ESP_NETWORK_LEVEL Fa "int *"
397Get or set the ESP encapsulation level.
398.It Dv IPV6_IPCOMP_LEVEL Fa "int *"
399Get or set the
400.Xr ipcomp 4
401level.
402.El
9bccf70c 403.Pp
91447636 404The
9bccf70c 405.Dv IPV6_PKTINFO ,
91447636 406.\" .Dv IPV6_NEXTHOP ,
9bccf70c
A
407.Dv IPV6_HOPLIMIT ,
408.Dv IPV6_HOPOPTS ,
409.Dv IPV6_DSTOPTS ,
410and
91447636
A
411.Dv IPV6_RTHDR
412options will return ancillary data along with payload contents in subsequent
413.Xr recvmsg 2
414calls with
415.Va cmsg_level
416set to
417.Dv IPPROTO_IPV6
9bccf70c 418and
91447636
A
419.Va cmsg_type
420set to respective option name value (e.g.,
421.Dv IPV6_HOPTLIMIT ) .
422These options may also be used directly as ancillary
423.Va cmsg_type
424values in
9bccf70c 425.Xr sendmsg 2
91447636
A
426to set options on the packet being transmitted by the call.
427The
428.Va cmsg_level
429value must be
430.Dv IPPROTO_IPV6 .
431For these options, the ancillary data object value format is the same
432as the value returned as explained for each when received with
433.Xr recvmsg 2 .
434.Pp
435Note that using
9bccf70c 436.Xr sendmsg 2
91447636
A
437to specify options on particular packets works only on UDP and raw sockets.
438To manipulate header options for packets on TCP sockets, only the socket
439options may be used.
440.Pp
441In some cases, there are multiple APIs defined for manipulating an IPv6
442header field.
443A good example is the outgoing interface for multicast datagrams, which
444can be set by the
9bccf70c 445.Dv IPV6_MULTICAST_IF
91447636 446socket option, through the
9bccf70c 447.Dv IPV6_PKTINFO
91447636
A
448option, and through the
449.Va sin6_scope_id
450field of the socket address passed to the
451.Xr sendto 2
452system call.
453.Pp
454Resolving these conflicts is implementation dependent.
455This implementation determines the value in the following way:
456options specified by using ancillary data (i.e.,
457.Xr sendmsg 2 )
458are considered first,
459options specified by using
460.Dv IPV6_PKTOPTIONS
461to set
462.Dq sticky
463options are considered second,
464options specified by using the individual, basic, and direct socket
465options (e.g.,
466.Dv IPV6_UNICAST_HOPS )
467are considered third,
468and options specified in the socket address supplied to
469.Xr sendto 2
470are the last choice.
471.Ss Multicasting
472IPv6 multicasting is supported only on
473.Dv AF_INET6
474sockets of type
475.Dv SOCK_DGRAM
476and
477.Dv SOCK_RAW ,
478and only on networks where the interface driver supports
479multicasting.
480Socket options (see above) that manipulate membership of
481multicast groups and other multicast options include
482.Dv IPV6_MULTICAST_IF ,
483.Dv IPV6_MULTICAST_HOPS ,
484.Dv IPV6_MULTICAST_LOOP ,
485.Dv IPV6_LEAVE_GROUP ,
486and
487.Dv IPV6_JOIN_GROUP .
488.Ss Raw Sockets
489Raw IPv6 sockets are connectionless and are normally used with the
9bccf70c
A
490.Xr sendto 2
491and
492.Xr recvfrom 2
91447636 493calls, although the
9bccf70c 494.Xr connect 2
91447636
A
495call may be used to fix the destination address for future outgoing
496packets so that
9bccf70c 497.Xr send 2
91447636
A
498may instead be used and the
499.Xr bind 2
500call may be used to fix the source address for future outgoing
501packets instead of having the kernel choose a source address.
9bccf70c 502.Pp
91447636
A
503By using
504.Xr connect 2
505or
506.Xr bind 2 ,
507raw socket input is constrained to only packets with their
508source address matching the socket destination address if
509.Xr connect 2
510was used and to packets with their destination address
511matching the socket source address if
512.Xr bind 2
513was used.
514.Pp
515If the
516.Ar proto
517argument to
9bccf70c 518.Xr socket 2
91447636
A
519is zero, the default protocol
520.Pq Dv IPPROTO_RAW
521is used for outgoing packets.
522For incoming packets, protocols recognized by kernel are
523.Sy not
524passed to the application socket (e.g.,
525.Xr tcp 4
526and
527.Xr udp 4 )
528except for some ICMPv6 messages.
529The ICMPv6 messages not passed to raw sockets include echo, timestamp,
530and address mask requests.
531If
532.Ar proto
533is non-zero, only packets with this protocol will be passed to the
534socket.
9bccf70c 535.Pp
91447636
A
536IPv6 fragments are also not passed to application sockets until
537they have been reassembled.
538If reception of all packets is desired, link-level access (such as
539.Xr bpf 4 )
540must be used instead.
541.Pp
542Outgoing packets automatically have an IPv6 header prepended to them
543(based on the destination address and the protocol number the socket
544was created with).
545Incoming packets are received by an application without the IPv6 header
546or any extension headers.
547.Pp
548Outgoing packets will be fragmented automatically by the kernel if they
549are too large.
550Incoming packets will be reassembled before being sent to the raw socket,
551so packet fragments or fragment headers will never be seen on a raw socket.
552.Sh EXAMPLES
553The following determines the hop limit on the next packet received:
554.Bd -literal
555struct iovec iov[2];
556u_char buf[BUFSIZ];
557struct cmsghdr *cm;
558struct msghdr m;
559int found, optval;
560u_char data[2048];
561
562/* Create socket. */
563
564(void)memset(&m, 0, sizeof(m));
565(void)memset(&iov, 0, sizeof(iov));
566
567iov[0].iov_base = data; /* buffer for packet payload */
568iov[0].iov_len = sizeof(data); /* expected packet length */
569
570m.msg_name = &from; /* sockaddr_in6 of peer */
571m.msg_namelen = sizeof(from);
572m.msg_iov = iov;
573m.msg_iovlen = 1;
574m.msg_control = (caddr_t)buf; /* buffer for control messages */
575m.msg_controllen = sizeof(buf);
576
577/*
578 * Enable the hop limit value from received packets to be
579 * returned along with the payload.
580 */
581optval = 1;
582if (setsockopt(s, IPPROTO_IPV6, IPV6_HOPLIMIT, &optval,
583 sizeof(optval)) == -1)
584 err(1, "setsockopt");
585
586found = 0;
587while (!found) {
588 if (recvmsg(s, &m, 0) == -1)
589 err(1, "recvmsg");
590 for (cm = CMSG_FIRSTHDR(&m); cm != NULL;
591 cm = CMSG_NXTHDR(&m, cm)) {
592 if (cm->cmsg_level == IPPROTO_IPV6 &&
593 cm->cmsg_type == IPV6_HOPLIMIT &&
594 cm->cmsg_len == CMSG_LEN(sizeof(int))) {
595 found = 1;
596 (void)printf("hop limit: %d\en",
597 *(int *)CMSG_DATA(cm));
598 break;
599 }
600 }
601}
9bccf70c 602.Ed
91447636 603.Sh DIAGNOSTICS
9bccf70c 604A socket operation may fail with one of the following errors returned:
91447636 605.Bl -tag -width EADDRNOTAVAILxx
9bccf70c 606.It Bq Er EISCONN
91447636
A
607when trying to establish a connection on a socket which
608already has one or when trying to send a datagram with the destination
609address specified and the socket is already connected.
9bccf70c 610.It Bq Er ENOTCONN
91447636
A
611when trying to send a datagram, but
612no destination address is specified, and the socket hasn't been
613connected.
9bccf70c 614.It Bq Er ENOBUFS
91447636
A
615when the system runs out of memory for
616an internal data structure.
9bccf70c 617.It Bq Er EADDRNOTAVAIL
91447636
A
618when an attempt is made to create a
619socket with a network address for which no network interface
620exists.
9bccf70c 621.It Bq Er EACCES
91447636
A
622when an attempt is made to create
623a raw IPv6 socket by a non-privileged process.
9bccf70c
A
624.El
625.Pp
91447636
A
626The following errors specific to IPv6 may occur when setting or getting
627header options:
9bccf70c
A
628.Bl -tag -width EADDRNOTAVAILxx
629.It Bq Er EINVAL
630An unknown socket option name was given.
631.It Bq Er EINVAL
91447636 632An ancillary data object was improperly formed.
9bccf70c 633.El
9bccf70c
A
634.Sh SEE ALSO
635.Xr getsockopt 2 ,
636.Xr recv 2 ,
637.Xr send 2 ,
638.Xr setsockopt 2 ,
91447636
A
639.Xr socket 2 ,
640.\" .Xr inet6_option_space 3 ,
641.\" .Xr inet6_rthdr_space 3 ,
642.Xr if_nametoindex 3 ,
643.Xr bpf 4 ,
9bccf70c
A
644.Xr icmp6 4 ,
645.Xr inet6 4 ,
91447636
A
646.Xr netintro 4 ,
647.Xr tcp 4 ,
648.Xr udp 4
9bccf70c
A
649.Rs
650.%A W. Stevens
651.%A M. Thomas
91447636
A
652.%T Advanced Sockets API for IPv6
653.%R RFC 2292
9bccf70c 654.%D February 1998
9bccf70c
A
655.Re
656.Rs
657.%A S. Deering
658.%A R. Hinden
91447636
A
659.%T Internet Protocol, Version 6 (IPv6) Specification
660.%R RFC 2460
9bccf70c 661.%D December 1998
9bccf70c
A
662.Re
663.Rs
664.%A R. Gilligan
665.%A S. Thomson
666.%A J. Bound
667.%A W. Stevens
91447636
A
668.%T Basic Socket Interface Extensions for IPv6
669.%R RFC 2553
9bccf70c 670.%D March 1999
9bccf70c 671.Re
91447636
A
672.Rs
673.%A W. Stevens
674.%A B. Fenner
675.%A A. Rudoff
676.%T UNIX Network Programming, third edition
677.Re
9bccf70c 678.Sh STANDARDS
91447636
A
679Most of the socket options are defined in RFC 2292 or RFC 2553.
680The
9bccf70c 681.Dv IPV6_V6ONLY
91447636 682socket option is defined in RFC 3542.
9bccf70c 683The
91447636
A
684.Dv IPV6_PORTRANGE
685socket option and the conflict resolution rule are not defined in the
686RFCs and should be considered implementation dependent.