Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

icmp6(4) [opendarwin man page]

ICMP6(4)						   BSD Kernel Interfaces Manual 						  ICMP6(4)

NAME
icmp6 -- Internet Control Message Protocol for IPv6 SYNOPSIS
#include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netinet/icmp6.h> int socket(AF_INET6, SOCK_RAW, proto); DESCRIPTION
ICMPv6 is the error and control message protocol used by IPv6 and the Internet protocol family. 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), or you can use IPPROTO_ICMPV6. ICMPv6 sockets are connectionless, and are normally used with the sendto(2) and recvfrom(2) 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). Outgoing packets automatically have an IPv6 header prepended to them (based on the destination address). ICMPv6 pseudo header checksum field (icmp6_cksum) will be filled automatically by the kernel. Incoming packets are received without the IPv6 header nor IPv6 extension headers. Notice that this behavior is opposite from IPv4 raw sockets and. ICMPv4 sockets. ICMPv6 type/code filter Each ICMPv6 raw socket has an associated filter whose datatype is defined as struct icmp6_filter; This structure, along with the macros and constants defined later in this section, are defined as a result of including the <netinet/icmp6.h> header. The current filter is fetched and stored using getsockopt(2) and setsockopt(2) with a level of IPPROTO_ICMPV6 and an option name of ICMP6_FILTER. Six macros operate on an icmp6_filter structure: void ICMP6_FILTER_SETPASSALL(struct icmp6_filter *filterp) void ICMP6_FILTER_SETBLOCKALL(struct icmp6_filter *filterp) void ICMP6_FILTER_SETPASS(int type, struct icmp6_filter *filterp) void ICMP6_FILTER_SETBLOCK(int type, struct icmp6_filter *filterp) int ICMP6_FILTER_WILLPASS(int type, const struct icmp6_filter *filterp) int ICMP6_FILTER_WILLBLOCK(int type, const struct icmp6_filter *filterp) The first argument to the last four macros (an integer) is an ICMPv6 message type, between 0 and 255. The pointer argument to all six macros is a pointer to a filter that is modified by the first four macros examined by the last two macros. The first two macros, SETPASSALL and SETBLOCKALL, let us specify that all ICMPv6 messages are passed to the application or that all ICMPv6 messages are blocked from being passed to the application. The next two macros, SETPASS and SETBLOCK, let us specify that messages of a given ICMPv6 type should be passed to the application or not passed to the application (blocked). The final two macros, WILLPASS and WILLBLOCK, return true or false depending whether the specified message type is passed to the application or blocked from being passed to the application by the filter pointed to by the second argument. When an ICMPv6 raw socket is created, it will by default pass all ICMPv6 message types to the application. For further discussions see RFC2292. ERRORS
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 desti- nation 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
recv(2), send(2), inet6(4), intro(4), ip6(4) W. Stevens and M. Thomas, Advanced Sockets API for IPv6, RFC, 2292, February 1998. A. Conta and S. Deering, Internet Control Message Protocol (ICMPv6) for the Internet Protocol Version 6 (IPv6) Specification, RFC, 2463, December 1998. HISTORY
The implementation is based on KAME stack (which is descendant of WIDE hydrangea IPv6 stack kit). Part of the document was shamelessly copied from RFC2292. BSD
March 13, 2000 BSD
Man Page