summaryrefslogtreecommitdiff
path: root/static/freebsd/man4/icmp.4 3.html
blob: 78c88ccba8924bef4070a1be586d5a62e12ff453 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
<table class="head">
  <tr>
    <td class="head-ltitle">ICMP(4)</td>
    <td class="head-vol">Device Drivers Manual</td>
    <td class="head-rtitle">ICMP(4)</td>
  </tr>
</table>
<div class="manual-text">
<section class="Sh">
<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
<p class="Pp"><code class="Nm">icmp</code> &#x2014; <span class="Nd">Internet
    Control Message Protocol</span></p>
</section>
<section class="Sh">
<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
<p class="Pp"><code class="In">#include
    &lt;<a class="In">sys/types.h</a>&gt;</code>
  <br/>
  <code class="In">#include &lt;<a class="In">sys/socket.h</a>&gt;</code>
  <br/>
  <code class="In">#include &lt;<a class="In">netinet/in.h</a>&gt;</code></p>
<p class="Pp"><var class="Ft">int</var>
  <br/>
  <code class="Fn">socket</code>(<var class="Fa" style="white-space: nowrap;">AF_INET</var>,
    <var class="Fa" style="white-space: nowrap;">SOCK_RAW</var>,
    <var class="Fa" style="white-space: nowrap;">proto</var>);</p>
</section>
<section class="Sh">
<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
<p class="Pp">ICMP is the error and control message protocol used by IP and the
    Internet protocol family. It may be accessed through a &#x201C;raw
    socket&#x201D; for network monitoring and diagnostic functions. The
    <var class="Fa">proto</var> parameter to the socket call to create an ICMP
    socket is obtained from <a class="Xr">getprotobyname(3)</a>. ICMP sockets
    are connectionless, and are normally used with the
    <a class="Xr">sendto(2)</a> and <a class="Xr">recvfrom(2)</a> calls, though
    the <a class="Xr">connect(2)</a> call may also be used to fix the
    destination for future packets (in which case the <a class="Xr">read(2)</a>
    or <a class="Xr">recv(2)</a> and <a class="Xr">write(2)</a> or
    <a class="Xr">send(2)</a> system calls may be used).</p>
<p class="Pp">Outgoing packets automatically have an IP header prepended to them
    (based on the destination address). Incoming packets are received with the
    IP header and options intact.</p>
<section class="Ss">
<h2 class="Ss" id="Types"><a class="permalink" href="#Types">Types</a></h2>
<p class="Pp">ICMP messages are classified according to the type and code fields
    present in the ICMP header. The abbreviations for the types and codes may be
    used in rules in <a class="Xr">pf.conf(5)</a>. The following types are
    defined:</p>
<table class="Bl-column Bd-indent">
  <tr id="Num">
    <td><a class="permalink" href="#Num"><b class="Sy">Num</b></a></td>
    <td><a class="permalink" href="#Abbrev."><b class="Sy" id="Abbrev.">Abbrev.</b></a></td>
    <td><a class="permalink" href="#Description"><b class="Sy" id="Description">Description</b></a></td>
  </tr>
  <tr>
    <td>0</td>
    <td>echorep</td>
    <td>Echo reply</td>
  </tr>
  <tr>
    <td>3</td>
    <td>unreach</td>
    <td>Destination unreachable</td>
  </tr>
  <tr>
    <td>4</td>
    <td>squench</td>
    <td>Packet loss, slow down</td>
  </tr>
  <tr>
    <td>5</td>
    <td>redir</td>
    <td>Shorter route exists</td>
  </tr>
  <tr>
    <td>6</td>
    <td>althost</td>
    <td>Alternate host address</td>
  </tr>
  <tr>
    <td>8</td>
    <td>echoreq</td>
    <td>Echo request</td>
  </tr>
  <tr>
    <td>9</td>
    <td>routeradv</td>
    <td>Router advertisement</td>
  </tr>
  <tr>
    <td>10</td>
    <td>routersol</td>
    <td>Router solicitation</td>
  </tr>
  <tr>
    <td>11</td>
    <td>timex</td>
    <td>Time exceeded</td>
  </tr>
  <tr>
    <td>12</td>
    <td>paramprob</td>
    <td>Invalid IP header</td>
  </tr>
  <tr>
    <td>13</td>
    <td>timereq</td>
    <td>Timestamp request</td>
  </tr>
  <tr>
    <td>14</td>
    <td>timerep</td>
    <td>Timestamp reply</td>
  </tr>
  <tr>
    <td>15</td>
    <td>inforeq</td>
    <td>Information request</td>
  </tr>
  <tr>
    <td>16</td>
    <td>inforep</td>
    <td>Information reply</td>
  </tr>
  <tr>
    <td>17</td>
    <td>maskreq</td>
    <td>Address mask request</td>
  </tr>
  <tr>
    <td>18</td>
    <td>maskrep</td>
    <td>Address mask reply</td>
  </tr>
  <tr>
    <td>30</td>
    <td>trace</td>
    <td>Traceroute</td>
  </tr>
  <tr>
    <td>31</td>
    <td>dataconv</td>
    <td>Data conversion problem</td>
  </tr>
  <tr>
    <td>32</td>
    <td>mobredir</td>
    <td>Mobile host redirection</td>
  </tr>
  <tr>
    <td>33</td>
    <td>ipv6-where</td>
    <td>IPv6 where-are-you</td>
  </tr>
  <tr>
    <td>34</td>
    <td>ipv6-here</td>
    <td>IPv6 i-am-here</td>
  </tr>
  <tr>
    <td>35</td>
    <td>mobregreq</td>
    <td>Mobile registration request</td>
  </tr>
  <tr>
    <td>36</td>
    <td>mobregrep</td>
    <td>Mobile registration reply</td>
  </tr>
  <tr>
    <td>39</td>
    <td>skip</td>
    <td>SKIP</td>
  </tr>
  <tr>
    <td>40</td>
    <td>photuris</td>
    <td>Photuris</td>
  </tr>
