Introduce lightweight PMTU probe replies.
authorEtienne Dechamps <etienne@edechamps.fr>
Sun, 21 Jul 2013 12:05:42 +0000 (13:05 +0100)
committerEtienne Dechamps <etienne@edechamps.fr>
Mon, 22 Jul 2013 20:25:37 +0000 (21:25 +0100)
commite3c763eae89df9a69bb2d611238ef18f78de311f
tree9aac4de2c1ddb4113339d4c661397b47382a4234
parente3a4672afb8eb341b380e74b2bf6d098f61c08a3
Introduce lightweight PMTU probe replies.

When replying to a PMTU probe, tinc sends a packet with the same length
as the PMTU probe itself, which is usually large (~1450 bytes). This is
not necessary: the other node wants to know the size of the PMTU probes
that have been received, but encoding this information as the actual
reply length is probably the most inefficient way to do it. It doubles
the bandwidth usage of the PMTU discovery process, and makes it less
reliable since large packets are more likely to be dropped.

This patch introduces a new PMTU probe reply type, encoded as type "2"
in the first byte of the packet, that indicates that the length of the
PMTU probe that is being replied to is encoded in the next two bytes of
the packet. Thus reply packets are only 3 bytes long.

(This also protects against very broken networks that drop very small
packets - yes, I've seen it happen on a subnet of a national ISP - in
such a case the PMTU probe replies will be dropped, and tinc won't
enable UDP communication, which is a good thing.)

Because legacy nodes won't understand type 2 probe replies, the minor
protocol number is bumped to 3.

Note that this also improves bandwidth estimation, as it is able to
measure bandwidth in both directions independently (the node receiving
the replies is measuring in the TX direction) and the use of smaller
reply packets might decrease the influence of jitter.
src/net_packet.c
src/protocol.h