Manual page for ICMP(4P)
icmp - Internet Control Message Protocol
SYNOPSIS
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/ip_icmp.h>
s = socket(AF_INET, SOCK_RAW, proto);
DESCRIPTION
ICMP
is the error and control message protocol used
by the Internet protocol family.
It is used by the kernel to handle and report errors
in protocol processing.
It may also be accessed
through a ``raw socket'' for network monitoring
and diagnostic functions.
The protocol number for
ICMP,
used in the
proto
parameter to the socket call,
can be obtained from
getprotobyname
(see
getprotoent.3n
ICMP
sockets are connectionless,
and are normally used with the
sendto
and
recvfrom
calls, though the
connect.2
call may also be used to fix the destination for future
packets (in which case the
read.2v
or
recv.2
and
write.2v
or
send.2
system calls may be used).
Outgoing packets automatically have an Internet Protocol (IP)
header prepended to them.
Incoming packets are provided to the holder of a raw
socket with the
IP
header and options intact.
ICMP
is an unreliable datagram protocol layered above
IP.
It is used internally by the protcol code
for various purposes including routing,
fault isolation,
and congestion control.
Receipt of an
ICMP
``redirect'' message will add a new entry in
the routing table,
or modify an existing one.
ICMP
messages are routinely sent by the protocol code.
Received
ICMP
messages may be reflected back to users
of higher-level protocols such as
TCP
or
UDP
as error returns from system calls.
A copy of all
ICMP
message received by the system
is provided using the
ICMP
raw socket.
ERRORS
A socket operation may fail with one of the following errors returned:
- EISCONN
-
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;
- ENOTCONN
-
when trying to send a datagram, but
no destination address is specified, and the socket hasn't been
connected;
- ENOBUFS
-
when the system runs out of memory for
an internal data structure;
- EADDRNOTAVAIL
-
when an attempt is made to create a
socket with a network address for which no network interface
exists.
SEE ALSO
connect.2
read.2v
recv.2
send.2
write.2v
getprotoent.3n
inet.4f
ip.4p
routing.4n
Postel, Jon,
Internet Control Message Protocol -- DARPA Internet Program Protocol Specification,
RFC
792, Network Information Center,
SRI
International, Menlo Park, Calif.,
September 1981. (Sun 800-1064-01)
BUGS
Replies to
ICMP
``echo'' messages which are source routed
are not sent back using inverted source routes,
but rather go back through the normal routing mechanisms.
Created by unroff & hp-tools.
© somebody (See intro for details). All Rights Reserved.
Last modified 11/5/97