xref: /freebsd/share/man/man4/icmp.4 (revision 3467360dfd13572d729a865f8be529d22b993025)
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.
12afe61c15SRodney W. Grimes.\" 3. All advertising materials mentioning features or use of this software
13afe61c15SRodney W. Grimes.\"    must display the following acknowledgement:
14afe61c15SRodney W. Grimes.\"	This product includes software developed by the University of
15afe61c15SRodney W. Grimes.\"	California, Berkeley and its contributors.
16afe61c15SRodney W. Grimes.\" 4. Neither the name of the University nor the names of its contributors
17afe61c15SRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
18afe61c15SRodney W. Grimes.\"    without specific prior written permission.
19afe61c15SRodney W. Grimes.\"
20afe61c15SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21afe61c15SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22afe61c15SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23afe61c15SRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24afe61c15SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25afe61c15SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26afe61c15SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27afe61c15SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28afe61c15SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29afe61c15SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30afe61c15SRodney W. Grimes.\" SUCH DAMAGE.
31afe61c15SRodney W. Grimes.\"
32afe61c15SRodney W. Grimes.\"     @(#)icmp.4	8.1 (Berkeley) 6/5/93
337f3dea24SPeter Wemm.\" $FreeBSD$
34afe61c15SRodney W. Grimes.\"
353467360dSBruce M Simpson.Dd February 9, 2007
36afe61c15SRodney W. Grimes.Dt ICMP 4
373d45e180SRuslan Ermilov.Os
38afe61c15SRodney W. Grimes.Sh NAME
39afe61c15SRodney W. Grimes.Nm icmp
40afe61c15SRodney W. Grimes.Nd Internet Control Message Protocol
41afe61c15SRodney W. Grimes.Sh SYNOPSIS
4232eef9aeSRuslan Ermilov.In sys/types.h
4332eef9aeSRuslan Ermilov.In sys/socket.h
4432eef9aeSRuslan Ermilov.In netinet/in.h
45afe61c15SRodney W. Grimes.Ft int
46afe61c15SRodney W. Grimes.Fn socket AF_INET SOCK_RAW proto
47afe61c15SRodney W. Grimes.Sh DESCRIPTION
48afe61c15SRodney W. Grimes.Tn ICMP
49afe61c15SRodney W. Grimesis the error and control message protocol used
50afe61c15SRodney W. Grimesby
51afe61c15SRodney W. Grimes.Tn IP
52b5e7e999SRuslan Ermilovand the Internet protocol family.
53b5e7e999SRuslan ErmilovIt may be accessed
54afe61c15SRodney W. Grimesthrough a
55afe61c15SRodney W. Grimes.Dq raw socket
56afe61c15SRodney W. Grimesfor network monitoring
57afe61c15SRodney W. Grimesand diagnostic functions.
58afe61c15SRodney W. GrimesThe
59afe61c15SRodney W. Grimes.Fa proto
60afe61c15SRodney W. Grimesparameter to the socket call to create an
61afe61c15SRodney W. Grimes.Tn ICMP
62afe61c15SRodney W. Grimessocket
63afe61c15SRodney W. Grimesis obtained from
64afe61c15SRodney W. Grimes.Xr getprotobyname 3 .
65afe61c15SRodney W. Grimes.Tn ICMP
66afe61c15SRodney W. Grimessockets are connectionless,
67afe61c15SRodney W. Grimesand are normally used with the
68edf0e5b3SMike Pritchard.Xr sendto 2
69afe61c15SRodney W. Grimesand
70edf0e5b3SMike Pritchard.Xr recvfrom 2
71afe61c15SRodney W. Grimescalls, though the
72afe61c15SRodney W. Grimes.Xr connect 2
73afe61c15SRodney W. Grimescall may also be used to fix the destination for future
74afe61c15SRodney W. Grimespackets (in which case the
75afe61c15SRodney W. Grimes.Xr read 2
76afe61c15SRodney W. Grimesor
77afe61c15SRodney W. Grimes.Xr recv 2
78afe61c15SRodney W. Grimesand
79afe61c15SRodney W. Grimes.Xr write 2
80afe61c15SRodney W. Grimesor
81afe61c15SRodney W. Grimes.Xr send 2
82afe61c15SRodney W. Grimessystem calls may be used).
83afe61c15SRodney W. Grimes.Pp
84afe61c15SRodney W. GrimesOutgoing packets automatically have an
85afe61c15SRodney W. Grimes.Tn IP
86afe61c15SRodney W. Grimesheader prepended to
87afe61c15SRodney W. Grimesthem (based on the destination address).
88afe61c15SRodney W. GrimesIncoming packets are received with the
89afe61c15SRodney W. Grimes.Tn IP
90afe61c15SRodney W. Grimesheader and options intact.
913467360dSBruce M Simpson.Ss Types
923467360dSBruce M SimpsonICMP messages are classified according to the type and code fields
933467360dSBruce M Simpsonpresent in the ICMP header.
943467360dSBruce M SimpsonThe abbreviations for the types and codes may be used in rules in
953467360dSBruce M Simpson.Xr pf.conf 5 .
963467360dSBruce M SimpsonThe following types are defined:
973467360dSBruce M Simpson.Bl -column x xxxxxxxxxxxx -offset indent
983467360dSBruce M Simpson.It Sy Num Ta Sy Abbrev. Ta Sy Description
993467360dSBruce M Simpson.It 0 Ta echorep Ta "Echo reply"
1003467360dSBruce M Simpson.It 3 Ta unreach Ta "Destination unreachable"
1013467360dSBruce M Simpson.It 4 Ta squench Ta "Packet loss, slow down"
1023467360dSBruce M Simpson.It 5 Ta redir Ta "Shorter route exists"
1033467360dSBruce M Simpson.It 6 Ta althost Ta "Alternate host address"
1043467360dSBruce M Simpson.It 8 Ta echoreq Ta "Echo request"
1053467360dSBruce M Simpson.It 9 Ta routeradv Ta "Router advertisement"
1063467360dSBruce M Simpson.It 10 Ta routersol Ta "Router solicitation"
1073467360dSBruce M Simpson.It 11 Ta timex Ta "Time exceeded"
1083467360dSBruce M Simpson.It 12 Ta paramprob Ta "Invalid IP header"
1093467360dSBruce M Simpson.It 13 Ta timereq Ta "Timestamp request"
1103467360dSBruce M Simpson.It 14 Ta timerep Ta "Timestamp reply"
1113467360dSBruce M Simpson.It 15 Ta inforeq Ta "Information request"
1123467360dSBruce M Simpson.It 16 Ta inforep Ta "Information reply"
1133467360dSBruce M Simpson.It 17 Ta maskreq Ta "Address mask request"
1143467360dSBruce M Simpson.It 18 Ta maskrep Ta "Address mask reply"
1153467360dSBruce M Simpson.It 30 Ta trace Ta Traceroute
1163467360dSBruce M Simpson.It 31 Ta dataconv Ta "Data conversion problem"
1173467360dSBruce M Simpson.It 32 Ta mobredir Ta "Mobile host redirection"
1183467360dSBruce M Simpson.It 33 Ta ipv6-where Ta "IPv6 where-are-you"
1193467360dSBruce M Simpson.It 34 Ta ipv6-here Ta "IPv6 i-am-here"
1203467360dSBruce M Simpson.It 35 Ta mobregreq Ta "Mobile registration request"
1213467360dSBruce M Simpson.It 36 Ta mobregrep Ta "Mobile registration reply"
1223467360dSBruce M Simpson.It 39 Ta skip Ta SKIP
1233467360dSBruce M Simpson.It 40 Ta photuris Ta Photuris
1243467360dSBruce M Simpson.El
1253467360dSBruce M Simpson.Pp
1263467360dSBruce M SimpsonThe following codes are defined:
1273467360dSBruce M Simpson.Bl -column x xxxxxxxxxxxx xxxxxxxx -offset indent
1283467360dSBruce M Simpson.It Sy Num Ta Sy Abbrev. Ta Sy Type Ta Sy Description
1293467360dSBruce M Simpson.It 0 Ta net-unr Ta unreach Ta "Network unreachable"
1303467360dSBruce M Simpson.It 1 Ta host-unr Ta unreach Ta "Host unreachable"
1313467360dSBruce M Simpson.It 2 Ta proto-unr Ta unreach Ta "Protocol unreachable"
1323467360dSBruce M Simpson.It 3 Ta port-unr Ta unreach Ta "Port unreachable"
1333467360dSBruce M Simpson.It 4 Ta needfrag Ta unreach Ta "Fragmentation needed but DF bit set"
1343467360dSBruce M Simpson.It 5 Ta srcfail Ta unreach Ta "Source routing failed"
1353467360dSBruce M Simpson.It 6 Ta net-unk Ta unreach Ta "Network unknown"
1363467360dSBruce M Simpson.It 7 Ta host-unk Ta unreach Ta "Host unknown"
1373467360dSBruce M Simpson.It 8 Ta isolate Ta unreach Ta "Host isolated"
1383467360dSBruce M Simpson.It 9 Ta net-prohib Ta unreach Ta "Network administratively prohibited"
1393467360dSBruce M Simpson.It 10 Ta host-prohib Ta unreach Ta "Host administratively prohibited"
1403467360dSBruce M Simpson.It 11 Ta net-tos Ta unreach Ta "Invalid TOS for network"
1413467360dSBruce M Simpson.It 12 Ta host-tos Ta unreach Ta "Invalid TOS for host"
1423467360dSBruce M Simpson.It 13 Ta filter-prohib Ta unreach Ta "Prohibited access"
1433467360dSBruce M Simpson.It 14 Ta host-preced Ta unreach Ta "Precedence violation"
1443467360dSBruce M Simpson.It 15 Ta cutoff-preced Ta unreach Ta "Precedence cutoff"
1453467360dSBruce M Simpson.It 0 Ta redir-net Ta redir Ta "Shorter route for network"
1463467360dSBruce M Simpson.It 1 Ta redir-host Ta redir Ta "Shorter route for host"
1473467360dSBruce M Simpson.It 2 Ta redir-tos-net Ta redir Ta "Shorter route for TOS and network"
1483467360dSBruce M Simpson.It 3 Ta redir-tos-host Ta redir Ta "Shorter route for TOS and host"
1493467360dSBruce M Simpson.It 0 Ta normal-adv Ta routeradv Ta "Normal advertisement"
1503467360dSBruce M Simpson.It 16 Ta common-adv Ta routeradv Ta "Selective advertisement"
1513467360dSBruce M Simpson.It 0 Ta transit Ta timex Ta "Time exceeded in transit"
1523467360dSBruce M Simpson.It 1 Ta reassemb Ta timex Ta "Time exceeded in reassembly"
1533467360dSBruce M Simpson.It 0 Ta badhead Ta paramprob Ta "Invalid option pointer"
1543467360dSBruce M Simpson.It 1 Ta optmiss Ta paramprob Ta "Missing option"
1553467360dSBruce M Simpson.It 2 Ta badlen Ta paramprob Ta "Invalid length"
1563467360dSBruce M Simpson.It 1 Ta unknown-ind Ta photuris Ta "Unknown security index"
1573467360dSBruce M Simpson.It 2 Ta auth-fail Ta photuris Ta "Authentication failed"
1583467360dSBruce M Simpson.It 3 Ta decrypt-fail Ta photuris Ta "Decryption failed"
1593467360dSBruce M Simpson.El
1607726f76fSRuslan Ermilov.Ss MIB Variables
1617726f76fSRuslan ErmilovThe
1627726f76fSRuslan Ermilov.Tn ICMP
1637726f76fSRuslan Ermilovprotocol implements a number of variables in the
1647726f76fSRuslan Ermilov.Va net.inet.icmp
1657726f76fSRuslan Ermilovbranch of the
1667726f76fSRuslan Ermilov.Xr sysctl 3
1677726f76fSRuslan ErmilovMIB.
1687726f76fSRuslan Ermilov.Bl -tag -width ".Va icmplim_output"
1697726f76fSRuslan Ermilov.It Va maskrepl
1707726f76fSRuslan Ermilov.Pq Vt boolean
1717726f76fSRuslan ErmilovEnable/disable replies to ICMP Address Mask Request packets.
1727726f76fSRuslan ErmilovDefaults to false.
1737726f76fSRuslan Ermilov.It Va maskfake
1747726f76fSRuslan Ermilov.Pq Vt "unsigned integer"
1757726f76fSRuslan ErmilovWhen
1767726f76fSRuslan Ermilov.Va maskrepl
1777726f76fSRuslan Ermilovis set and this value is non-zero,
1787726f76fSRuslan Ermilovit will be used instead of the real address mask when
1797726f76fSRuslan Ermilovthe system replies to an ICMP Address Mask Request packet.
1807726f76fSRuslan ErmilovDefaults to 0.
1817726f76fSRuslan Ermilov.It Va icmplim
1827726f76fSRuslan Ermilov.Pq Vt integer
1837726f76fSRuslan ErmilovBandwidth limit for ICMP replies in packets/second.
1847726f76fSRuslan ErmilovUsed when
1857726f76fSRuslan Ermilov.Va icmplim_output
1867726f76fSRuslan Ermilovis non-zero.
1877726f76fSRuslan ErmilovDefaults to 200.
1887726f76fSRuslan Ermilov.It Va icmplim_output
1897726f76fSRuslan Ermilov.Pq Vt boolean
1907726f76fSRuslan ErmilovEnable/disable bandwidth limiting of ICMP replies.
1917726f76fSRuslan ErmilovDefaults to true.
1927726f76fSRuslan Ermilov.It Va drop_redirect
1937726f76fSRuslan Ermilov.Pq Vt boolean
1947726f76fSRuslan ErmilovEnable/disable dropping of ICMP Redirect packets.
1957726f76fSRuslan ErmilovDefaults to false.
1967726f76fSRuslan Ermilov.It Va log_redirect
1977726f76fSRuslan Ermilov.Pq Vt boolean
1987726f76fSRuslan ErmilovEnable/disable logging of ICMP Redirect packets.
1997726f76fSRuslan ErmilovDefaults to false.
2007726f76fSRuslan Ermilov.It Va bmcastecho
2017726f76fSRuslan Ermilov.Pq Vt boolean
2027726f76fSRuslan ErmilovEnable/disable ICMP replies received via broadcast or multicast.
2037726f76fSRuslan ErmilovDefaults to false.
204d0946241SMaxim Konovalov.It Va reply_src
205d0946241SMaxim Konovalov.Pq Vt str
206c48524c2SMike PritchardAn interface name used for the ICMP reply source in response to packets
207d0946241SMaxim Konovalovwhich are not directly addressed to us.
208d0946241SMaxim KonovalovBy default continue with normal source selection.
209a0866c8dSAndre Oppermann.It Va reply_from_interface
210a0866c8dSAndre Oppermann.Pq Vt boolean
211a0866c8dSAndre OppermannUse the IP address of the interface the packet came through in for
212a0866c8dSAndre Oppermannresponses to packets which are not directly addressed to us.
21378ad5421SRuslan ErmilovIf enabled, this rule is processed before all others.
21478ad5421SRuslan ErmilovBy default, continue with normal source selection.
215a0866c8dSAndre OppermannEnabling this option is particularly useful on routers because it
216a0866c8dSAndre Oppermannmakes external traceroutes show the actual path a packet has taken
217a0866c8dSAndre Oppermanninstead of the possibly different return path.
218e875dfb8SAndre Oppermann.It Va quotelen
219e875dfb8SAndre Oppermann.Pq Vt integer
220e875dfb8SAndre OppermannNumber of bytes from original packet to quote in ICMP reply.
221e875dfb8SAndre OppermannThis number is internally enforced to be at least 8 bytes (per RFC792)
222e875dfb8SAndre Oppermannand at most the maximal space left in the ICMP reply mbuf.
2237726f76fSRuslan Ermilov.El
224ef0180edSDima Dorfman.Sh ERRORS
225afe61c15SRodney W. GrimesA socket operation may fail with one of the following errors returned:
226ef0180edSDima Dorfman.Bl -tag -width Er
227afe61c15SRodney W. Grimes.It Bq Er EISCONN
228afe61c15SRodney W. Grimeswhen trying to establish a connection on a socket which
229afe61c15SRodney W. Grimesalready has one, or when trying to send a datagram with the destination
230afe61c15SRodney W. Grimesaddress specified and the socket is already connected;
231afe61c15SRodney W. Grimes.It Bq Er ENOTCONN
232afe61c15SRodney W. Grimeswhen trying to send a datagram, but
2330227791bSRuslan Ermilovno destination address is specified, and the socket has not been
234afe61c15SRodney W. Grimesconnected;
235afe61c15SRodney W. Grimes.It Bq Er ENOBUFS
236afe61c15SRodney W. Grimeswhen the system runs out of memory for
237afe61c15SRodney W. Grimesan internal data structure;
238afe61c15SRodney W. Grimes.It Bq Er EADDRNOTAVAIL
239afe61c15SRodney W. Grimeswhen an attempt is made to create a
240afe61c15SRodney W. Grimessocket with a network address for which no network interface
241afe61c15SRodney W. Grimesexists.
242afe61c15SRodney W. Grimes.El
243afe61c15SRodney W. Grimes.Sh SEE ALSO
244afe61c15SRodney W. Grimes.Xr recv 2 ,
2450b992c1dSWolfram Schneider.Xr send 2 ,
246afe61c15SRodney W. Grimes.Xr inet 4 ,
2470b992c1dSWolfram Schneider.Xr intro 4 ,
2483467360dSBruce M Simpson.Xr ip 4 ,
2493467360dSBruce M Simpson.Xr pf.conf 5
250afe61c15SRodney W. Grimes.Sh HISTORY
251afe61c15SRodney W. GrimesThe
252afe61c15SRodney W. Grimes.Nm
253afe61c15SRodney W. Grimesprotocol appeared in
254afe61c15SRodney W. Grimes.Bx 4.3 .
255