Socket Subroutines
Sendto & Recvfrom
Struct Sockaddr
Address Family
Raw Sockets
Own IP Header
Protocol Type
Traceroute Packet
UDP Ports
Type of Service
Setsockopt
Again IP Header
Select
Timeout
Protocol
ICMP
is the
part of the IP layer and
ICMP messages are
transmitted within IP
datagrams. IP datagram
consists of the
IP header
(20 bytes) and ICMP
message. The first byte
of the ICMP message
contains the
type
field.
For example,
Ping
uses
the messages
echo reply
(type 0) and
echo request
(type 8).
The
Traceroute
sends UDP datagrams.
Destination UDP port
should be chose as an
unlikely value, so that
it is impossible that any
destination application
uses this port. UDP
destination side sends
an ICMP message
port
unreachable
(type 3,
code 3). If TTL is 0 in
the received datagram
the router sends back
the ICMP message
time exceeded
(type 11,
code 0). ICMP messages
are exchanged between
hosts without port
numbers.
The second byte of the
ICMP message contains
the code
field.
If a router
cannot forward a packet
because it has no routes
at all to the destination
specified in the packet,
the router generates
network unreachable
(type 3,code 0).
If the
router have routes to the
destination network
specified in the packet,
but the TOS specified
(
TOS = type of service,
second byte in the IP
header) for the routes
is neither the default
TOS (0000) nor the TOS
of the packet that the
router is attempting to
route, then the router
generates
network
unreachable for TOS
(type 3, code 11)
8-byte code field is
given
in the first column,
second column contains
description of code.
The main message codes
that Traceroute uses
are port unreachable
(type 3, code 3) and
TTL equals 0 during
transit
(type 11, code 0).
In the next table obly
codes for the ICMP
message type
destination unreachable
(type 3) are shown.
| Code |
Description |
| 0 |
network
unreachable |
| 1 |
host
unreachable |
| 2 |
protocol
unreachable |
| 3 |
port
unreachable |
| 4 |
fragmentation
needed |
| 5 |
source route
failed |
| 6 |
destinantion
network
unknown |
| 7 |
destinantion
host
unknown |
| 8 |
source
host
isolated |
| 9 |
destinantion
network
administartively
prohibited |
| 10 |
destinantion
host
administartively
prohibited |
| 11 |
network
unreachable
for TOS |
| 12 |
host
unreachable
for TOS |
| 13 |
communiction
administrativly
prohibited by
filtering |
| 14 |
host
precedence
violation |
| 15 |
precedence
cutoff
in effect |
If the router decides that
there is no path to the
destination host then the
router generates the
ICMP message
host
unreachable
(type 3,
code 1). If router cannot
forward the packet
because no route to the
destination and the
packet has a TOS that is
either equal to the TOS
requested in the packet
or is the default TOS
(0000) then the router
generates the message
host
unreachable for
TOS
(type 3, code 12)
One of the two ICMP
messages that Traceroute
receives is the message
port unreachable.
(type 3, code 3).The
second one is time
exceeded (type 11) and
it's received if TTL
(time to live)
is 0.
When Traceroute sends
UDP datagrams, there
are two cases. Case 1:
Destination is reached.
But destination port is
chose as unlikely value,
so that destination UDP
module generates an
ICMP message port
unreachable.
Case 2:
Destination host hasn't
reached and TTL is 0.
then UDP module of the
current host sends back
the ICMP message time
exceeded and the host
IP address.
|