xref: /illumos-gate/usr/src/man/man4p/icmp6.4p (revision f137b22e734e85642da3e56e8b94da3f5f027c73)
te
Copyright (C) 1999, Sun Microsystems,
Inc. All Rights Reserved
The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
ICMP6 4P "Dec 03, 2015"
NAME
icmp6 - Internet Control Message Protocol for Internet Protocol Version 6
SYNOPSIS

#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);
DESCRIPTION

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.

SEE ALSO

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.

DIAGNOSTICS

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

An attempt was made 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

An attempt was made to send a datagram, but no destination address is specified, and the socket has not been connected.

ENOBUFS

The system ran out of memory for an internal data structure.

EADDRNOTAVAIL

An attempt was made to create a socket with a network address for which no network interface exists.

ENOMEM

The system was unable to allocate memory for an internal data structure.

ENOPROTOOPT

An attempt was made to set an IPv4 socket option on an IPv6 socket.

EINVAL

An attempt was made to set an invalid or malformed socket option.

EAFNOSUPPORT

An attempt was made to bind or connect to an IPv4 or mapped address, or to specify an IPv4 or mapped address as the next hop.