</table>
<p class="Pp">The following codes are defined:</p>
<table class="Bl-column Bd-indent">
  <tr id="Num~2">
    <td><a class="permalink" href="#Num~2"><b class="Sy">Num</b></a></td>
    <td><a class="permalink" href="#Abbrev.~2"><b class="Sy" id="Abbrev.~2">Abbrev.</b></a></td>
    <td><a class="permalink" href="#Type"><b class="Sy" id="Type">Type</b></a></td>
    <td><a class="permalink" href="#Description~2"><b class="Sy" id="Description~2">Description</b></a></td>
  </tr>
  <tr>
    <td>0</td>
    <td>net-unr</td>
    <td>unreach</td>
    <td>Network unreachable</td>
  </tr>
  <tr>
    <td>1</td>
    <td>host-unr</td>
    <td>unreach</td>
    <td>Host unreachable</td>
  </tr>
  <tr>
    <td>2</td>
    <td>proto-unr</td>
    <td>unreach</td>
    <td>Protocol unreachable</td>
  </tr>
  <tr>
    <td>3</td>
    <td>port-unr</td>
    <td>unreach</td>
    <td>Port unreachable</td>
  </tr>
  <tr>
    <td>4</td>
    <td>needfrag</td>
    <td>unreach</td>
    <td>Fragmentation needed but DF bit set</td>
  </tr>
  <tr>
    <td>5</td>
    <td>srcfail</td>
    <td>unreach</td>
    <td>Source routing failed</td>
  </tr>
  <tr>
    <td>6</td>
    <td>net-unk</td>
    <td>unreach</td>
    <td>Network unknown</td>
  </tr>
  <tr>
    <td>7</td>
    <td>host-unk</td>
    <td>unreach</td>
    <td>Host unknown</td>
  </tr>
  <tr>
    <td>8</td>
    <td>isolate</td>
    <td>unreach</td>
    <td>Host isolated</td>
  </tr>
  <tr>
    <td>9</td>
    <td>net-prohib</td>
    <td>unreach</td>
    <td>Network administratively prohibited</td>
  </tr>
  <tr>
    <td>10</td>
    <td>host-prohib</td>
    <td>unreach</td>
    <td>Host administratively prohibited</td>
  </tr>
  <tr>
    <td>11</td>
    <td>net-tos</td>
    <td>unreach</td>
    <td>Invalid TOS for network</td>
  </tr>
  <tr>
    <td>12</td>
    <td>host-tos</td>
    <td>unreach</td>
    <td>Invalid TOS for host</td>
  </tr>
  <tr>
    <td>13</td>
    <td>filter-prohib</td>
    <td>unreach</td>
    <td>Prohibited access</td>
  </tr>
  <tr>
    <td>14</td>
    <td>host-preced</td>
    <td>unreach</td>
    <td>Precedence violation</td>
  </tr>
  <tr>
    <td>15</td>
    <td>cutoff-preced</td>
    <td>unreach</td>
    <td>Precedence cutoff</td>
  </tr>
  <tr>
    <td>0</td>
    <td>redir-net</td>
    <td>redir</td>
    <td>Shorter route for network</td>
  </tr>
  <tr>
    <td>1</td>
    <td>redir-host</td>
    <td>redir</td>
    <td>Shorter route for host</td>
  </tr>
  <tr>
    <td>2</td>
    <td>redir-tos-net</td>
    <td>redir</td>
    <td>Shorter route for TOS and network</td>
  </tr>
  <tr>
    <td>3</td>
    <td>redir-tos-host</td>
    <td>redir</td>
    <td>Shorter route for TOS and host</td>
  </tr>
  <tr>
    <td>0</td>
    <td>normal-adv</td>
    <td>routeradv</td>
    <td>Normal advertisement</td>
  </tr>
  <tr>
    <td>16</td>
    <td>common-adv</td>
    <td>routeradv</td>
    <td>Selective advertisement</td>
  </tr>
  <tr>
    <td>0</td>
    <td>transit</td>
    <td>timex</td>
    <td>Time exceeded in transit</td>
  </tr>
  <tr>
    <td>1</td>
    <td>reassemb</td>
    <td>timex</td>
    <td>Time exceeded in reassembly</td>
  </tr>
  <tr>
    <td>0</td>
    <td>badhead</td>
    <td>paramprob</td>
    <td>Invalid option pointer</td>
  </tr>
  <tr>
    <td>1</td>
    <td>optmiss</td>
    <td>paramprob</td>
    <td>Missing option</td>
  </tr>
  <tr>
    <td>2</td>
    <td>badlen</td>
    <td>paramprob</td>
    <td>Invalid length</td>
  </tr>
  <tr>
    <td>1</td>
    <td>unknown-ind</td>
    <td>photuris</td>
    <td>Unknown security index</td>
  </tr>
  <tr>
    <td>2</td>
    <td>auth-fail</td>
    <td>photuris</td>
    <td>Authentication failed</td>
  </tr>
  <tr>
    <td>3</td>
    <td>decrypt-fail</td>
    <td>photuris</td>
    <td>Decryption failed</td>
  </tr>
