2

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. – Mike Pennington Mar 26 '14 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 '17 at 16:27
3

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
  field.

DISCUSSION

  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 '14 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. – Mike Pennington Mar 22 '14 at 1:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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