ICMPV6(4)

NAME
icmpv6 - Internet Control Message Protocol (for IP version 6)

SYNOPSIS
#include <sys/socket.h>
#include <netinet6/in6.h>
int
socket(AF_INET6, SOCK_RAW, proto);

DESCRIPTION
ICMPv6 is the error and control message protocol used by IPv6 and the other protocols that run on top of IPv6. It may be accessed through a “raw socket” for network monitoring and diagnostic functions. The proto parameter to the socket call to create an ICMPv6 socket is obtained from getprotobyname(3). ICMPv6 sockets are connectionless, and are normally used with the sendto and recvfrom calls, though the connect(2) call may also be used to fix the destination for future packets (in which case the read(2) or recv(2) and write(2) or send(2) system calls may be used).

The ICMPv6 socket is not fully “raw”, because of what the kernel does to outgoing ICMPv6 packets. Outgoing packets automatically have an IPv6 header prepended to them (based on the destination address). Outgoing packets also have their ICMPv6 checksum computed for them, because unlike ICMP, ICMPv6 requires a pseudo-header checksum. This behavior is nullified by setting the IP_HDRINCL setsockopt, which makes an ICMPv6 socket truly raw. Incoming packets are received with the IPv6 header and options intact.

DIAGNOSTICS
A socket operation may fail with one of the following errors returned:

[EISCONN]
    when trying to establish a connection on a socket which already has one, or when trying to send a datagram with the destination address specified and the socket is already connected;

[ENOTCONN]
    when trying to send a datagram, but no destination address is specified, and the socket hasn't been connected;

[ENOBUFS]
    when the system runs out of memory for an internal data structure;

[EADDRNOTAVAIL]
    when an attempt is made to create a socket with a network address for which no network interface exists.

SEE ALSO
send(2), recv(2), netintro(4), inet6(4), ipv6(4)

HISTORY
The icmpv6 protocol first appeared in NRL's 4.4BSD IPv6 networking distribution.

The IPv6 extensions, including ICMPv6, were written by Ran Atkinson, Dan McDonald, Craig Metz, and Bao Phan of the U. S. Naval Research Laboratory.