Do routers verify the actual IP packet size with that mentioned in the packet?

  • If you feel that my answer helped you, you could Accept the answer by clicking the grey check box to the left of my answer. Mar 26, 2014 at 13:07
  • 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 could provide and accept your own answer.
    – Ron Maupin
    Aug 8, 2017 at 16:27

1 Answer 1


Routers should check the IP length, but are not required to. If they check, they are required to drop mismatches between the value in the IP header and the actual packet length. Routers should depend on link-layer payload detection, and compare with the IP header per RFC 1812.

This is covered in RFC 1812 - Requirements for IPv4 Routers, Section 5.2.2: IP Header Validation:

  Additionally, the router SHOULD verify that the packet length
  reported by the Link Layer is at least as large as the IP total
  length recorded in the packet's IP header.  If it appears that the
  packet has been truncated, the packet MUST be discarded, the error
  SHOULD be logged, and the router SHOULD respond with an ICMP
  Parameter Problem message whose pointer points at the IP total length
  Because any higher layer protocol that concerns itself with data
  corruption will detect truncation of the packet data when it
  reaches its final destination, it is not absolutely necessary for
  routers to perform the check suggested above to maintain protocol
  correctness.  However, by making this check a router can simplify
  considerably the task of determining which hop in the path is
  truncating the packets.  It will also reduce the expenditure of
  resources down-stream from the router in that down-stream systems
  will not need to deal with the packet.
  • IF the router validates the checksum, doesn't that imply length checking? Otherwise, how does it determine where the checksum is?
    – Ron Trunk
    Mar 21, 2014 at 23:30
  • Checksum offset calculation != length enforcement. The RFC clearly makes total IP length checks optional, but encouraged. There's a difference between knowing the offset to the checksum (ie required for enforcing valid checksum) and the activity of enforcing length consistency. When this was written (1995), routing was very commonly performed in software; every non-essential forwarding operation was subject to potential elimination by the implementation. Since ICMP messages and logging are required when dropping in this circumstance, it's actually a nontrivial requirement. Mar 22, 2014 at 1:01

Your Answer

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

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