- Uniformly use .In for header file references.
[dragonfly.git] / share / man / man4 / icmp6.4
CommitLineData
f35d325e
HS
1.\" $KAME: icmp6.4,v 1.6 2004/12/27 05:30:56 itojun Exp $
2.\" $OpenBSD: icmp6.4,v 1.19 2004/12/23 20:33:03 jaredy Exp $
3.\" $FreeBSD: src/share/man/man4/icmp6.4,v 1.16 2005/01/23 16:02:48 gnn Exp $
44cb301e 4.\" $DragonFly: src/share/man/man4/icmp6.4,v 1.4 2006/05/26 19:39:39 swildner Exp $
984263bc
MD
5.\"
6.\" Copyright (c) 1986, 1991, 1993
f35d325e 7.\" The Regents of the University of California. All rights reserved.
984263bc
MD
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\" notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\" notice, this list of conditions and the following disclaimer in the
16.\" documentation and/or other materials provided with the distribution.
f35d325e 17.\" 3. Neither the name of the University nor the names of its contributors
984263bc
MD
18.\" may be used to endorse or promote products derived from this software
19.\" without specific prior written permission.
20.\"
21.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31.\" SUCH DAMAGE.
f35d325e 32.Dd December 20, 2004
984263bc
MD
33.Dt ICMP6 4
34.Os
984263bc
MD
35.Sh NAME
36.Nm icmp6
37.Nd Internet Control Message Protocol for IPv6
984263bc 38.Sh SYNOPSIS
984263bc
MD
39.In sys/socket.h
40.In netinet/in.h
41.In netinet/icmp6.h
42.Ft int
f35d325e 43.Fn socket AF_INET6 SOCK_RAW IPPROTO_ICMPV6
984263bc 44.Sh DESCRIPTION
f35d325e
HS
45ICMPv6 is the error and control message protocol used by IPv6 and the
46IPv6 protocol family (see
47.Xr ip6 4
48and
49.Xr inet6 4 ) .
984263bc
MD
50It may be accessed through a
51.Dq raw socket
52for network monitoring and diagnostic functions.
f35d325e 53.Pp
984263bc
MD
54The
55.Fa proto
f35d325e
HS
56parameter to the
57.Xr socket 2
58call to create an ICMPv6 socket may be obtained from
59.Xr getprotobyname 3 .
60ICMPv6 sockets are connectionless, and are normally used with the
984263bc
MD
61.Xr sendto 2
62and
63.Xr recvfrom 2
64calls, though the
65.Xr connect 2
66call may also be used to fix the destination for future packets
f35d325e 67(in which case
984263bc
MD
68.Xr read 2
69or
70.Xr recv 2
71and
72.Xr write 2
73or
74.Xr send 2
75system calls may be used).
76.Pp
f35d325e 77Outgoing packets automatically have an IPv6 header prepended to them
984263bc 78(based on the destination address).
f35d325e
HS
79Incoming packets on the socket are received with the IPv6 header and any
80extension headers removed.
81.Ss Types
82ICMPv6 messages are classified according to the type and code fields
83present in the ICMPv6 header.
84The abbreviations for the types and codes may be used in rules in
85.Xr pf.conf 5 .
86The following types are defined:
87.Bl -column x xxxxxxxxxxxx -offset indent
88.It Sy Num Ta Sy Abbrev. Ta Sy Description
89.It 1 Ta unreach Ta "Destination unreachable"
90.It 2 Ta toobig Ta "Packet too big"
91.It 3 Ta timex Ta "Time exceeded"
92.It 4 Ta paramprob Ta "Invalid IPv6 header"
93.It 128 Ta echoreq Ta "Echo service request"
94.It 129 Ta echorep Ta "Echo service reply"
95.It 130 Ta groupqry Ta "Group membership query"
96.It 130 Ta listqry Ta "Multicast listener query"
97.It 131 Ta grouprep Ta "Group membership report"
98.It 131 Ta listenrep Ta "Multicast listener report"
99.It 132 Ta groupterm Ta "Group membership termination"
100.It 132 Ta listendone Ta "Multicast listerner done"
101.It 133 Ta routersol Ta "Router solicitation"
102.It 134 Ta routeradv Ta "Router advertisement"
103.It 135 Ta neighbrsol Ta "Neighbor solicitation"
104.It 136 Ta neighbradv Ta "Neighbor advertisement"
105.It 137 Ta redir Ta "Shorter route exists"
106.It 138 Ta routrrenum Ta "Route renumbering"
107.It 139 Ta fqdnreq Ta "FQDN query"
108.It 139 Ta niqry Ta "Node information query"
109.It 139 Ta wrureq Ta "Who-are-you request"
110.It 140 Ta fqdnrep Ta "FQDN reply"
111.It 140 Ta nirep Ta "Node information reply"
112.It 140 Ta wrurep Ta "Who-are-you reply"
113.It 200 Ta mtraceresp Ta "mtrace response"
114.It 201 Ta mtrace Ta "mtrace messages"
115.El
116.Pp
117The following codes are defined:
118.Bl -column x xxxxxxxxxxxx xxxxxxxx -offset indent
119.It Sy Num Ta Sy Abbrev. Ta Sy Type Ta
120.Sy Description
121.It 0 Ta noroute-unr Ta unreach Ta "No route to destination"
122.It 1 Ta admin-unr Ta unreach Ta "Administratively prohibited"
123.It 2 Ta beyond-unr Ta unreach Ta "Beyond scope of source address"
124.It 2 Ta notnbr-unr Ta unreach Ta "Not a neighbor (obselete)"
125.It 3 Ta addr-unr Ta unreach Ta "Address unreachable"
126.It 4 Ta port-unr Ta unreach Ta "Port unreachable"
127.It 0 Ta transit Ta timex Ta "Time exceeded in transit"
128.It 1 Ta reassemb Ta timex Ta "Time exceeded in reassembly"
129.It 0 Ta badhead Ta paramprob Ta "Erroneous header field"
130.It 1 Ta nxthdr Ta paramprob Ta "Unrecognized next header"
131.It 2 Ta "" Ta redir Ta "Unrecognized option"
132.It 0 Ta redironlink Ta redir Ta "Redirection to on-link node"
133.It 1 Ta redirrouter Ta redir Ta "Redirection to better router"
134.El
135.Ss Headers
136All ICMPv6 messages are prefixed with an ICMPv6 header.
137This header corresponds to the
138.Vt icmp6_hdr
139structure and has the following definition:
140.Bd -literal -offset indent
141struct icmp6_hdr {
142 u_int8_t icmp6_type; /* type field */
143 u_int8_t icmp6_code; /* code field */
144 u_int16_t icmp6_cksum; /* checksum field */
145 union {
146 u_int32_t icmp6_un_data32[1]; /* type-specific */
147 u_int16_t icmp6_un_data16[2]; /* type-specific */
148 u_int8_t icmp6_un_data8[4]; /* type-specific */
149 } icmp6_dataun;
150} __packed;
151
152#define icmp6_data32 icmp6_dataun.icmp6_un_data32
153#define icmp6_data16 icmp6_dataun.icmp6_un_data16
154#define icmp6_data8 icmp6_dataun.icmp6_un_data8
155#define icmp6_pptr icmp6_data32[0] /* parameter prob */
156#define icmp6_mtu icmp6_data32[0] /* packet too big */
157#define icmp6_id icmp6_data16[0] /* echo request/reply */
158#define icmp6_seq icmp6_data16[1] /* echo request/reply */
159#define icmp6_maxdelay icmp6_data16[0] /* mcast group membership*/
160.Ed
984263bc 161.Pp
f35d325e
HS
162.Va icmp6_type
163describes the type of the message.
164Suitable values are defined in
44cb301e 165.In netinet/icmp6.h .
f35d325e
HS
166.Va icmp6_code
167describes the sub-type of the message and depends on
168.Va icmp6_type .
169.Va icmp6_cksum
170contains the checksum for the message and is filled in by the
171kernel on outgoing messages.
172The other fields are used for type-specific purposes.
173.Ss Filters
174Because of the extra functionality of ICMPv6 in comparison to ICMPv4,
175a larger number of messages may be potentially received on an ICMPv6
176socket.
177Input filters may therefore be used to restrict input to a subset of the
178incoming ICMPv6 messages so only interesting messages are returned by the
179.Xr recv 2
180family of calls to an application.
984263bc 181.Pp
f35d325e
HS
182The
183.Vt icmp6_filter
184structure may be used to refine the input message set according to the
185ICMPv6 type.
186By default, all messages types are allowed on newly created raw ICMPv6
187sockets.
188The following macros may be used to refine the input set:
189.Bl -tag -width Ds
190.It Fn "void ICMP6_FILTER_SETPASSALL" "struct icmp6_filter *filterp"
191Allow all incoming messages.
192.Va filterp
193is modified to allow all message types.
194.It Fn "void ICMP6_FILTER_SETBLOCKALL" "struct icmp6_filter *filterp"
195Ignore all incoming messages.
196.Va filterp
197is modified to ignore all message types.
198.It Fn "void ICMP6_FILTER_SETPASS" "int type" \
199 "struct icmp6_filter *filterp"
200Allow ICMPv6 messages with the given
201.Fa type .
202.Va filterp
203is modified to allow such messages.
204.It Fn "void ICMP6_FILTER_SETBLOCK" "int type" \
205 "struct icmp6_filter *filterp"
206Ignore ICMPv6 messages with the given
207.Fa type .
208.Va filterp
209is modified to ignore such messages.
210.It Fn "int ICMP6_FILTER_WILLPASS" "int type" \
211 "const struct icmp6_filter *filterp"
212Determine if the given filter will allow an ICMPv6 message of the given
213type.
214.It Fn "int ICMP6_FILTER_WILLBLOCK" "int type" \
215 "const struct icmp6_filter *filterp"
216Determine if the given filter will ignore an ICMPv6 message of the given
217type.
218.El
984263bc 219.Pp
f35d325e 220The
984263bc
MD
221.Xr getsockopt 2
222and
223.Xr setsockopt 2
f35d325e
HS
224calls may be used to obtain and install the filter on ICMPv6 sockets at
225option level
984263bc 226.Dv IPPROTO_ICMPV6
f35d325e
HS
227and name
228.Dv ICMPV6_FILTER
229with a pointer to the
230.Vt icmp6_filter
231structure as the option value.
984263bc 232.Sh SEE ALSO
f35d325e 233.Xr getsockopt 2 ,
984263bc
MD
234.Xr recv 2 ,
235.Xr send 2 ,
f35d325e
HS
236.Xr setsockopt 2 ,
237.Xr socket 2 ,
238.Xr getprotobyname 3 ,
984263bc 239.Xr inet6 4 ,
f35d325e
HS
240.Xr ip6 4 ,
241.Xr netintro 4
984263bc
MD
242.Rs
243.%A W. Stevens
244.%A M. Thomas
f35d325e
HS
245.%T Advanced Sockets API for IPv6
246.%N RFC 2292
984263bc 247.%D February 1998
984263bc
MD
248.Re
249.Rs
250.%A A. Conta
251.%A S. Deering
f35d325e
HS
252.%T "Internet Control Message Protocol (ICMPv6) for the Internet" \
253 "Protocol Version 6 (IPv6) Specification"
254.%N RFC 2463
984263bc 255.%D December 1998
984263bc 256.Re