</table>
</section>
<section class="Ss">
<h2 class="Ss" id="MIB_(sysctl)_Variables"><a class="permalink" href="#MIB_(sysctl)_Variables">MIB
  (sysctl) Variables</a></h2>
<p class="Pp">The ICMP protocol implements a number of variables in the
    <var class="Va">net.inet.icmp</var> branch of the
    <a class="Xr">sysctl(3)</a> MIB, which can also be read or modified with
    <a class="Xr">sysctl(8)</a>.</p>
<dl class="Bl-tag">
  <dt id="bmcastecho"><var class="Va">bmcastecho</var></dt>
  <dd>(<var class="Vt">boolean</var>) Enable/disable ICMP replies received via
      broadcast or multicast. Defaults to false.</dd>
  <dt id="drop_redirect"><var class="Va">drop_redirect</var></dt>
  <dd>(<var class="Vt">boolean</var>) Enable/disable dropping of ICMP Redirect
      packets. Defaults to false.</dd>
  <dt id="icmplim"><var class="Va">icmplim</var></dt>
  <dd>(<var class="Vt">unsigned integer</var>) Mean rate limit for replies in
      packets/second. The actual limit is <var class="Va">icmplim</var> plus a
      random jitter limited by <var class="Va">icmplim_jitter</var>. If set to
      zero, no limiting will occur. Defaults to 200.</dd>
  <dt id="icmplim_jitter"><var class="Va">icmplim_jitter</var></dt>
  <dd>(<var class="Vt">unsigned integer</var>) A random jitter between the
      negative of <var class="Va">icmplim_jitter</var> and
      <var class="Va">icmplim_jitter</var> is applied to
      <var class="Va">icmplim</var> for limiting the sending rate of replies.
      <var class="Va">icmplim_jitter</var> must be smaller than
      <var class="Va">icmplim</var>, if <var class="Va">icmplim</var> is not
      zero. If set to zero, no jitter will be applied. Defaults to 16.</dd>
  <dt id="icmplim_output"><var class="Va">icmplim_output</var></dt>
  <dd>(<var class="Vt">boolean</var>) Enable/disable logging of ICMP replies
      bandwidth limiting. Defaults to true.</dd>
  <dt id="log_redirect"><var class="Va">log_redirect</var></dt>
  <dd>(<var class="Vt">boolean</var>) Enable/disable logging of ICMP Redirect
      packets. Defaults to false.</dd>
  <dt id="maskfake"><var class="Va">maskfake</var></dt>
  <dd>(<var class="Vt">unsigned integer</var>) When
      <var class="Va">maskrepl</var> is set and this value is non-zero, it will
      be used instead of the real address mask when the system replies to an
      ICMP Address Mask Request packet. Defaults to 0.</dd>
  <dt id="maskrepl"><var class="Va">maskrepl</var></dt>
  <dd>(<var class="Vt">boolean</var>) Enable/disable replies to ICMP Address
      Mask Request packets. Defaults to false.</dd>
  <dt id="quotelen"><var class="Va">quotelen</var></dt>
  <dd>(<var class="Vt">integer</var>) Number of bytes from original packet to
      quote in ICMP reply. This number is internally enforced to be at least 8
      bytes (per RFC792) and at most the maximal space left in the ICMP reply
      mbuf.</dd>
  <dt id="redirtimeout"><var class="Va">redirtimeout</var></dt>
  <dd>(<var class="Vt">integer</var>) Delay in seconds before expiring route
      created by ICMP redirect.</dd>
  <dt id="reply_from_interface"><var class="Va">reply_from_interface</var></dt>
  <dd>(<var class="Vt">boolean</var>) Use the IP address of the interface the
      packet came in through for responses to packets which are not directly
      addressed to us. If enabled, this rule is processed before all others. By
      default, continue with normal source selection. Enabling this option is
      particularly useful on routers because it makes external traceroutes show
      the actual path a packet has taken instead of the possibly different
      return path.</dd>
  <dt id="reply_src"><var class="Va">reply_src</var></dt>
  <dd>(<var class="Vt">str</var>) An interface name used for the ICMP reply
      source in response to packets which are not directly addressed to us. By
      default continue with normal source selection.</dd>
  <dt id="tstamprepl"><var class="Va">tstamprepl</var></dt>
  <dd>(<var class="Vt">boolean</var>) Enable/disable replies to ICMP Timestamp
      packets. Defaults to true.</dd>
