RFC 777

Internet Control Message Protocol

๐Ÿ“… published April 1981, from ietf

Internet Control Message Protocol ๐ŸŽ€

okay bestie, let's talk about RFC 777 ๐Ÿ’– It's from the Network Working Group, written by J. Postel at ISI in April 1981. It's giving old-school internet OG energy ๐Ÿงš It updates IENs 109, 128 and RFC 760, so it's basically a glow-up on those.

Introduction

okay so the Internet Protocol (IP) [1] handles host-to-host datagram service in a system of connected networks called the Catenet [2] ๐ŸŒธ The devices that connect those networks are called Gateways. They talk to each other for control purposes using the Gateway to Gateway Protocol (GGP) [3,4] ๐Ÿซถ Sometimes a gateway or destination host has to chat with a source host, like to report an error in datagram processing. That's where this protocol comes in: the Internet Control Message Protocol (ICMP) ๐Ÿ’… ICMP uses IP's basic support as if it were a higher level protocol, but honestly it's actually an integral part of IP, so every IP module MUST implement it ๐Ÿ‘‘

ICMP messages get sent in a bunch of situations ๐Ÿฆ‹ For example: when a datagram can't reach its destination, when a gateway doesn't have the buffering capacity to forward a datagram, and when a gateway can direct the host to send traffic on a shorter route ๐Ÿ“

Real talk: IP is not designed to be absolutely reliable ๐Ÿ™ˆ These control messages exist to give feedback about problems in the communication environment, not to make IP reliable. There are still no guarantees that a datagram gets delivered or that a control message gets returned ๐Ÿ˜ญ Some datagrams may vanish without any report of their loss. So if reliable communication is needed, the higher level protocols that use IP MUST implement their own reliability procedures โœจ

ICMP messages usually report errors in datagram processing. To avoid the infinite regress of messages about messages about messages (ugh, the spiral ๐Ÿ’€), no ICMP messages are sent about ICMP messages ๐ŸŒˆ

Message Formats

ICMP messages get sent using the basic IP header ๐Ÿ’Œ The first octet of the datagram's data portion is an ICMP type field, and its value decides the format of the rest of the data ๐ŸŽ€ Any field labeled "unused" is reserved for later extensions and MUST be zero when sent, but receivers SHOULD NOT check these fields ๐Ÿซฃ Unless an individual format description says otherwise, the internet header fields look like this:

  • Version: 4 ๐Ÿ’–
  • IHL: the internet header length in 32-bit words ๐ŸŒธ
  • Type of Service: 0 โœจ
  • Total Length: the length of the internet header and data in octets ๐Ÿฆ‹
  • Identification, Flags, Fragment Offset: used in fragmentation, see [1] ๐Ÿงš
  • Time to Live: the time to live in seconds. This field gets decremented at each machine that processes the datagram, so the value SHOULD be at least as great as the number of gateways this datagram will traverse ๐Ÿ“
  • Protocol: ICMP = 1 ๐Ÿ‘‘
  • Header Checksum: the 16 bit one's complement of the one's complement sum of all 16 bit words in the header. To compute it, the checksum field SHOULD be zero ๐Ÿ™ˆ Also, this checksum MAY be replaced in the future ๐Ÿ”ฎ
  • Source Address: the address of the gateway or host composing the ICMP message. Unless otherwise noted, this can be any of a gateway's addresses ๐Ÿ’…
  • Destination Address: the address of the gateway or host the message should be sent to ๐Ÿ’•

Destination Unreachable Message ๐Ÿšซ

Here's the layout for this one ๐Ÿ’–

    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |     Type      |     Code      |           unused              |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |      Internet Header + 64 bits of Original Data Datagram      |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

IP Fields:

  • Destination Address: the source network and address from the original datagram's data ๐Ÿงญ

ICMP Fields:

  • Type: 3 ๐Ÿ’ซ
  • Code:
    • 0 = net unreachable; ๐ŸŒ
    • 1 = host unreachable; ๐Ÿ 
    • 2 = protocol unreachable; ๐Ÿ“ฎ
    • 3 = port unreachable; ๐Ÿšช
    • 4 = fragmentation needed and DF set. โœ‚๏ธ
  • Internet Header + 64 bits of Data Datagram: the internet header plus the first 64 bits of the original datagram's data. The host uses this data to match the message to the right process ๐ŸŽฏ If a higher level protocol uses port numbers, they're assumed to be in the first 64 data bits of the original datagram's data ๐Ÿ”ข

Description:

Okay so if the gateway's routing tables say the network in the datagram's internet destination field is unreachable (like the distance to the network is infinity), the gateway sends a destination unreachable message to the internet source host of the datagram ๐ŸŒช๏ธ Also, on some networks the gateway MAY be able to determine if the internet destination host is unreachable, and gateways on those networks MAY send destination unreachable messages to the source host when that happens ๐Ÿค“

