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.\" 28*eba715c5SMichael Tuexen.Dd December 11, 2024 29afe61c15SRodney W. Grimes.Dt ICMP 4 303d45e180SRuslan Ermilov.Os 31afe61c15SRodney W. Grimes.Sh NAME 32afe61c15SRodney W. Grimes.Nm icmp 33afe61c15SRodney W. Grimes.Nd Internet Control Message Protocol 34afe61c15SRodney W. Grimes.Sh SYNOPSIS 3532eef9aeSRuslan Ermilov.In sys/types.h 3632eef9aeSRuslan Ermilov.In sys/socket.h 3732eef9aeSRuslan Ermilov.In netinet/in.h 38afe61c15SRodney W. Grimes.Ft int 39afe61c15SRodney W. Grimes.Fn socket AF_INET SOCK_RAW proto 40afe61c15SRodney W. Grimes.Sh DESCRIPTION 41afe61c15SRodney W. Grimes.Tn ICMP 42afe61c15SRodney W. Grimesis the error and control message protocol used 43afe61c15SRodney W. Grimesby 44afe61c15SRodney W. Grimes.Tn IP 45b5e7e999SRuslan Ermilovand the Internet protocol family. 46b5e7e999SRuslan ErmilovIt may be accessed 47afe61c15SRodney W. Grimesthrough a 48afe61c15SRodney W. Grimes.Dq raw socket 49afe61c15SRodney W. Grimesfor network monitoring 50afe61c15SRodney W. Grimesand diagnostic functions. 51afe61c15SRodney W. GrimesThe 52afe61c15SRodney W. Grimes.Fa proto 53afe61c15SRodney W. Grimesparameter to the socket call to create an 54afe61c15SRodney W. Grimes.Tn ICMP 55afe61c15SRodney W. Grimessocket 56afe61c15SRodney W. Grimesis obtained from 57afe61c15SRodney W. Grimes.Xr getprotobyname 3 . 58afe61c15SRodney W. Grimes.Tn ICMP 59afe61c15SRodney W. Grimessockets are connectionless, 60afe61c15SRodney W. Grimesand are normally used with the 61edf0e5b3SMike Pritchard.Xr sendto 2 62afe61c15SRodney W. Grimesand 63edf0e5b3SMike Pritchard.Xr recvfrom 2 64afe61c15SRodney W. Grimescalls, though the 65afe61c15SRodney W. Grimes.Xr connect 2 66afe61c15SRodney W. Grimescall may also be used to fix the destination for future 67afe61c15SRodney W. Grimespackets (in which case the 68afe61c15SRodney W. Grimes.Xr read 2 69afe61c15SRodney W. Grimesor 70afe61c15SRodney W. Grimes.Xr recv 2 71afe61c15SRodney W. Grimesand 72afe61c15SRodney W. Grimes.Xr write 2 73afe61c15SRodney W. Grimesor 74afe61c15SRodney W. Grimes.Xr send 2 75afe61c15SRodney W. Grimessystem calls may be used). 76afe61c15SRodney W. Grimes.Pp 77afe61c15SRodney W. GrimesOutgoing packets automatically have an 78afe61c15SRodney W. Grimes.Tn IP 79afe61c15SRodney W. Grimesheader prepended to 80afe61c15SRodney W. Grimesthem (based on the destination address). 81afe61c15SRodney W. GrimesIncoming packets are received with the 82afe61c15SRodney W. Grimes.Tn IP 83afe61c15SRodney W. Grimesheader and options intact. 843467360dSBruce M Simpson.Ss Types 853467360dSBruce M SimpsonICMP messages are classified according to the type and code fields 863467360dSBruce M Simpsonpresent in the ICMP header. 873467360dSBruce M SimpsonThe abbreviations for the types and codes may be used in rules in 883467360dSBruce M Simpson.Xr pf.conf 5 . 893467360dSBruce M SimpsonThe following types are defined: 903467360dSBruce M Simpson.Bl -column x xxxxxxxxxxxx -offset indent 913467360dSBruce M Simpson.It Sy Num Ta Sy Abbrev. Ta Sy Description 923467360dSBruce M Simpson.It 0 Ta echorep Ta "Echo reply" 933467360dSBruce M Simpson.It 3 Ta unreach Ta "Destination unreachable" 943467360dSBruce M Simpson.It 4 Ta squench Ta "Packet loss, slow down" 953467360dSBruce M Simpson.It 5 Ta redir Ta "Shorter route exists" 963467360dSBruce M Simpson.It 6 Ta althost Ta "Alternate host address" 973467360dSBruce M Simpson.It 8 Ta echoreq Ta "Echo request" 983467360dSBruce M Simpson.It 9 Ta routeradv Ta "Router advertisement" 993467360dSBruce M Simpson.It 10 Ta routersol Ta "Router solicitation" 1003467360dSBruce M Simpson.It 11 Ta timex Ta "Time exceeded" 1013467360dSBruce M Simpson.It 12 Ta paramprob Ta "Invalid IP header" 1023467360dSBruce M Simpson.It 13 Ta timereq Ta "Timestamp request" 1033467360dSBruce M Simpson.It 14 Ta timerep Ta "Timestamp reply" 1043467360dSBruce M Simpson.It 15 Ta inforeq Ta "Information request" 1053467360dSBruce M Simpson.It 16 Ta inforep Ta "Information reply" 1063467360dSBruce M Simpson.It 17 Ta maskreq Ta "Address mask request" 1073467360dSBruce M Simpson.It 18 Ta maskrep Ta "Address mask reply" 1083467360dSBruce M Simpson.It 30 Ta trace Ta Traceroute 1093467360dSBruce M Simpson.It 31 Ta dataconv Ta "Data conversion problem" 1103467360dSBruce M Simpson.It 32 Ta mobredir Ta "Mobile host redirection" 1113467360dSBruce M Simpson.It 33 Ta ipv6-where Ta "IPv6 where-are-you" 1123467360dSBruce M Simpson.It 34 Ta ipv6-here Ta "IPv6 i-am-here" 1133467360dSBruce M Simpson.It 35 Ta mobregreq Ta "Mobile registration request" 1143467360dSBruce M Simpson.It 36 Ta mobregrep Ta "Mobile registration reply" 1153467360dSBruce M Simpson.It 39 Ta skip Ta SKIP 1163467360dSBruce M Simpson.It 40 Ta photuris Ta Photuris 1173467360dSBruce M Simpson.El 1183467360dSBruce M Simpson.Pp 1193467360dSBruce M SimpsonThe following codes are defined: 1203467360dSBruce M Simpson.Bl -column x xxxxxxxxxxxx xxxxxxxx -offset indent 1213467360dSBruce M Simpson.It Sy Num Ta Sy Abbrev. Ta Sy Type Ta Sy Description 1223467360dSBruce M Simpson.It 0 Ta net-unr Ta unreach Ta "Network unreachable" 1233467360dSBruce M Simpson.It 1 Ta host-unr Ta unreach Ta "Host unreachable" 1243467360dSBruce M Simpson.It 2 Ta proto-unr Ta unreach Ta "Protocol unreachable" 1253467360dSBruce M Simpson.It 3 Ta port-unr Ta unreach Ta "Port unreachable" 1263467360dSBruce M Simpson.It 4 Ta needfrag Ta unreach Ta "Fragmentation needed but DF bit set" 1273467360dSBruce M Simpson.It 5 Ta srcfail Ta unreach Ta "Source routing failed" 1283467360dSBruce M Simpson.It 6 Ta net-unk Ta unreach Ta "Network unknown" 1293467360dSBruce M Simpson.It 7 Ta host-unk Ta unreach Ta "Host unknown" 1303467360dSBruce M Simpson.It 8 Ta isolate Ta unreach Ta "Host isolated" 1313467360dSBruce M Simpson.It 9 Ta net-prohib Ta unreach Ta "Network administratively prohibited" 1323467360dSBruce M Simpson.It 10 Ta host-prohib Ta unreach Ta "Host administratively prohibited" 1333467360dSBruce M Simpson.It 11 Ta net-tos Ta unreach Ta "Invalid TOS for network" 1343467360dSBruce M Simpson.It 12 Ta host-tos Ta unreach Ta "Invalid TOS for host" 1353467360dSBruce M Simpson.It 13 Ta filter-prohib Ta unreach Ta "Prohibited access" 1363467360dSBruce M Simpson.It 14 Ta host-preced Ta unreach Ta "Precedence violation" 1373467360dSBruce M Simpson.It 15 Ta cutoff-preced Ta unreach Ta "Precedence cutoff" 1383467360dSBruce M Simpson.It 0 Ta redir-net Ta redir Ta "Shorter route for network" 1393467360dSBruce M Simpson.It 1 Ta redir-host Ta redir Ta "Shorter route for host" 1403467360dSBruce M Simpson.It 2 Ta redir-tos-net Ta redir Ta "Shorter route for TOS and network" 1413467360dSBruce M Simpson.It 3 Ta redir-tos-host Ta redir Ta "Shorter route for TOS and host" 1423467360dSBruce M Simpson.It 0 Ta normal-adv Ta routeradv Ta "Normal advertisement" 1433467360dSBruce M Simpson.It 16 Ta common-adv Ta routeradv Ta "Selective advertisement" 1443467360dSBruce M Simpson.It 0 Ta transit Ta timex Ta "Time exceeded in transit" 1453467360dSBruce M Simpson.It 1 Ta reassemb Ta timex Ta "Time exceeded in reassembly" 1463467360dSBruce M Simpson.It 0 Ta badhead Ta paramprob Ta "Invalid option pointer" 1473467360dSBruce M Simpson.It 1 Ta optmiss Ta paramprob Ta "Missing option" 1483467360dSBruce M Simpson.It 2 Ta badlen Ta paramprob Ta "Invalid length" 1493467360dSBruce M Simpson.It 1 Ta unknown-ind Ta photuris Ta "Unknown security index" 1503467360dSBruce M Simpson.It 2 Ta auth-fail Ta photuris Ta "Authentication failed" 1513467360dSBruce M Simpson.It 3 Ta decrypt-fail Ta photuris Ta "Decryption failed" 1523467360dSBruce M Simpson.El 153cf2ca148SMike Karels.Ss MIB (sysctl) Variables 1547726f76fSRuslan ErmilovThe 1557726f76fSRuslan Ermilov.Tn ICMP 1567726f76fSRuslan Ermilovprotocol implements a number of variables in the 1577726f76fSRuslan Ermilov.Va net.inet.icmp 1587726f76fSRuslan Ermilovbranch of the 1597726f76fSRuslan Ermilov.Xr sysctl 3 160cf2ca148SMike KarelsMIB, which can also be read or modified with 161cf2ca148SMike Karels.Xr sysctl 8 . 1627726f76fSRuslan Ermilov.Bl -tag -width ".Va icmplim_output" 163ace68b1fSMike Karels.It Va bmcastecho 1647726f76fSRuslan Ermilov.Pq Vt boolean 165ace68b1fSMike KarelsEnable/disable ICMP replies received via broadcast or multicast. 1667726f76fSRuslan ErmilovDefaults to false. 167ace68b1fSMike Karels.It Va drop_redirect 168ace68b1fSMike Karels.Pq Vt boolean 169ace68b1fSMike KarelsEnable/disable dropping of ICMP Redirect packets. 170ace68b1fSMike KarelsDefaults to false. 1717726f76fSRuslan Ermilov.It Va icmplim 172*eba715c5SMichael Tuexen.Pq Vt unsigned integer 173*eba715c5SMichael TuexenMean rate limit for replies in packets/second. 174*eba715c5SMichael TuexenThe actual limit is 175*eba715c5SMichael Tuexen.Va icmplim 176*eba715c5SMichael Tuexenplus a random jitter limited by 177*eba715c5SMichael Tuexen.Va icmplim_jitter . 178532ef888SRuslan ErmilovIf set to zero, no limiting will occur. 1797726f76fSRuslan ErmilovDefaults to 200. 180*eba715c5SMichael Tuexen.It Va icmplim_jitter 181*eba715c5SMichael Tuexen.Pq Vt unsigned integer 182*eba715c5SMichael TuexenA random jitter between the negative of 183*eba715c5SMichael Tuexen.Va icmplim_jitter 184*eba715c5SMichael Tuexenand 185*eba715c5SMichael Tuexen.Va icmplim_jitter 186*eba715c5SMichael Tuexenis applied to 187*eba715c5SMichael Tuexen.Va icmplim 188*eba715c5SMichael Tuexenfor limiting the sending rate of replies. 189*eba715c5SMichael Tuexen.Va icmplim_jitter 190*eba715c5SMichael Tuexenmust be smaller than 191*eba715c5SMichael Tuexen.Va icmplim , 192*eba715c5SMichael Tuexenif 193*eba715c5SMichael Tuexen.Va icmplim 194*eba715c5SMichael Tuexenis not zero. 195*eba715c5SMichael TuexenIf set to zero, no jitter will be applied. 196*eba715c5SMichael TuexenDefaults to 16. 1977726f76fSRuslan Ermilov.It Va icmplim_output 1987726f76fSRuslan Ermilov.Pq Vt boolean 199532ef888SRuslan ErmilovEnable/disable logging of ICMP replies bandwidth limiting. 2007726f76fSRuslan ErmilovDefaults to true. 2017726f76fSRuslan Ermilov.It Va log_redirect 2027726f76fSRuslan Ermilov.Pq Vt boolean 2037726f76fSRuslan ErmilovEnable/disable logging of ICMP Redirect packets. 2047726f76fSRuslan ErmilovDefaults to false. 205ace68b1fSMike Karels.It Va maskfake 206ace68b1fSMike Karels.Pq Vt "unsigned integer" 207ace68b1fSMike KarelsWhen 208ace68b1fSMike Karels.Va maskrepl 209ace68b1fSMike Karelsis set and this value is non-zero, 210ace68b1fSMike Karelsit will be used instead of the real address mask when 211ace68b1fSMike Karelsthe system replies to an ICMP Address Mask Request packet. 212ace68b1fSMike KarelsDefaults to 0. 213ace68b1fSMike Karels.It Va maskrepl 2147726f76fSRuslan Ermilov.Pq Vt boolean 215ace68b1fSMike KarelsEnable/disable replies to ICMP Address Mask Request packets. 2167726f76fSRuslan ErmilovDefaults to false. 217ace68b1fSMike Karels.It Va quotelen 218ace68b1fSMike Karels.Pq Vt integer 219ace68b1fSMike KarelsNumber of bytes from original packet to quote in ICMP reply. 220ace68b1fSMike KarelsThis number is internally enforced to be at least 8 bytes (per RFC792) 221ace68b1fSMike Karelsand at most the maximal space left in the ICMP reply mbuf. 222cf2ca148SMike Karels.It Va redirtimeout 223cf2ca148SMike Karels.Pq Vt integer 224cf2ca148SMike KarelsDelay in seconds before expiring route created by ICMP redirect. 225a0866c8dSAndre Oppermann.It Va reply_from_interface 226a0866c8dSAndre Oppermann.Pq Vt boolean 227cf2ca148SMike KarelsUse the IP address of the interface the packet came in through for 228a0866c8dSAndre Oppermannresponses to packets which are not directly addressed to us. 22978ad5421SRuslan ErmilovIf enabled, this rule is processed before all others. 23078ad5421SRuslan ErmilovBy default, continue with normal source selection. 231a0866c8dSAndre OppermannEnabling this option is particularly useful on routers because it 232a0866c8dSAndre Oppermannmakes external traceroutes show the actual path a packet has taken 233a0866c8dSAndre Oppermanninstead of the possibly different return path. 234ace68b1fSMike Karels.It Va reply_src 235ace68b1fSMike Karels.Pq Vt str 236ace68b1fSMike KarelsAn interface name used for the ICMP reply source in response to packets 237ace68b1fSMike Karelswhich are not directly addressed to us. 238ace68b1fSMike KarelsBy default continue with normal source selection. 23900cb6befSMark Johnston.It Va tstamprepl 24000cb6befSMark Johnston.Pq Vt boolean 24100cb6befSMark JohnstonEnable/disable replies to ICMP Timestamp packets. 24200cb6befSMark JohnstonDefaults to true. 2437726f76fSRuslan Ermilov.El 244ef0180edSDima Dorfman.Sh ERRORS 245afe61c15SRodney W. GrimesA socket operation may fail with one of the following errors returned: 246ef0180edSDima Dorfman.Bl -tag -width Er 247afe61c15SRodney W. Grimes.It Bq Er EISCONN 248afe61c15SRodney W. Grimeswhen trying to establish a connection on a socket which 249afe61c15SRodney W. Grimesalready has one, or when trying to send a datagram with the destination 250afe61c15SRodney W. Grimesaddress specified and the socket is already connected; 251afe61c15SRodney W. Grimes.It Bq Er ENOTCONN 252afe61c15SRodney W. Grimeswhen trying to send a datagram, but 2530227791bSRuslan Ermilovno destination address is specified, and the socket has not been 254afe61c15SRodney W. Grimesconnected; 255afe61c15SRodney W. Grimes.It Bq Er ENOBUFS 256afe61c15SRodney W. Grimeswhen the system runs out of memory for 257afe61c15SRodney W. Grimesan internal data structure; 258afe61c15SRodney W. Grimes.It Bq Er EADDRNOTAVAIL 259afe61c15SRodney W. Grimeswhen an attempt is made to create a 260afe61c15SRodney W. Grimessocket with a network address for which no network interface 261afe61c15SRodney W. Grimesexists. 262afe61c15SRodney W. Grimes.El 263afe61c15SRodney W. Grimes.Sh SEE ALSO 264afe61c15SRodney W. Grimes.Xr recv 2 , 2650b992c1dSWolfram Schneider.Xr send 2 , 266cf2ca148SMike Karels.Xr sysctl 3 , 267afe61c15SRodney W. Grimes.Xr inet 4 , 2680b992c1dSWolfram Schneider.Xr intro 4 , 2693467360dSBruce M Simpson.Xr ip 4 , 270cf2ca148SMike Karels.Xr pf.conf 5 , 271cf2ca148SMike Karels.Xr sysctl 8 272afe61c15SRodney W. Grimes.Sh HISTORY 273afe61c15SRodney W. GrimesThe 274afe61c15SRodney W. Grimes.Nm 275cf2ca148SMike Karelsprotocol implementation appeared in 276cf2ca148SMike Karels.Bx 4.2 . 277