1icmp6(7P) Protocols icmp6(7P)
2
3
4
6 icmp6 - Internet Control Message Protocol for Internet Protocol Version
7 6
8
10 #include <sys/socket.h>
11 #include <netinet/in.h>
12 #include <netinet/ip_icmp.h>
13 #include <netinet/icmp6.h>
14
15
16 s = socket(AF_INET6, SOCK_RAW, proto);
17
18
19 t = t_open("/dev/icmp6", O_RDWR);
20
21
23 The ICMP6 protocol is the error and control message protocol used with
24 Version 6 of the Internet Protocol. It is used by the kernel to handle
25 and report errors in protocol processing. It is also used for IPv6
26 neighbor and router discovery, and for multicast group membership
27 queries and reports. It may also be accessed by programs using the
28 socket interface or the Transport Level Interface (TLI) for network
29 monitoring and diagnostic functions. When used with the socket inter‐
30 face, a "raw socket" type is used. The protocol number for ICMP6, used
31 in the proto parameter to the socket call, can be obtained from getpro‐
32 tobyname(3SOCKET). ICMP6 file descriptors and sockets are connection‐
33 less and are normally used with the t_sndudata / t_rcvudata and the
34 sendto() / recvfrom() calls. They may also be used with the
35 sendmsg()/recvgmsg() calls when sending or receiving ancillary data.
36
37
38 Outgoing packets automatically have an Internet Protocol Version 6
39 (IPv6) header and zero or more IPv6 extension headers prepended. These
40 headers are prepended by the kernel. Unlike ICMP for IPv4, the
41 IP_HDRINCL option is not supported for ICMP6, so ICMP6 applications
42 neither build their own outbound IPv6 headers, nor do they receive the
43 inbound IPv6 headers with received data. IPv6 extension headers and
44 relevant fields of the IPv6 header may be set or received as ancillary
45 data to a sendmsg(3SOCKET) or recvmsg(3SOCKET) system call. Each of
46 these fields and extension headers may also be set on a per socket
47 basis with the setsockopt(3SOCKET) system call. Such "sticky" options
48 are used on all outgoing packets unless overridden by ancillary data.
49 When any ancillary data is present with a sendmsg(3SOCKET) system call,
50 all sticky options are ignored for that system call, but subsequently
51 remain configured.
52
53
54 ICMP6 is a datagram protocol layered above IPv6. Received ICMP6 mes‐
55 sages may be reflected back to users of higher-level protocols such as
56 TCP or UDP as error returns from system calls. A copy of each
57 ICMP6error message received by the system is provided to every holder
58 of an open ICMP6 socket or TLI descriptor.
59
61 getprotobyname(3SOCKET), recv(3SOCKET), recvmsg(3SOCKET),
62 send(3SOCKET), sendmsg(3SOCKET), setsockopt(3SOCKET), t_rcvudata(3NSL),
63 t_sndudata(3NSL), inet6(7P), ip6(7P), routing(7P)
64
65
66 Conta, A. and Deering, S., RFC 2463, Internet Control Message Protocol
67 (ICMPv6) for the Internet Protocol Version 6 (IPv6) Specification, The
68 Internet Society, December 1998.
69
71 A socket operation may fail with one of the following errors returned:
72
73 EISCONN An attempt was made to establish a connection on a
74 socket which already has one, or when trying to send a
75 datagram with the destination address specified and
76 the socket is already connected.
77
78
79 ENOTCONN An attempt was made to send a datagram, but no desti‐
80 nation address is specified, and the socket has not
81 been connected.
82
83
84 ENOBUFS The system ran out of memory for an internal data
85 structure.
86
87
88 EADDRNOTAVAIL An attempt was made to create a socket with a network
89 address for which no network interface exists.
90
91
92 ENOMEM The system was unable to allocate memory for an inter‐
93 nal data structure.
94
95
96 ENOPROTOOPT An attempt was made to set an IPv4 socket option on an
97 IPv6 socket.
98
99
100 EINVAL An attempt was made to set an invalid or malformed
101 socket option.
102
103
104 EAFNOSUPPORT An attempt was made to bind or connect to an IPv4 or
105 mapped address, or to specify an IPv4 or mapped
106 address as the next hop.
107
108
109
110
111SunOS 5.11 10 Nov 1999 icmp6(7P)