If the IP module in the destination host can't deliver the datagram because the indicated protocol module or process port isn't active, the destination host MAY send a destination unreachable message to the source host ๐Ÿ“ญ

Another case: a datagram has to be fragmented so a gateway can forward it, but the Don't Fragment flag is on. In this situation the gateway MUST discard the datagram and return a destination unreachable message ๐Ÿ™…โ€โ™€๏ธ๐Ÿ’€


Time Exceeded Message โณ

Here's the layout ๐Ÿฆ‹

    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |     Type      |     Code      |           unused              |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |      Internet Header + 64 bits of Original Data Datagram      |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

IP Fields:

  • Destination Address: the source network and address from the original datagram's data ๐Ÿงญ

ICMP Fields:

  • Type: 11 ๐Ÿ•ฐ๏ธ
  • Code:
    • 0 = time to live exceeded in transit; ๐Ÿšš
    • 1 = fragment reassembly time exceeded. ๐Ÿงฉ
  • Internet Header + 64 bits of Data Datagram: the internet header plus the first 64 bits of the original datagram's data. The host uses this data to match the message to the right process ๐ŸŽฏ If a higher level protocol uses port numbers, they're assumed to be in the first 64 data bits of the original datagram's data ๐Ÿ”ข

Description:

If a gateway processing a datagram finds the time to live field is zero, it MUST discard the datagram ๐Ÿ—‘๏ธ The gateway MAY also notify the source host with a time exceeded message ๐Ÿ“ฃ

If a host reassembling a fragmented datagram can't finish the reassembly because fragments are missing within its time limit, it discards the datagram, and it MAY send a time exceeded message ๐Ÿงต bestie, the timer really said no ๐Ÿ˜ญ


Parameter Problem Message ๐Ÿง

Here's the layout ๐Ÿ’…

    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |     Type      |     Code      |   Parameter   |     unused    |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |      Internet Header + 64 bits of Original Data Datagram      |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

IP Fields:

  • Destination Address: the source network and address from the original datagram's data ๐Ÿงญ

ICMP Fields:

  • Type: 12 ๐ŸŽ€
  • Code:
    • 0 = problem with option. โš ๏ธ
  • Parameter: if code = 0, the IP option type ๐Ÿท๏ธ
  • Internet Header + 64 bits of Data Datagram: the internet header plus the first 64 bits of the original datagram's data. The host uses this data to match the message to the right process ๐ŸŽฏ If a higher level protocol uses port numbers, they're assumed to be in the first 64 data bits of the original datagram's data ๐Ÿ”ข

Description:

If a gateway or host processing a datagram finds a problem with the header parameters that stops it from finishing the processing, it MUST discard the datagram ๐Ÿšจ One potential source of this problem is an option that isn't implemented, or incorrect arguments in an option ๐Ÿ™ƒ The gateway or host MAY also notify the source host with a parameter problem message ๐Ÿ’Œ


Source Quench Message ๐ŸŒŠ

Here's the layout ๐Ÿซง

    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |     Type      |                 unused                        |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |      Internet Header + 64 bits of Original Data Datagram      |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

IP Fields:

  • Destination Address: the source network and address of the original datagram's data ๐Ÿงญ

ICMP Fields:

  • Type: 4 ๐Ÿซง
  • Internet Header + 64 bits of Data Datagram: the internet header plus the first 64 bits of the original datagram's data. The host uses this data to match the message to the right process ๐ŸŽฏ If a higher level protocol uses port numbers, they're assumed to be in the first 64 data bits of the original datagram's data ๐Ÿ”ข

Description:

A gateway MAY discard internet datagrams if it doesn't have the buffer space needed to queue them for output to the next network on the route to the destination network ๐Ÿชฃ If a gateway discards a datagram, it MAY send a source quench message to the internet source host of the datagram. A destination host MAY also send a source quench message if datagrams arrive too fast to be processed ๐Ÿƒโ€โ™€๏ธ๐Ÿ’จ The source quench message is basically a request asking the host to cut back the rate at which it sends traffic to the internet destination ๐Ÿ™ The gateway MAY send a source quench message for every message it discards ๐Ÿ—ฏ๏ธ When a source host gets a source quench message, it SHOULD cut back the rate at which it sends traffic to the specified destination, and it keeps that up until it no longer receives source quench messages from the gateway. Then the source host can gradually increase the rate at which it sends traffic to the destination, until it gets source quench messages again ๐Ÿ“ˆ

