ICMP6(4P) | Protocols | ICMP6(4P) |
icmp6 - Internet Control Message Protocol for Internet Protocol Version 6
#include <sys/socket.h> #include <netinet/in.h> #include <netinet/ip_icmp.h> #include <netinet/icmp6.h>
s = socket(AF_INET6, SOCK_RAW, proto);
t = t_open("/dev/icmp6", O_RDWR);
The ICMP6 protocol is the error and control message protocol used with Version 6 of the Internet Protocol. It is used by the kernel to handle and report errors in protocol processing. It is also used for IPv6 neighbor and router discovery, and for multicast group membership queries and reports. It may also be accessed by programs using the socket interface or the Transport Level Interface (TLI) for network monitoring and diagnostic functions. When used with the socket interface, a "raw socket" type is used. The protocol number for ICMP6, used in the proto parameter to the socket call, can be obtained from getprotobyname(3SOCKET). ICMP6 file descriptors and sockets are connectionless and are normally used with the t_sndudata / t_rcvudata and the sendto() / recvfrom() calls. They may also be used with the sendmsg()/recvgmsg() calls when sending or receiving ancillary data. In order to send ICMP6 packets, a process needs the PRIV_NET_ICMPACCESS privilege. (See privileges(7) for more information on privileges.)
Outgoing packets automatically have an Internet Protocol Version 6 (IPv6) header and zero or more IPv6 extension headers prepended. These headers are prepended by the kernel. Unlike ICMP for IPv4, the IP_HDRINCL option is not supported for ICMP6, so ICMP6 applications neither build their own outbound IPv6 headers, nor do they receive the inbound IPv6 headers with received data. IPv6 extension headers and relevant fields of the IPv6 header may be set or received as ancillary data to a sendmsg(3SOCKET) or recvmsg(3SOCKET) system call. Each of these fields and extension headers may also be set on a per socket basis with the setsockopt(3SOCKET) system call. Such "sticky" options are used on all outgoing packets unless overridden by ancillary data. When any ancillary data is present with a sendmsg(3SOCKET) system call, all sticky options are ignored for that system call, but subsequently remain configured.
ICMP6 is a datagram protocol layered above IPv6. Received ICMP6 messages may be reflected back to users of higher-level protocols such as TCP or UDP as error returns from system calls. A copy of each ICMP6 error message received by the system is provided to every holder of an open ICMP6 socket or TLI descriptor.
t_rcvudata(3NSL), t_sndudata(3NSL), getprotobyname(3SOCKET), recv(3SOCKET), recvmsg(3SOCKET), send(3SOCKET), sendmsg(3SOCKET), setsockopt(3SOCKET), inet6(4P), ip6(4P), routing(4P), privileges(7)
Conta, A. and Deering, S., RFC 2463, Internet Control Message Protocol (ICMPv6) for the Internet Protocol Version 6 (IPv6) Specification, The Internet Society, December 1998.
A socket operation may fail with one of the following errors returned:
EISCONN
ENOTCONN
ENOBUFS
EADDRNOTAVAIL
ENOMEM
ENOPROTOOPT
EINVAL
EAFNOSUPPORT
December 3, 2015 | OmniOS |