0

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.

2

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.

2
  • would it be correct to assume, that if my application sends a UDP datagram whose size is larger than MTU of some network along the way, the IP layer will use PMTUD to adjust packets size transparently to the transport layer/application? That is, if ICMP messages can make it all the way back to the source host. If ICMPs are lost, do I need to handle size adjustments and retransmission in the application layer? RFC 4821 states that transport protocol needs to have some acknowledgement mechanism, which UDP lacks – Nikita Tkachenko Sep 6 '20 at 12:00
  • 1
    Yes - on most implementations, your local stack (network layer) will use PMTUD and fragment the UDP datagram as required. If ICMP messages are lost, PMTUD doesn't work and the dropped UDP datagram is lost. As always with UDP, the application layer needs to handle retransmissions, if required. – Zac67 Sep 6 '20 at 12:34

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.