]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - share/man/man4/icmp.4
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / share / man / man4 / icmp.4
1 .\" Copyright (c) 1986, 1991, 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\"    must display the following acknowledgement:
14 .\"     This product includes software developed by the University of
15 .\"     California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\"    may be used to endorse or promote products derived from this software
18 .\"    without specific prior written permission.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .\"     @(#)icmp.4      8.1 (Berkeley) 6/5/93
33 .\" $FreeBSD$
34 .\"
35 .Dd March 26, 2015
36 .Dt ICMP 4
37 .Os
38 .Sh NAME
39 .Nm icmp
40 .Nd Internet Control Message Protocol
41 .Sh SYNOPSIS
42 .In sys/types.h
43 .In sys/socket.h
44 .In netinet/in.h
45 .Ft int
46 .Fn socket AF_INET SOCK_RAW proto
47 .Sh DESCRIPTION
48 .Tn ICMP
49 is the error and control message protocol used
50 by
51 .Tn IP
52 and the Internet protocol family.
53 It may be accessed
54 through a
55 .Dq raw socket
56 for network monitoring
57 and diagnostic functions.
58 The
59 .Fa proto
60 parameter to the socket call to create an
61 .Tn ICMP
62 socket
63 is obtained from
64 .Xr getprotobyname 3 .
65 .Tn ICMP
66 sockets are connectionless,
67 and are normally used with the
68 .Xr sendto 2
69 and
70 .Xr recvfrom 2
71 calls, though the
72 .Xr connect 2
73 call may also be used to fix the destination for future
74 packets (in which case the
75 .Xr read 2
76 or
77 .Xr recv 2
78 and
79 .Xr write 2
80 or
81 .Xr send 2
82 system calls may be used).
83 .Pp
84 Outgoing packets automatically have an
85 .Tn IP
86 header prepended to
87 them (based on the destination address).
88 Incoming packets are received with the
89 .Tn IP
90 header and options intact.
91 .Ss Types
92 ICMP messages are classified according to the type and code fields
93 present in the ICMP header.
94 The abbreviations for the types and codes may be used in rules in
95 .Xr pf.conf 5 .
96 The following types are defined:
97 .Bl -column x xxxxxxxxxxxx -offset indent
98 .It Sy Num Ta Sy Abbrev. Ta Sy Description
99 .It 0 Ta echorep Ta "Echo reply"
100 .It 3 Ta unreach Ta "Destination unreachable"
101 .It 4 Ta squench Ta "Packet loss, slow down"
102 .It 5 Ta redir Ta "Shorter route exists"
103 .It 6 Ta althost Ta "Alternate host address"
104 .It 8 Ta echoreq Ta "Echo request"
105 .It 9 Ta routeradv Ta "Router advertisement"
106 .It 10 Ta routersol Ta "Router solicitation"
107 .It 11 Ta timex Ta "Time exceeded"
108 .It 12 Ta paramprob Ta "Invalid IP header"
109 .It 13 Ta timereq Ta "Timestamp request"
110 .It 14 Ta timerep Ta "Timestamp reply"
111 .It 15 Ta inforeq Ta "Information request"
112 .It 16 Ta inforep Ta "Information reply"
113 .It 17 Ta maskreq Ta "Address mask request"
114 .It 18 Ta maskrep Ta "Address mask reply"
115 .It 30 Ta trace Ta Traceroute
116 .It 31 Ta dataconv Ta "Data conversion problem"
117 .It 32 Ta mobredir Ta "Mobile host redirection"
118 .It 33 Ta ipv6-where Ta "IPv6 where-are-you"
119 .It 34 Ta ipv6-here Ta "IPv6 i-am-here"
120 .It 35 Ta mobregreq Ta "Mobile registration request"
121 .It 36 Ta mobregrep Ta "Mobile registration reply"
122 .It 39 Ta skip Ta SKIP
123 .It 40 Ta photuris Ta Photuris
124 .El
125 .Pp
126 The following codes are defined:
127 .Bl -column x xxxxxxxxxxxx xxxxxxxx -offset indent
128 .It Sy Num Ta Sy Abbrev. Ta Sy Type Ta Sy Description
129 .It 0 Ta net-unr Ta unreach Ta "Network unreachable"
130 .It 1 Ta host-unr Ta unreach Ta "Host unreachable"
131 .It 2 Ta proto-unr Ta unreach Ta "Protocol unreachable"
132 .It 3 Ta port-unr Ta unreach Ta "Port unreachable"
133 .It 4 Ta needfrag Ta unreach Ta "Fragmentation needed but DF bit set"
134 .It 5 Ta srcfail Ta unreach Ta "Source routing failed"
135 .It 6 Ta net-unk Ta unreach Ta "Network unknown"
136 .It 7 Ta host-unk Ta unreach Ta "Host unknown"
137 .It 8 Ta isolate Ta unreach Ta "Host isolated"
138 .It 9 Ta net-prohib Ta unreach Ta "Network administratively prohibited"
139 .It 10 Ta host-prohib Ta unreach Ta "Host administratively prohibited"
140 .It 11 Ta net-tos Ta unreach Ta "Invalid TOS for network"
141 .It 12 Ta host-tos Ta unreach Ta "Invalid TOS for host"
142 .It 13 Ta filter-prohib Ta unreach Ta "Prohibited access"
143 .It 14 Ta host-preced Ta unreach Ta "Precedence violation"
144 .It 15 Ta cutoff-preced Ta unreach Ta "Precedence cutoff"
145 .It 0 Ta redir-net Ta redir Ta "Shorter route for network"
146 .It 1 Ta redir-host Ta redir Ta "Shorter route for host"
147 .It 2 Ta redir-tos-net Ta redir Ta "Shorter route for TOS and network"
148 .It 3 Ta redir-tos-host Ta redir Ta "Shorter route for TOS and host"
149 .It 0 Ta normal-adv Ta routeradv Ta "Normal advertisement"
150 .It 16 Ta common-adv Ta routeradv Ta "Selective advertisement"
151 .It 0 Ta transit Ta timex Ta "Time exceeded in transit"
152 .It 1 Ta reassemb Ta timex Ta "Time exceeded in reassembly"
153 .It 0 Ta badhead Ta paramprob Ta "Invalid option pointer"
154 .It 1 Ta optmiss Ta paramprob Ta "Missing option"
155 .It 2 Ta badlen Ta paramprob Ta "Invalid length"
156 .It 1 Ta unknown-ind Ta photuris Ta "Unknown security index"
157 .It 2 Ta auth-fail Ta photuris Ta "Authentication failed"
158 .It 3 Ta decrypt-fail Ta photuris Ta "Decryption failed"
159 .El
160 .Ss MIB Variables
161 The
162 .Tn ICMP
163 protocol implements a number of variables in the
164 .Va net.inet.icmp
165 branch of the
166 .Xr sysctl 3
167 MIB.
168 .Bl -tag -width ".Va icmplim_output"
169 .It Va maskrepl
170 .Pq Vt boolean
171 Enable/disable replies to ICMP Address Mask Request packets.
172 Defaults to false.
173 .It Va maskfake
174 .Pq Vt "unsigned integer"
175 When
176 .Va maskrepl
177 is set and this value is non-zero,
178 it will be used instead of the real address mask when
179 the system replies to an ICMP Address Mask Request packet.
180 Defaults to 0.
181 .It Va icmplim
182 .Pq Vt integer
183 Bandwidth limit for ICMP replies in packets/second.
184 If set to zero, no limiting will occur.
185 Defaults to 200.
186 .It Va icmplim_output
187 .Pq Vt boolean
188 Enable/disable logging of ICMP replies bandwidth limiting.
189 Defaults to true.
190 .It Va drop_redirect
191 .Pq Vt boolean
192 Enable/disable dropping of ICMP Redirect packets.
193 Defaults to false.
194 .It Va log_redirect
195 .Pq Vt boolean
196 Enable/disable logging of ICMP Redirect packets.
197 Defaults to false.
198 .It Va bmcastecho
199 .Pq Vt boolean
200 Enable/disable ICMP replies received via broadcast or multicast.
201 Defaults to false.
202 .It Va reply_src
203 .Pq Vt str
204 An interface name used for the ICMP reply source in response to packets
205 which are not directly addressed to us.
206 By default continue with normal source selection.
207 .It Va reply_from_interface
208 .Pq Vt boolean
209 Use the IP address of the interface the packet came through in for
210 responses to packets which are not directly addressed to us.
211 If enabled, this rule is processed before all others.
212 By default, continue with normal source selection.
213 Enabling this option is particularly useful on routers because it
214 makes external traceroutes show the actual path a packet has taken
215 instead of the possibly different return path.
216 .It Va quotelen
217 .Pq Vt integer
218 Number of bytes from original packet to quote in ICMP reply.
219 This number is internally enforced to be at least 8 bytes (per RFC792)
220 and at most the maximal space left in the ICMP reply mbuf.
221 .It Va tstamprepl
222 .Pq Vt boolean
223 Enable/disable replies to ICMP Timestamp packets.
224 Defaults to true.
225 .El
226 .Sh ERRORS
227 A socket operation may fail with one of the following errors returned:
228 .Bl -tag -width Er
229 .It Bq Er EISCONN
230 when trying to establish a connection on a socket which
231 already has one, or when trying to send a datagram with the destination
232 address specified and the socket is already connected;
233 .It Bq Er ENOTCONN
234 when trying to send a datagram, but
235 no destination address is specified, and the socket has not been
236 connected;
237 .It Bq Er ENOBUFS
238 when the system runs out of memory for
239 an internal data structure;
240 .It Bq Er EADDRNOTAVAIL
241 when an attempt is made to create a
242 socket with a network address for which no network interface
243 exists.
244 .El
245 .Sh SEE ALSO
246 .Xr recv 2 ,
247 .Xr send 2 ,
248 .Xr inet 4 ,
249 .Xr intro 4 ,
250 .Xr ip 4 ,
251 .Xr pf.conf 5
252 .Sh HISTORY
253 The
254 .Nm
255 protocol appeared in
256 .Bx 4.3 .