</dl>
</section>
</section>
<section class="Sh">
<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1>
<p class="Pp">A socket operation may fail with one of the following errors
    returned:</p>
<dl class="Bl-tag">
  <dt id="EISCONN">[<a class="permalink" href="#EISCONN"><code class="Er">EISCONN</code></a>]</dt>
  <dd>when trying to establish a connection on a socket which already has one,
      or when trying to send a datagram with the destination address specified
      and the socket is already connected;</dd>
  <dt id="ENOTCONN">[<a class="permalink" href="#ENOTCONN"><code class="Er">ENOTCONN</code></a>]</dt>
  <dd>when trying to send a datagram, but no destination address is specified,
      and the socket has not been connected;</dd>
  <dt id="ENOBUFS">[<a class="permalink" href="#ENOBUFS"><code class="Er">ENOBUFS</code></a>]</dt>
  <dd>when the system runs out of memory for an internal data structure;</dd>
  <dt id="EADDRNOTAVAIL">[<a class="permalink" href="#EADDRNOTAVAIL"><code class="Er">EADDRNOTAVAIL</code></a>]</dt>
  <dd>when an attempt is made to create a socket with a network address for
      which no network interface exists.</dd>
</dl>
</section>
<section class="Sh">
<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
  ALSO</a></h1>
<p class="Pp"><a class="Xr">recv(2)</a>, <a class="Xr">send(2)</a>,
    <a class="Xr">sysctl(3)</a>, <a class="Xr">inet(4)</a>,
    <a class="Xr">intro(4)</a>, <a class="Xr">ip(4)</a>,
    <a class="Xr">pf.conf(5)</a>, <a class="Xr">sysctl(8)</a></p>
</section>
<section class="Sh">
<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1>
<p class="Pp">The <code class="Nm">icmp</code> protocol implementation appeared
    in <span class="Ux">4.2BSD</span>.</p>
</section>
</div>
<table class="foot">
  <tr>
    <td class="foot-date">December 11, 2024</td>
    <td class="foot-os">FreeBSD 15.0</td>
  </tr>
</table>