xref: /netbsd/share/man/man4/icmp.4 (revision 6550d01e)
1.\"	$NetBSD: icmp.4,v 1.9 2003/08/07 10:31:02 agc Exp $
2.\"
3.\" Copyright (c) 1986, 1991, 1993
4.\"	The Regents of the University of California.  All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. Neither the name of the University nor the names of its contributors
15.\"    may be used to endorse or promote products derived from this software
16.\"    without specific prior written permission.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28.\" SUCH DAMAGE.
29.\"
30.\"     @(#)icmp.4	8.1 (Berkeley) 6/5/93
31.\"
32.Dd June 5, 1993
33.Dt ICMP 4
34.Os
35.Sh NAME
36.Nm icmp
37.Nd Internet Control Message Protocol
38.Sh SYNOPSIS
39.In sys/socket.h
40.In netinet/in.h
41.Ft int
42.Fn socket AF_INET SOCK_RAW proto
43.Sh DESCRIPTION
44.Tn ICMP
45is the error and control message protocol used
46by
47.Tn IP
48and the Internet protocol family.
49It may be accessed through a
50.Dq raw socket
51for network monitoring and diagnostic functions.
52The
53.Fa proto
54parameter to the socket call to create an
55.Tn ICMP
56socket is obtained from
57.Xr getprotobyname 3 .
58.Tn ICMP
59sockets are connectionless, and are normally used with the
60.Xr sendto 2
61and
62.Xr recvfrom 2
63calls, though the
64.Xr connect 2
65call may also be used to fix the destination for future packets
66(in which case the
67.Xr read 2
68or
69.Xr recv 2
70and
71.Xr write 2
72or
73.Xr send 2
74system calls may be used).
75.Pp
76Outgoing packets automatically have an
77.Tn IP
78header prepended to them (based on the destination address).
79Incoming packets are received with the
80.Tn IP
81header and options intact.
82.Sh DIAGNOSTICS
83A socket operation may fail with one of the following errors returned:
84.Bl -tag -width [EADDRNOTAVAIL]
85.It Bq Er EISCONN
86when trying to establish a connection on a socket which
87already has one, or when trying to send a datagram with the destination
88address specified and the socket is already connected;
89.It Bq Er ENOTCONN
90when trying to send a datagram, but
91no destination address is specified, and the socket hasn't been
92connected;
93.It Bq Er ENOBUFS
94when the system runs out of memory for
95an internal data structure;
96.It Bq Er EADDRNOTAVAIL
97when an attempt is made to create a
98socket with a network address for which no network interface exists.
99.El
100.Sh SEE ALSO
101.Xr recv 2 ,
102.Xr send 2 ,
103.Xr inet 4 ,
104.Xr intro 4 ,
105.Xr ip 4
106.Rs
107.%R RFC
108.%N 792
109.%D September 1981
110.%T "Internet Control Message Protocol"
111.Re
112.Rs
113.%R RFC
114.%N 1122
115.%D October 1989
116.%T "Requirements for Internet Hosts -- Communication Layers"
117.Re
118.Sh HISTORY
119The
120.Nm
121protocol appeared in
122.Bx 4.3 .
123