How is ICMP Packet Too Big handled in IPv6

fragmentationicmpv6ipv6

I am trying to comprehend the way packets fragmentation works in IPv6.

As far as I understand it, IPv6 routers never fragment packets: upon receiving a packet whose size is bigger than the MTU of the next network IPv6 router discards it, sending ICMPv6 Packet Too Big message back to the source host.

Considering this, I would like to understand the following:

  1. Is it correct that ICMP messages are handled by the IP protocol implementation on the source host?
  2. How is Packet Too Big message handled in particular?
  3. Is the proper way of reacting to PTB message defined in the protocol specification or is it up to the implementations to decide?
  4. Does handling differ depending on whether the payload is TCP or UDP?
  5. Is fragmentation/PTB/Path MTU Discovery handled completely in the IP layer or do upper layer protocols need to participate?
  6. What if ICMP traffic is filtered somewhere in between the router and the source and the PTB is never received?

What I would like to know in the end is whether IP fragmentation is something that I need to care about, being an application developer and working with TCP/UDP.

Best Answer

With IPv6, routers don't fragment packets. End nodes might.

Path MTU discovery (PMTUD) is mandatory for IPv6, so the all path nodes and the end nodes agree on the path MTU before actual data begins to flow. Fragmentation is only required when a datagram is to be transported that would exceed the path MTU - that is up to the source node entirely.

ICMP is used to discover the path MTU. First, the source node assumes the path MTU is equal to its local MTU on the egress interface. If that exceeds a hop's MTU, that hop returns an ICMPv6 Packet too big along with its own MTU. The ICMP message contains enough details from the original packet for the source node to match the connection. The source node then tries again with that lower MTU (possibly discovering a later, even smaller MTU hop).

Some transport-layer protocols actively use PMTUD to size their messages. E.g. TCP uses it to discover its maximum segment size MSS. Some don't, so the application (layer) needs to take care.

If intermediate nodes drop all ICMP messages they break PMTUD. Some stacks try to work around that but most don't, causing an established socket to hang.

As a developer, you should be aware of RFC 4821.

Related Topic