]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[tcp] Reduce path MTU to 1280 bytes
authorMichael Brown <mcb30@ipxe.org>
Wed, 4 Sep 2013 16:37:34 +0000 (17:37 +0100)
committerMichael Brown <mcb30@ipxe.org>
Wed, 4 Sep 2013 16:48:58 +0000 (17:48 +0100)
The path MTU is currently hardcoded to 1460 bytes, which fails to
allow space for TCP options.  Sending a maximum-sized datagram (which
is viable when using HTTP POST) will therefore fail since the Ethernet
MTU will be exceeded.

Reduce the hardcoded path MTU to produce a maximum datagram of 1280
bytes, which is the size required of data link layers by IPv6.  It is
a reasonable assumption that all intermediary data link layers will be
able to convey this packet without fragmentation, even for IPv4.

Note that this reduction has a minimal impact upon download
throughput, since it affects only the transmit data path.

Originally-fixed-by: Suresh Sundriyal <ssundriy@vmware.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/include/ipxe/tcp.h

index 6b6691175fcb05e65ad926bd8d243f183ec03acd..eb4b7b222954df992bb762efb1ff56eb406902c9 100644 (file)
@@ -316,10 +316,19 @@ struct tcp_options {
 /**
  * Path MTU
  *
- * We really ought to implement Path MTU discovery.  Until we do,
- * anything with a path MTU greater than this may fail.
+ * IPv6 requires all data link layers to support a datagram size of
+ * 1280 bytes.  We choose to use this as our maximum transmitted
+ * datagram size, on the assumption that any practical link layer we
+ * encounter will allow this size.  This is a very conservative
+ * assumption in practice, but the impact of making such a
+ * conservative assumption is insignificant since the amount of data
+ * that we transmit (rather than receive) is negligible.
+ *
+ * We allow space within this 1280 bytes for an IPv6 header, a TCP
+ * header, and a (padded) TCP timestamp option.
  */
-#define TCP_PATH_MTU 1460
+#define TCP_PATH_MTU                                                   \
+       ( 1280 - 40 /* IPv6 */ - 20 /* TCP */ - 12 /* TCP timestamp */ )
 
 /**
  * Advertised TCP MSS