1icmp(7P) Protocols icmp(7P)
2
3
4
6 icmp, ICMP - Internet Control Message Protocol
7
9 #include <sys/socket.h>
10 #include <netinet/in.h>
11 #include <netinet/ip_icmp.h>
12 s = socket(AF_INET, SOCK_RAW, proto);
13 t = t_open("/dev/icmp", O_RDWR);
14
15
17 ICMP is the error and control message protocol used by the Internet
18 protocol family. It is used by the kernel to handle and report errors
19 in protocol processing. It may also be accessed by programs using the
20 socket interface or the Transport Level Interface (TLI) for network
21 monitoring and diagnostic functions. When used with the socket inter‐
22 face, a "raw socket" type is used. The protocol number for ICMP, used
23 in the proto parameter to the socket call, can be obtained from getpro‐
24 tobyname(3SOCKET). ICMP file descriptors and sockets are connection‐
25 less, and are normally used with the t_sndudata / t_rcvudata and the
26 sendto() / recvfrom() calls.
27
28
29 Outgoing packets automatically have an Internet Protocol (IP) header
30 prepended to them. Incoming packets are provided to the user with the
31 IP header and options intact.
32
33
34 ICMP is an datagram protocol layered above IP. It is used internally by
35 the protcol code for various purposes including routing, fault isola‐
36 tion, and congestion control. Receipt of an ICMP "redirect" message
37 will add a new entry in the routing table, or modify an existing one.
38 ICMP messages are routinely sent by the protocol code. Received ICMP
39 messages may be reflected back to users of higher-level protocols such
40 as TCP or UDP as error returns from system calls. A copy of all ICMP
41 message received by the system is provided to every holder of an open
42 ICMP socket or TLI descriptor.
43
45 getprotobyname(3SOCKET), recv(3SOCKET), send(3SOCKET), t_rcvu‐
46 data(3NSL), t_sndudata(3NSL), inet(7P), ip(7P), routing(7P)
47
48
49 Postel, Jon, Internet Control Message Protocol — DARPA Internet Program
50 Protocol Specification, RFC 792, Network Information Center, SRI Inter‐
51 national, Menlo Park, Calif., September 1981.
52
54 A socket operation may fail with one of the following errors returned:
55
56 EISCONN An attempt was made to establish a connection on a
57 socket which already has one, or when trying to send a
58 datagram with the destination address specified and
59 the socket is already connected.
60
61
62 ENOTCONN An attempt was made to send a datagram, but no desti‐
63 nation address is specified, and the socket has not
64 been connected.
65
66
67 ENOBUFS The system ran out of memory for an internal data
68 structure.
69
70
71 EADDRNOTAVAIL An attempt was made to create a socket with a network
72 address for which no network interface exists.
73
74
76 Replies to ICMP "echo" messages which are source routed are not sent
77 back using inverted source routes, but rather go back through the nor‐
78 mal routing mechanisms.
79
80
81
82SunOS 5.11 3 Jul 1990 icmp(7P)