xref: /freebsd/share/man/man4/icmp.4 (revision ace68b1f362953edef79809accb128ad05ffab33)
1afe61c15SRodney W. Grimes.\" Copyright (c) 1986, 1991, 1993
2afe61c15SRodney W. Grimes.\"	The Regents of the University of California.  All rights reserved.
3afe61c15SRodney W. Grimes.\"
4afe61c15SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
5afe61c15SRodney W. Grimes.\" modification, are permitted provided that the following conditions
6afe61c15SRodney W. Grimes.\" are met:
7afe61c15SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
8afe61c15SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
9afe61c15SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
10afe61c15SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
11afe61c15SRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
12dda5b397SEitan Adler.\" 3. Neither the name of the University nor the names of its contributors
13afe61c15SRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
14afe61c15SRodney W. Grimes.\"    without specific prior written permission.
15afe61c15SRodney W. Grimes.\"
16afe61c15SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17afe61c15SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18afe61c15SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19afe61c15SRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20afe61c15SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21afe61c15SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22afe61c15SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23afe61c15SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24afe61c15SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25afe61c15SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26afe61c15SRodney W. Grimes.\" SUCH DAMAGE.
27afe61c15SRodney W. Grimes.\"
28afe61c15SRodney W. Grimes.\"     @(#)icmp.4	8.1 (Berkeley) 6/5/93
297f3dea24SPeter Wemm.\" $FreeBSD$
30afe61c15SRodney W. Grimes.\"
31*ace68b1fSMike Karels.Dd July 20, 2022
32afe61c15SRodney W. Grimes.Dt ICMP 4
333d45e180SRuslan Ermilov.Os
34afe61c15SRodney W. Grimes.Sh NAME
35afe61c15SRodney W. Grimes.Nm icmp
36afe61c15SRodney W. Grimes.Nd Internet Control Message Protocol
37afe61c15SRodney W. Grimes.Sh SYNOPSIS
3832eef9aeSRuslan Ermilov.In sys/types.h
3932eef9aeSRuslan Ermilov.In sys/socket.h
4032eef9aeSRuslan Ermilov.In netinet/in.h
41afe61c15SRodney W. Grimes.Ft int
42afe61c15SRodney W. Grimes.Fn socket AF_INET SOCK_RAW proto
43afe61c15SRodney W. Grimes.Sh DESCRIPTION
44afe61c15SRodney W. Grimes.Tn ICMP
45afe61c15SRodney W. Grimesis the error and control message protocol used
46afe61c15SRodney W. Grimesby
47afe61c15SRodney W. Grimes.Tn IP
48b5e7e999SRuslan Ermilovand the Internet protocol family.
49b5e7e999SRuslan ErmilovIt may be accessed
50afe61c15SRodney W. Grimesthrough a
51afe61c15SRodney W. Grimes.Dq raw socket
52afe61c15SRodney W. Grimesfor network monitoring
53afe61c15SRodney W. Grimesand diagnostic functions.
54afe61c15SRodney W. GrimesThe
55afe61c15SRodney W. Grimes.Fa proto
56afe61c15SRodney W. Grimesparameter to the socket call to create an
57afe61c15SRodney W. Grimes.Tn ICMP
58afe61c15SRodney W. Grimessocket
59afe61c15SRodney W. Grimesis obtained from
60afe61c15SRodney W. Grimes.Xr getprotobyname 3 .
61afe61c15SRodney W. Grimes.Tn ICMP
62afe61c15SRodney W. Grimessockets are connectionless,
63afe61c15SRodney W. Grimesand are normally used with the
64edf0e5b3SMike Pritchard.Xr sendto 2
65afe61c15SRodney W. Grimesand
66edf0e5b3SMike Pritchard.Xr recvfrom 2
67afe61c15SRodney W. Grimescalls, though the
68afe61c15SRodney W. Grimes.Xr connect 2
69afe61c15SRodney W. Grimescall may also be used to fix the destination for future
70afe61c15SRodney W. Grimespackets (in which case the
71afe61c15SRodney W. Grimes.Xr read 2
72afe61c15SRodney W. Grimesor
73afe61c15SRodney W. Grimes.Xr recv 2
74afe61c15SRodney W. Grimesand
75afe61c15SRodney W. Grimes.Xr write 2
76afe61c15SRodney W. Grimesor
77afe61c15SRodney W. Grimes.Xr send 2
78afe61c15SRodney W. Grimessystem calls may be used).
79afe61c15SRodney W. Grimes.Pp
80afe61c15SRodney W. GrimesOutgoing packets automatically have an
81afe61c15SRodney W. Grimes.Tn IP
82afe61c15SRodney W. Grimesheader prepended to
83afe61c15SRodney W. Grimesthem (based on the destination address).
84afe61c15SRodney W. GrimesIncoming packets are received with the
85afe61c15SRodney W. Grimes.Tn IP
86afe61c15SRodney W. Grimesheader and options intact.
873467360dSBruce M Simpson.Ss Types
883467360dSBruce M SimpsonICMP messages are classified according to the type and code fields
893467360dSBruce M Simpsonpresent in the ICMP header.
903467360dSBruce M SimpsonThe abbreviations for the types and codes may be used in rules in
913467360dSBruce M Simpson.Xr pf.conf 5 .
923467360dSBruce M SimpsonThe following types are defined:
933467360dSBruce M Simpson.Bl -column x xxxxxxxxxxxx -offset indent
943467360dSBruce M Simpson.It Sy Num Ta Sy Abbrev. Ta Sy Description
953467360dSBruce M Simpson.It 0 Ta echorep Ta "Echo reply"
963467360dSBruce M Simpson.It 3 Ta unreach Ta "Destination unreachable"
973467360dSBruce M Simpson.It 4 Ta squench Ta "Packet loss, slow down"
983467360dSBruce M Simpson.It 5 Ta redir Ta "Shorter route exists"
993467360dSBruce M Simpson.It 6 Ta althost Ta "Alternate host address"
1003467360dSBruce M Simpson.It 8 Ta echoreq Ta "Echo request"
1013467360dSBruce M Simpson.It 9 Ta routeradv Ta "Router advertisement"
1023467360dSBruce M Simpson.It 10 Ta routersol Ta "Router solicitation"
1033467360dSBruce M Simpson.It 11 Ta timex Ta "Time exceeded"
1043467360dSBruce M Simpson.It 12 Ta paramprob Ta "Invalid IP header"
1053467360dSBruce M Simpson.It 13 Ta timereq Ta "Timestamp request"
1063467360dSBruce M Simpson.It 14 Ta timerep Ta "Timestamp reply"
1073467360dSBruce M Simpson.It 15 Ta inforeq Ta "Information request"
1083467360dSBruce M Simpson.It 16 Ta inforep Ta "Information reply"
1093467360dSBruce M Simpson.It 17 Ta maskreq Ta "Address mask request"
1103467360dSBruce M Simpson.It 18 Ta maskrep Ta "Address mask reply"
1113467360dSBruce M Simpson.It 30 Ta trace Ta Traceroute
1123467360dSBruce M Simpson.It 31 Ta dataconv Ta "Data conversion problem"
1133467360dSBruce M Simpson.It 32 Ta mobredir Ta "Mobile host redirection"
1143467360dSBruce M Simpson.It 33 Ta ipv6-where Ta "IPv6 where-are-you"
1153467360dSBruce M Simpson.It 34 Ta ipv6-here Ta "IPv6 i-am-here"
1163467360dSBruce M Simpson.It 35 Ta mobregreq Ta "Mobile registration request"
1173467360dSBruce M Simpson.It 36 Ta mobregrep Ta "Mobile registration reply"
1183467360dSBruce M Simpson.It 39 Ta skip Ta SKIP
1193467360dSBruce M Simpson.It 40 Ta photuris Ta Photuris
1203467360dSBruce M Simpson.El
1213467360dSBruce M Simpson.Pp
1223467360dSBruce M SimpsonThe following codes are defined:
1233467360dSBruce M Simpson.Bl -column x xxxxxxxxxxxx xxxxxxxx -offset indent
1243467360dSBruce M Simpson.It Sy Num Ta Sy Abbrev. Ta Sy Type Ta Sy Description
1253467360dSBruce M Simpson.It 0 Ta net-unr Ta unreach Ta "Network unreachable"
1263467360dSBruce M Simpson.It 1 Ta host-unr Ta unreach Ta "Host unreachable"
1273467360dSBruce M Simpson.It 2 Ta proto-unr Ta unreach Ta "Protocol unreachable"
1283467360dSBruce M Simpson.It 3 Ta port-unr Ta unreach Ta "Port unreachable"
1293467360dSBruce M Simpson.It 4 Ta needfrag Ta unreach Ta "Fragmentation needed but DF bit set"
1303467360dSBruce M Simpson.It 5 Ta srcfail Ta unreach Ta "Source routing failed"
1313467360dSBruce M Simpson.It 6 Ta net-unk Ta unreach Ta "Network unknown"
1323467360dSBruce M Simpson.It 7 Ta host-unk Ta unreach Ta "Host unknown"
1333467360dSBruce M Simpson.It 8 Ta isolate Ta unreach Ta "Host isolated"
1343467360dSBruce M Simpson.It 9 Ta net-prohib Ta unreach Ta "Network administratively prohibited"
1353467360dSBruce M Simpson.It 10 Ta host-prohib Ta unreach Ta "Host administratively prohibited"
1363467360dSBruce M Simpson.It 11 Ta net-tos Ta unreach Ta "Invalid TOS for network"
1373467360dSBruce M Simpson.It 12 Ta host-tos Ta unreach Ta "Invalid TOS for host"
1383467360dSBruce M Simpson.It 13 Ta filter-prohib Ta unreach Ta "Prohibited access"
1393467360dSBruce M Simpson.It 14 Ta host-preced Ta unreach Ta "Precedence violation"
1403467360dSBruce M Simpson.It 15 Ta cutoff-preced Ta unreach Ta "Precedence cutoff"
1413467360dSBruce M Simpson.It 0 Ta redir-net Ta redir Ta "Shorter route for network"
1423467360dSBruce M Simpson.It 1 Ta redir-host Ta redir Ta "Shorter route for host"
1433467360dSBruce M Simpson.It 2 Ta redir-tos-net Ta redir Ta "Shorter route for TOS and network"
1443467360dSBruce M Simpson.It 3 Ta redir-tos-host Ta redir Ta "Shorter route for TOS and host"
1453467360dSBruce M Simpson.It 0 Ta normal-adv Ta routeradv Ta "Normal advertisement"
1463467360dSBruce M Simpson.It 16 Ta common-adv Ta routeradv Ta "Selective advertisement"
1473467360dSBruce M Simpson.It 0 Ta transit Ta timex Ta "Time exceeded in transit"
1483467360dSBruce M Simpson.It 1 Ta reassemb Ta timex Ta "Time exceeded in reassembly"
1493467360dSBruce M Simpson.It 0 Ta badhead Ta paramprob Ta "Invalid option pointer"
1503467360dSBruce M Simpson.It 1 Ta optmiss Ta paramprob Ta "Missing option"
1513467360dSBruce M Simpson.It 2 Ta badlen Ta paramprob Ta "Invalid length"
1523467360dSBruce M Simpson.It 1 Ta unknown-ind Ta photuris Ta "Unknown security index"
1533467360dSBruce M Simpson.It 2 Ta auth-fail Ta photuris Ta "Authentication failed"
1543467360dSBruce M Simpson.It 3 Ta decrypt-fail Ta photuris Ta "Decryption failed"
1553467360dSBruce M Simpson.El
1567726f76fSRuslan Ermilov.Ss MIB Variables
1577726f76fSRuslan ErmilovThe
1587726f76fSRuslan Ermilov.Tn ICMP
1597726f76fSRuslan Ermilovprotocol implements a number of variables in the
1607726f76fSRuslan Ermilov.Va net.inet.icmp
1617726f76fSRuslan Ermilovbranch of the
1627726f76fSRuslan Ermilov.Xr sysctl 3
1637726f76fSRuslan ErmilovMIB.
1647726f76fSRuslan Ermilov.Bl -tag -width ".Va icmplim_output"
165*ace68b1fSMike Karels.It Va bmcastecho
1667726f76fSRuslan Ermilov.Pq Vt boolean
167*ace68b1fSMike KarelsEnable/disable ICMP replies received via broadcast or multicast.
1687726f76fSRuslan ErmilovDefaults to false.
169*ace68b1fSMike Karels.It Va drop_redirect
170*ace68b1fSMike Karels.Pq Vt boolean
171*ace68b1fSMike KarelsEnable/disable dropping of ICMP Redirect packets.
172*ace68b1fSMike KarelsDefaults to false.
1737726f76fSRuslan Ermilov.It Va icmplim
1747726f76fSRuslan Ermilov.Pq Vt integer
1757726f76fSRuslan ErmilovBandwidth limit for ICMP replies in packets/second.
176532ef888SRuslan ErmilovIf set to zero, no limiting will occur.
1777726f76fSRuslan ErmilovDefaults to 200.
1787726f76fSRuslan Ermilov.It Va icmplim_output
1797726f76fSRuslan Ermilov.Pq Vt boolean
180532ef888SRuslan ErmilovEnable/disable logging of ICMP replies bandwidth limiting.
1817726f76fSRuslan ErmilovDefaults to true.
1827726f76fSRuslan Ermilov.It Va log_redirect
1837726f76fSRuslan Ermilov.Pq Vt boolean
1847726f76fSRuslan ErmilovEnable/disable logging of ICMP Redirect packets.
1857726f76fSRuslan ErmilovDefaults to false.
186*ace68b1fSMike Karels.It Va maskfake
187*ace68b1fSMike Karels.Pq Vt "unsigned integer"
188*ace68b1fSMike KarelsWhen
189*ace68b1fSMike Karels.Va maskrepl
190*ace68b1fSMike Karelsis set and this value is non-zero,
191*ace68b1fSMike Karelsit will be used instead of the real address mask when
192*ace68b1fSMike Karelsthe system replies to an ICMP Address Mask Request packet.
193*ace68b1fSMike KarelsDefaults to 0.
194*ace68b1fSMike Karels.It Va maskrepl
1957726f76fSRuslan Ermilov.Pq Vt boolean
196*ace68b1fSMike KarelsEnable/disable replies to ICMP Address Mask Request packets.
1977726f76fSRuslan ErmilovDefaults to false.
198*ace68b1fSMike Karels.It Va quotelen
199*ace68b1fSMike Karels.Pq Vt integer
200*ace68b1fSMike KarelsNumber of bytes from original packet to quote in ICMP reply.
201*ace68b1fSMike KarelsThis number is internally enforced to be at least 8 bytes (per RFC792)
202*ace68b1fSMike Karelsand at most the maximal space left in the ICMP reply mbuf.
203a0866c8dSAndre Oppermann.It Va reply_from_interface
204a0866c8dSAndre Oppermann.Pq Vt boolean
205a0866c8dSAndre OppermannUse the IP address of the interface the packet came through in for
206a0866c8dSAndre Oppermannresponses to packets which are not directly addressed to us.
20778ad5421SRuslan ErmilovIf enabled, this rule is processed before all others.
20878ad5421SRuslan ErmilovBy default, continue with normal source selection.
209a0866c8dSAndre OppermannEnabling this option is particularly useful on routers because it
210a0866c8dSAndre Oppermannmakes external traceroutes show the actual path a packet has taken
211a0866c8dSAndre Oppermanninstead of the possibly different return path.
212*ace68b1fSMike Karels.It Va reply_src
213*ace68b1fSMike Karels.Pq Vt str
214*ace68b1fSMike KarelsAn interface name used for the ICMP reply source in response to packets
215*ace68b1fSMike Karelswhich are not directly addressed to us.
216*ace68b1fSMike KarelsBy default continue with normal source selection.
21700cb6befSMark Johnston.It Va tstamprepl
21800cb6befSMark Johnston.Pq Vt boolean
21900cb6befSMark JohnstonEnable/disable replies to ICMP Timestamp packets.
22000cb6befSMark JohnstonDefaults to true.
2217726f76fSRuslan Ermilov.El
222ef0180edSDima Dorfman.Sh ERRORS
223afe61c15SRodney W. GrimesA socket operation may fail with one of the following errors returned:
224ef0180edSDima Dorfman.Bl -tag -width Er
225afe61c15SRodney W. Grimes.It Bq Er EISCONN
226afe61c15SRodney W. Grimeswhen trying to establish a connection on a socket which
227afe61c15SRodney W. Grimesalready has one, or when trying to send a datagram with the destination
228afe61c15SRodney W. Grimesaddress specified and the socket is already connected;
229afe61c15SRodney W. Grimes.It Bq Er ENOTCONN
230afe61c15SRodney W. Grimeswhen trying to send a datagram, but
2310227791bSRuslan Ermilovno destination address is specified, and the socket has not been
232afe61c15SRodney W. Grimesconnected;
233afe61c15SRodney W. Grimes.It Bq Er ENOBUFS
234afe61c15SRodney W. Grimeswhen the system runs out of memory for
235afe61c15SRodney W. Grimesan internal data structure;
236afe61c15SRodney W. Grimes.It Bq Er EADDRNOTAVAIL
237afe61c15SRodney W. Grimeswhen an attempt is made to create a
238afe61c15SRodney W. Grimessocket with a network address for which no network interface
239afe61c15SRodney W. Grimesexists.
240afe61c15SRodney W. Grimes.El
241afe61c15SRodney W. Grimes.Sh SEE ALSO
242afe61c15SRodney W. Grimes.Xr recv 2 ,
2430b992c1dSWolfram Schneider.Xr send 2 ,
244afe61c15SRodney W. Grimes.Xr inet 4 ,
2450b992c1dSWolfram Schneider.Xr intro 4 ,
2463467360dSBruce M Simpson.Xr ip 4 ,
2473467360dSBruce M Simpson.Xr pf.conf 5
248afe61c15SRodney W. Grimes.Sh HISTORY
249afe61c15SRodney W. GrimesThe
250afe61c15SRodney W. Grimes.Nm
251afe61c15SRodney W. Grimesprotocol appeared in
252afe61c15SRodney W. Grimes.Bx 4.3 .
253