xref: /freebsd/share/man/man4/icmp6.4 (revision 6b99842ada7bb3bd24c5fd4541e046994733757b)
16617cf57SGeorge V. Neville-Neil.\"	$KAME: icmp6.4,v 1.6 2004/12/27 05:30:56 itojun Exp $
26617cf57SGeorge V. Neville-Neil.\"	$OpenBSD: icmp6.4,v 1.19 2004/12/23 20:33:03 jaredy Exp $
36617cf57SGeorge V. Neville-Neil.\"
46617cf57SGeorge V. Neville-Neil.\" Copyright (c) 1986, 1991, 1993
56617cf57SGeorge V. Neville-Neil.\"     The Regents of the University of California.  All rights reserved.
66617cf57SGeorge V. Neville-Neil.\"
76617cf57SGeorge V. Neville-Neil.\" Redistribution and use in source and binary forms, with or without
86617cf57SGeorge V. Neville-Neil.\" modification, are permitted provided that the following conditions
96617cf57SGeorge V. Neville-Neil.\" are met:
106617cf57SGeorge V. Neville-Neil.\" 1. Redistributions of source code must retain the above copyright
116617cf57SGeorge V. Neville-Neil.\"    notice, this list of conditions and the following disclaimer.
126617cf57SGeorge V. Neville-Neil.\" 2. Redistributions in binary form must reproduce the above copyright
136617cf57SGeorge V. Neville-Neil.\"    notice, this list of conditions and the following disclaimer in the
146617cf57SGeorge V. Neville-Neil.\"    documentation and/or other materials provided with the distribution.
156617cf57SGeorge V. Neville-Neil.\" 3. Neither the name of the University nor the names of its contributors
166617cf57SGeorge V. Neville-Neil.\"    may be used to endorse or promote products derived from this software
176617cf57SGeorge V. Neville-Neil.\"    without specific prior written permission.
186617cf57SGeorge V. Neville-Neil.\"
196617cf57SGeorge V. Neville-Neil.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
206617cf57SGeorge V. Neville-Neil.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
216617cf57SGeorge V. Neville-Neil.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
226617cf57SGeorge V. Neville-Neil.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
236617cf57SGeorge V. Neville-Neil.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
246617cf57SGeorge V. Neville-Neil.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
256617cf57SGeorge V. Neville-Neil.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
266617cf57SGeorge V. Neville-Neil.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
276617cf57SGeorge V. Neville-Neil.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
286617cf57SGeorge V. Neville-Neil.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
296617cf57SGeorge V. Neville-Neil.\" SUCH DAMAGE.
306b806d21SRuslan Ermilov.\"
316b806d21SRuslan Ermilov.\" $FreeBSD$
326b806d21SRuslan Ermilov.\"
336617cf57SGeorge V. Neville-Neil.Dd December 20, 2004
346617cf57SGeorge V. Neville-Neil.Dt ICMP6 4
356617cf57SGeorge V. Neville-Neil.Os
366617cf57SGeorge V. Neville-Neil.Sh NAME
376617cf57SGeorge V. Neville-Neil.Nm icmp6
386617cf57SGeorge V. Neville-Neil.Nd Internet Control Message Protocol for IPv6
396617cf57SGeorge V. Neville-Neil.Sh SYNOPSIS
406617cf57SGeorge V. Neville-Neil.In sys/socket.h
416617cf57SGeorge V. Neville-Neil.In netinet/in.h
426617cf57SGeorge V. Neville-Neil.In netinet/icmp6.h
436617cf57SGeorge V. Neville-Neil.Ft int
446617cf57SGeorge V. Neville-Neil.Fn socket AF_INET6 SOCK_RAW IPPROTO_ICMPV6
456617cf57SGeorge V. Neville-Neil.Sh DESCRIPTION
466617cf57SGeorge V. Neville-NeilICMPv6 is the error and control message protocol used by IPv6 and the
476617cf57SGeorge V. Neville-NeilIPv6 protocol family (see
486617cf57SGeorge V. Neville-Neil.Xr ip6 4
496617cf57SGeorge V. Neville-Neiland
506617cf57SGeorge V. Neville-Neil.Xr inet6 4 ) .
516617cf57SGeorge V. Neville-NeilIt may be accessed through a
526617cf57SGeorge V. Neville-Neil.Dq raw socket
536617cf57SGeorge V. Neville-Neilfor network monitoring and diagnostic functions.
546617cf57SGeorge V. Neville-Neil.Pp
556617cf57SGeorge V. Neville-NeilThe
566617cf57SGeorge V. Neville-Neil.Fa proto
576617cf57SGeorge V. Neville-Neilparameter to the
586617cf57SGeorge V. Neville-Neil.Xr socket 2
596617cf57SGeorge V. Neville-Neilcall to create an ICMPv6 socket may be obtained from
606617cf57SGeorge V. Neville-Neil.Xr getprotobyname 3 .
616617cf57SGeorge V. Neville-NeilICMPv6 sockets are connectionless, and are normally used with the
626617cf57SGeorge V. Neville-Neil.Xr sendto 2
636617cf57SGeorge V. Neville-Neiland
646617cf57SGeorge V. Neville-Neil.Xr recvfrom 2
656617cf57SGeorge V. Neville-Neilcalls, though the
666617cf57SGeorge V. Neville-Neil.Xr connect 2
676617cf57SGeorge V. Neville-Neilcall may also be used to fix the destination for future packets
686617cf57SGeorge V. Neville-Neil(in which case
696617cf57SGeorge V. Neville-Neil.Xr read 2
706617cf57SGeorge V. Neville-Neilor
716617cf57SGeorge V. Neville-Neil.Xr recv 2
726617cf57SGeorge V. Neville-Neiland
736617cf57SGeorge V. Neville-Neil.Xr write 2
746617cf57SGeorge V. Neville-Neilor
756617cf57SGeorge V. Neville-Neil.Xr send 2
766617cf57SGeorge V. Neville-Neilsystem calls may be used).
776617cf57SGeorge V. Neville-Neil.Pp
786617cf57SGeorge V. Neville-NeilOutgoing packets automatically have an IPv6 header prepended to them
796617cf57SGeorge V. Neville-Neil(based on the destination address).
806617cf57SGeorge V. Neville-NeilIncoming packets on the socket are received with the IPv6 header and any
816617cf57SGeorge V. Neville-Neilextension headers removed.
826617cf57SGeorge V. Neville-Neil.Ss Types
836617cf57SGeorge V. Neville-NeilICMPv6 messages are classified according to the type and code fields
846617cf57SGeorge V. Neville-Neilpresent in the ICMPv6 header.
856617cf57SGeorge V. Neville-NeilThe abbreviations for the types and codes may be used in rules in
866617cf57SGeorge V. Neville-Neil.Xr pf.conf 5 .
876617cf57SGeorge V. Neville-NeilThe following types are defined:
886617cf57SGeorge V. Neville-Neil.Bl -column x xxxxxxxxxxxx -offset indent
896617cf57SGeorge V. Neville-Neil.It Sy Num Ta Sy Abbrev. Ta Sy Description
906617cf57SGeorge V. Neville-Neil.It 1 Ta unreach Ta "Destination unreachable"
916617cf57SGeorge V. Neville-Neil.It 2 Ta toobig Ta "Packet too big"
926617cf57SGeorge V. Neville-Neil.It 3 Ta timex Ta "Time exceeded"
936617cf57SGeorge V. Neville-Neil.It 4 Ta paramprob Ta "Invalid IPv6 header"
946617cf57SGeorge V. Neville-Neil.It 128 Ta echoreq Ta "Echo service request"
956617cf57SGeorge V. Neville-Neil.It 129 Ta echorep Ta "Echo service reply"
966617cf57SGeorge V. Neville-Neil.It 130 Ta groupqry Ta "Group membership query"
976617cf57SGeorge V. Neville-Neil.It 130 Ta listqry Ta "Multicast listener query"
986617cf57SGeorge V. Neville-Neil.It 131 Ta grouprep Ta "Group membership report"
996617cf57SGeorge V. Neville-Neil.It 131 Ta listenrep Ta "Multicast listener report"
1006617cf57SGeorge V. Neville-Neil.It 132 Ta groupterm Ta "Group membership termination"
101b06cfd40SJoel Dahl.It 132 Ta listendone Ta "Multicast listener done"
1026617cf57SGeorge V. Neville-Neil.It 133 Ta routersol Ta "Router solicitation"
1036617cf57SGeorge V. Neville-Neil.It 134 Ta routeradv Ta "Router advertisement"
1046617cf57SGeorge V. Neville-Neil.It 135 Ta neighbrsol Ta "Neighbor solicitation"
1056617cf57SGeorge V. Neville-Neil.It 136 Ta neighbradv Ta "Neighbor advertisement"
1066617cf57SGeorge V. Neville-Neil.It 137 Ta redir Ta "Shorter route exists"
1076617cf57SGeorge V. Neville-Neil.It 138 Ta routrrenum Ta "Route renumbering"
1086617cf57SGeorge V. Neville-Neil.It 139 Ta fqdnreq Ta "FQDN query"
1096617cf57SGeorge V. Neville-Neil.It 139 Ta niqry Ta "Node information query"
1106617cf57SGeorge V. Neville-Neil.It 139 Ta wrureq Ta "Who-are-you request"
1116617cf57SGeorge V. Neville-Neil.It 140 Ta fqdnrep Ta "FQDN reply"
1126617cf57SGeorge V. Neville-Neil.It 140 Ta nirep Ta "Node information reply"
1136617cf57SGeorge V. Neville-Neil.It 140 Ta wrurep Ta "Who-are-you reply"
1146617cf57SGeorge V. Neville-Neil.It 200 Ta mtraceresp Ta "mtrace response"
1156617cf57SGeorge V. Neville-Neil.It 201 Ta mtrace Ta "mtrace messages"
1166617cf57SGeorge V. Neville-Neil.El
1176617cf57SGeorge V. Neville-Neil.Pp
1186617cf57SGeorge V. Neville-NeilThe following codes are defined:
1196617cf57SGeorge V. Neville-Neil.Bl -column x xxxxxxxxxxxx xxxxxxxx -offset indent
1206617cf57SGeorge V. Neville-Neil.It Sy Num Ta Sy Abbrev. Ta Sy Type Ta
1216617cf57SGeorge V. Neville-Neil.Sy Description
1226617cf57SGeorge V. Neville-Neil.It 0 Ta noroute-unr Ta unreach Ta "No route to destination"
1236617cf57SGeorge V. Neville-Neil.It 1 Ta admin-unr Ta unreach Ta "Administratively prohibited"
1246617cf57SGeorge V. Neville-Neil.It 2 Ta beyond-unr Ta unreach Ta "Beyond scope of source address"
125b06cfd40SJoel Dahl.It 2 Ta notnbr-unr Ta unreach Ta "Not a neighbor (obsolete)"
1266617cf57SGeorge V. Neville-Neil.It 3 Ta addr-unr Ta unreach Ta "Address unreachable"
1276617cf57SGeorge V. Neville-Neil.It 4 Ta port-unr Ta unreach Ta "Port unreachable"
1286617cf57SGeorge V. Neville-Neil.It 0 Ta transit Ta timex Ta "Time exceeded in transit"
1296617cf57SGeorge V. Neville-Neil.It 1 Ta reassemb Ta timex Ta "Time exceeded in reassembly"
1306617cf57SGeorge V. Neville-Neil.It 0 Ta badhead Ta paramprob Ta "Erroneous header field"
1316617cf57SGeorge V. Neville-Neil.It 1 Ta nxthdr Ta paramprob Ta "Unrecognized next header"
1326617cf57SGeorge V. Neville-Neil.It 2 Ta "" Ta redir Ta "Unrecognized option"
1336617cf57SGeorge V. Neville-Neil.It 0 Ta redironlink Ta redir Ta "Redirection to on-link node"
1346617cf57SGeorge V. Neville-Neil.It 1 Ta redirrouter Ta redir Ta "Redirection to better router"
1356617cf57SGeorge V. Neville-Neil.El
1366617cf57SGeorge V. Neville-Neil.Ss Headers
1376617cf57SGeorge V. Neville-NeilAll ICMPv6 messages are prefixed with an ICMPv6 header.
1386617cf57SGeorge V. Neville-NeilThis header corresponds to the
1396617cf57SGeorge V. Neville-Neil.Vt icmp6_hdr
1406617cf57SGeorge V. Neville-Neilstructure and has the following definition:
1416617cf57SGeorge V. Neville-Neil.Bd -literal -offset indent
1426617cf57SGeorge V. Neville-Neilstruct icmp6_hdr {
143*6b99842aSEd Schouten	uint8_t  icmp6_type;	/* type field */
144*6b99842aSEd Schouten	uint8_t  icmp6_code;	/* code field */
145*6b99842aSEd Schouten	uint16_t icmp6_cksum;	/* checksum field */
1466617cf57SGeorge V. Neville-Neil	union {
147*6b99842aSEd Schouten		uint32_t icmp6_un_data32[1]; /* type-specific */
148*6b99842aSEd Schouten		uint16_t icmp6_un_data16[2]; /* type-specific */
149*6b99842aSEd Schouten		uint8_t  icmp6_un_data8[4];  /* type-specific */
1506617cf57SGeorge V. Neville-Neil	} icmp6_dataun;
1516617cf57SGeorge V. Neville-Neil} __packed;
1526617cf57SGeorge V. Neville-Neil
1536617cf57SGeorge V. Neville-Neil#define icmp6_data32	icmp6_dataun.icmp6_un_data32
1546617cf57SGeorge V. Neville-Neil#define icmp6_data16	icmp6_dataun.icmp6_un_data16
1556617cf57SGeorge V. Neville-Neil#define icmp6_data8	icmp6_dataun.icmp6_un_data8
1566617cf57SGeorge V. Neville-Neil#define icmp6_pptr	icmp6_data32[0]	/* parameter prob */
1576617cf57SGeorge V. Neville-Neil#define icmp6_mtu	icmp6_data32[0]	/* packet too big */
1586617cf57SGeorge V. Neville-Neil#define icmp6_id	icmp6_data16[0]	/* echo request/reply */
1596617cf57SGeorge V. Neville-Neil#define icmp6_seq	icmp6_data16[1]	/* echo request/reply */
1606617cf57SGeorge V. Neville-Neil#define icmp6_maxdelay	icmp6_data16[0]	/* mcast group membership*/
1616617cf57SGeorge V. Neville-Neil.Ed
1626617cf57SGeorge V. Neville-Neil.Pp
1636617cf57SGeorge V. Neville-Neil.Va icmp6_type
1646617cf57SGeorge V. Neville-Neildescribes the type of the message.
1656617cf57SGeorge V. Neville-NeilSuitable values are defined in
1666617cf57SGeorge V. Neville-Neil.Aq Pa netinet/icmp6.h .
1676617cf57SGeorge V. Neville-Neil.Va icmp6_code
1686617cf57SGeorge V. Neville-Neildescribes the sub-type of the message and depends on
1696617cf57SGeorge V. Neville-Neil.Va icmp6_type .
1706617cf57SGeorge V. Neville-Neil.Va icmp6_cksum
1716617cf57SGeorge V. Neville-Neilcontains the checksum for the message and is filled in by the
1726617cf57SGeorge V. Neville-Neilkernel on outgoing messages.
1736617cf57SGeorge V. Neville-NeilThe other fields are used for type-specific purposes.
1746617cf57SGeorge V. Neville-Neil.Ss Filters
1756617cf57SGeorge V. Neville-NeilBecause of the extra functionality of ICMPv6 in comparison to ICMPv4,
1766617cf57SGeorge V. Neville-Neila larger number of messages may be potentially received on an ICMPv6
1776617cf57SGeorge V. Neville-Neilsocket.
1786617cf57SGeorge V. Neville-NeilInput filters may therefore be used to restrict input to a subset of the
1796617cf57SGeorge V. Neville-Neilincoming ICMPv6 messages so only interesting messages are returned by the
1806617cf57SGeorge V. Neville-Neil.Xr recv 2
1816617cf57SGeorge V. Neville-Neilfamily of calls to an application.
1826617cf57SGeorge V. Neville-Neil.Pp
1836617cf57SGeorge V. Neville-NeilThe
1846617cf57SGeorge V. Neville-Neil.Vt icmp6_filter
1856617cf57SGeorge V. Neville-Neilstructure may be used to refine the input message set according to the
1866617cf57SGeorge V. Neville-NeilICMPv6 type.
1876617cf57SGeorge V. Neville-NeilBy default, all messages types are allowed on newly created raw ICMPv6
1886617cf57SGeorge V. Neville-Neilsockets.
1896617cf57SGeorge V. Neville-NeilThe following macros may be used to refine the input set:
1906617cf57SGeorge V. Neville-Neil.Bl -tag -width Ds
1916617cf57SGeorge V. Neville-Neil.It Fn "void ICMP6_FILTER_SETPASSALL" "struct icmp6_filter *filterp"
1926617cf57SGeorge V. Neville-NeilAllow all incoming messages.
1936617cf57SGeorge V. Neville-Neil.Va filterp
1946617cf57SGeorge V. Neville-Neilis modified to allow all message types.
1956617cf57SGeorge V. Neville-Neil.It Fn "void ICMP6_FILTER_SETBLOCKALL" "struct icmp6_filter *filterp"
1966617cf57SGeorge V. Neville-NeilIgnore all incoming messages.
1976617cf57SGeorge V. Neville-Neil.Va filterp
1986617cf57SGeorge V. Neville-Neilis modified to ignore all message types.
1994f068961SRuslan Ermilov.It Xo
2004f068961SRuslan Ermilov.Ft void
2014f068961SRuslan Ermilov.Fn ICMP6_FILTER_SETPASS "int type" "struct icmp6_filter *filterp"
2024f068961SRuslan Ermilov.Xc
2036617cf57SGeorge V. Neville-NeilAllow ICMPv6 messages with the given
2046617cf57SGeorge V. Neville-Neil.Fa type .
2056617cf57SGeorge V. Neville-Neil.Va filterp
2066617cf57SGeorge V. Neville-Neilis modified to allow such messages.
2074f068961SRuslan Ermilov.It Xo
2084f068961SRuslan Ermilov.Ft void
2094f068961SRuslan Ermilov.Fn ICMP6_FILTER_SETBLOCK" "int type" "struct icmp6_filter *filterp"
2104f068961SRuslan Ermilov.Xc
2116617cf57SGeorge V. Neville-NeilIgnore ICMPv6 messages with the given
2126617cf57SGeorge V. Neville-Neil.Fa type .
2136617cf57SGeorge V. Neville-Neil.Va filterp
2146617cf57SGeorge V. Neville-Neilis modified to ignore such messages.
2154f068961SRuslan Ermilov.It Xo
2164f068961SRuslan Ermilov.Ft int
2174f068961SRuslan Ermilov.Fn ICMP6_FILTER_WILLPASS" "int type" "const struct icmp6_filter *filterp"
2184f068961SRuslan Ermilov.Xc
2196617cf57SGeorge V. Neville-NeilDetermine if the given filter will allow an ICMPv6 message of the given
2206617cf57SGeorge V. Neville-Neiltype.
2214f068961SRuslan Ermilov.It Xo
2224f068961SRuslan Ermilov.Ft int
2234f068961SRuslan Ermilov.Fn ICMP6_FILTER_WILLBLOCK" "int type" "const struct icmp6_filter *filterp"
2244f068961SRuslan Ermilov.Xc
2256617cf57SGeorge V. Neville-NeilDetermine if the given filter will ignore an ICMPv6 message of the given
2266617cf57SGeorge V. Neville-Neiltype.
2276617cf57SGeorge V. Neville-Neil.El
2286617cf57SGeorge V. Neville-Neil.Pp
2296617cf57SGeorge V. Neville-NeilThe
2306617cf57SGeorge V. Neville-Neil.Xr getsockopt 2
2316617cf57SGeorge V. Neville-Neiland
2326617cf57SGeorge V. Neville-Neil.Xr setsockopt 2
2336617cf57SGeorge V. Neville-Neilcalls may be used to obtain and install the filter on ICMPv6 sockets at
2346617cf57SGeorge V. Neville-Neiloption level
2356617cf57SGeorge V. Neville-Neil.Dv IPPROTO_ICMPV6
2366617cf57SGeorge V. Neville-Neiland name
2376617cf57SGeorge V. Neville-Neil.Dv ICMPV6_FILTER
2386617cf57SGeorge V. Neville-Neilwith a pointer to the
2396617cf57SGeorge V. Neville-Neil.Vt icmp6_filter
2406617cf57SGeorge V. Neville-Neilstructure as the option value.
2416617cf57SGeorge V. Neville-Neil.Sh SEE ALSO
2426617cf57SGeorge V. Neville-Neil.Xr getsockopt 2 ,
2436617cf57SGeorge V. Neville-Neil.Xr recv 2 ,
2446617cf57SGeorge V. Neville-Neil.Xr send 2 ,
2456617cf57SGeorge V. Neville-Neil.Xr setsockopt 2 ,
2466617cf57SGeorge V. Neville-Neil.Xr socket 2 ,
2476617cf57SGeorge V. Neville-Neil.Xr getprotobyname 3 ,
2486617cf57SGeorge V. Neville-Neil.Xr inet6 4 ,
2496617cf57SGeorge V. Neville-Neil.Xr ip6 4 ,
2506617cf57SGeorge V. Neville-Neil.Xr netintro 4
2516617cf57SGeorge V. Neville-Neil.Rs
2526617cf57SGeorge V. Neville-Neil.%A W. Stevens
2536617cf57SGeorge V. Neville-Neil.%A M. Thomas
2546617cf57SGeorge V. Neville-Neil.%T Advanced Sockets API for IPv6
2556617cf57SGeorge V. Neville-Neil.%N RFC 2292
2566617cf57SGeorge V. Neville-Neil.%D February 1998
2576617cf57SGeorge V. Neville-Neil.Re
2586617cf57SGeorge V. Neville-Neil.Rs
2596617cf57SGeorge V. Neville-Neil.%A A. Conta
2606617cf57SGeorge V. Neville-Neil.%A S. Deering
2616617cf57SGeorge V. Neville-Neil.%T "Internet Control Message Protocol (ICMPv6) for the Internet" \
2626617cf57SGeorge V. Neville-Neil    "Protocol Version 6 (IPv6) Specification"
2636617cf57SGeorge V. Neville-Neil.%N RFC 2463
2646617cf57SGeorge V. Neville-Neil.%D December 1998
2656617cf57SGeorge V. Neville-Neil.Re
266