0

I was confused if ICMP is a network layer protocol why does it send transport layer fields in its error reporting messages.

1
  • Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you can post and accept your own answer.
    – Ron Maupin
    Dec 17, 2020 at 17:39

2 Answers 2

3

Because it is his very purpose.

ICMP was specifically created and designed to do so.

From RFC792

Introduction

[...]
Occasionally a gateway or destination host will communicate with a source host, for example, to report an error in datagram processing. For such purposes this protocol, the Internet Control Message Protocol (ICMP), is used.
[...]

ICMP messages are sent in several situations: for example, when a datagram cannot reach its destination, when the gateway does not have the buffering capacity to forward a datagram, and when the gateway can direct the host to send traffic on a shorter route.

[...]

The ICMP messages typically report errors in the processing of
datagrams.

Also remember that the layered model is juts that, a model, there's many things that cross layer boundaries.

1

ICMP errors will return part of the packet that caused the error. This is to provide information about which connection caused the error. If I simply return "time exceeded" with no context, the originator will (a) not know who I am -- being a random transit router, and (b) not have any clue which connection is in error. If I include the IP header in the error, then the originator can tell which connection caused it. (i.e. "my packet to X failed at Y for reason Z")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.