Procházet zdrojové kódy

[tcp] Reduce path MTU to 1280 bytes

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>
tags/v1.20.1
Michael Brown před 11 roky
rodič
revize
8dd180f165
1 změnil soubory, kde provedl 12 přidání a 3 odebrání
  1. 12
    3
      src/include/ipxe/tcp.h

+ 12
- 3
src/include/ipxe/tcp.h Zobrazit soubor

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

Načítá se…
Zrušit
Uložit