icmp6(4) - NetBSD Manual Pages

ICMP6(4)                  NetBSD Programmer's Manual                  ICMP6(4)


NAME
icmp6 - Internet Control Message Protocol for IPv6
SYNOPSIS
#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 In- ternet 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 pack- ets are received without the IPv6 header nor IPv6 extension headers. No- tice 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> head- er. 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: ICMP6_FILTER_SETPASSALL(struct icmp6_filter *) ICMP6_FILTER_SETBLOCKALL(struct icmp6_filter *) ICMP6_FILTER_SETPASS(int, struct icmp6_filter *) ICMP6_FILTER_SETBLOCK(int, struct icmp6_filter *) ICMP6_FILTER_WILLPASS(int, const struct icmp6_filter *) ICMP6_FILTER_WILLBLOCK(int, const struct icmp6_filter *) The first argument to the last four macros (an integer) is an ICMPv6 mes- sage 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 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 de- pending 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.
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 al- ready connected; [ENOTCONN] when trying to send a datagram, but no destination ad- dress is specified, and the socket hasn't been connect- ed; [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 net- work 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. NetBSD 1.6 December 17, 1999 2

Powered by man-cgi (2024-08-26). Maintained for NetBSD by Kimmo Suominen. Based on man-cgi by Panagiotis Christias.