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