chiark / gitweb /
pathmtu/pathmtu.c: Use IP_PMTUDISC_PROBE for sending the lookups.
authorMark Wooding <mdw@distorted.org.uk>
Sat, 3 May 2014 19:04:44 +0000 (20:04 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 3 May 2014 19:27:55 +0000 (20:27 +0100)
commit18d5f6eb91b1f8e1f497b0176c07a91aa6492be0
tree76ea59c88f97865bf8ab6c0c873dc55201c926f8
parent8886c0f989e1a7c437836f6443b3d94aa450cec3
pathmtu/pathmtu.c: Use IP_PMTUDISC_PROBE for sending the lookups.

Linux's behaviour is very strange if you set IP_PMTUDISC_DO.  Suppose we
have this situation:

host A <-1500-> router B <-1432-> ... <-1500-> host Z

We send a 1500-byte probe from A.  Router B sends back `fragmentation
needed' with maximum size 1432.  Linux reports EMSGSIZE back to us, but
when we read IP_MTU, we get 1500 again.  OK: we send another probe with
1500, for old times' sake, but the write(2) fails with EMSGSIZE.  At
this point we give up and try binary search.  The next size we try is
1038, but write(2) fails again, inexplicably.  Subsequent binary search
succeeds, so we end up with an MTU of 1037.  This is too small for IPv6.

Using IP_PMTUDISC_PROBE instead seems to prevent Linux from being
hopeless at write(2) time.
pathmtu/pathmtu.c