The gateway or host MAY send the source quench message when it approaches its capacity limit, instead of waiting until the capacity is exceeded ๐Ÿšฆ This means the data datagram that triggered the source quench message may still get delivered ๐Ÿ’ซ

Redirect Message ๐Ÿ’…

okay bestie, the redirect message is a gateway politely tapping a host on the shoulder to say "hey, there's a shortcut ๐Ÿฆ‹" Here's the layout:

    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |     Type      |     Code      |            unused             |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                 Gateway Internet Address                      |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |      Internet Header + 64 bits of Original Data Datagram      |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

IP Fields โœจ

Destination Address

The source network and address of the original datagram's data. ๐ŸŽ€

ICMP Fields ๐Ÿ’œ

Type

5 ๐ŸŒธ

Code

  • 0 = Redirect datagrams for the Network.
  • 1 = Redirect datagrams for the Host.
  • 2 = Redirect datagrams for the Type of Service and Network.
  • 3 = Redirect datagrams for the Type of Service and Host.

Gateway Internet Address

Address of the gateway to which traffic for the network specified in the internet destination network field of the original datagram's data should be sent. ๐Ÿงš

Internet Header + 64 bits of Data Datagram

The internet header plus the first 64 bits of the original datagram's data. This data is used by the host to match the message to the appropriate process. If a higher level protocol uses port numbers, they are assumed to be in the first 64 data bits of the original datagram's data. ๐Ÿ”ฅ

Description

Okay, the story goes like this ๐Ÿ“ A gateway, G1, receives an internet datagram from a host on a network the gateway is attached to. G1 checks its routing table and gets the address of the next gateway, G2, on the route to the datagram's internet destination network, X. If G2 and the host (identified by the internet source address of the datagram) are on the same network, a redirect message gets sent to the host. The redirect message advises the host to send its traffic for network X directly to gateway G2, because that's a shorter path to the destination. Meanwhile, the gateway still forwards the original datagram's data to its internet destination. Main character energy, literally. ๐Ÿ‘‘

Echo or Echo Reply Message ๐ŸŒˆ

the echo and echo reply pair is giving ping-pong vibes ๐Ÿ“ Here's the header:

    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |     Type      |                  unused                       |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |     Data ...
   +-+-+-+-+-

IP Fields โœจ

Addresses

The address of the source in an echo message will be the destination of the echo reply message. To form an echo reply message, the source and destination addresses are simply reversed. ๐Ÿฆ‹

IP Fields ๐Ÿ’œ

Type

  • 8 for echo message;
  • 0 for echo reply message.

Description

The data received in the echo message must be returned in the echo reply message. No skipping, no editing, just send it right back ๐Ÿ’–

Timestamp or Timestamp Reply Message โญ

timestamps are the ultimate receipts ๐Ÿงพ Here's the header:

    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |     Type      |                  unused                       |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |     Originate Timestamp                                       |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |     Receive Timestamp                                         |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |     Transmit Timestamp                                        |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

IP Fields โœจ

Addresses

The address of the source in a timestamp message will be the destination of the timestamp reply message. To form a timestamp reply message, the source and destination addresses are simply reversed. ๐ŸŽ€

IP Fields ๐Ÿ’œ

Type

  • 13 for timestamp message;
  • 14 for timestamp reply message.

Description

The data received (a timestamp) in the message is returned in the reply together with an additional timestamp. The timestamp is 32 bits of milliseconds since midnight UT. One use of these timestamps is described by Mills [5]. โฐ๐Ÿซถ

Summary of Message Types ๐ŸŒธ

here's the cheat sheet, bestie ๐Ÿ“‹

    0  Echo Reply

    3  Destination Unreachable

    4  Source Quench

    5  Redirect

    8  Echo

   11  Time Exceeded

   12  Parameter Problem

   13  Timestamp

   14  Timestamp Reply

References ๐Ÿ“š

  • [1] Postel, J., ed., "DOD Standard Internet Protocol", IEN 128, RFC 760, USC/Information Sciences Institute, NTIS ADA079730, January 1980. Appears in: Computer Communication Review, Special Interest Group on Data Communications, ACM, V.10, N.4, October 1980.
  • [2] Cerf, V., "The Catenet Model for Internetworking," Information Processing Techniques Office, Defense Advanced Research Projects Agency, IEN 48, July 1978.
  • [3] Strazisar, V., "Gateway Routing: An Implementation Specification", IEN 30, Bolt Beranek and Newman, April 1979.
  • [4] Strazisar, V., "How to Build a Gateway", IEN 109, Bolt Beranek and Newman, August 1979.
  • [5] Mills, D., "DCNET Internet Clock Service," RFC 778, COMSAT Laboratories, April 1981. ๐Ÿฆ‹
๐Ÿ“ฆ where this page comes from