Skip to content
Snippets Groups Projects
Commit 9f94648b authored by Maciej Żenczykowski's avatar Maciej Żenczykowski
Browse files

Lower CLAT max MTU from 65536 to 1528.

Android's clat is for reaching the internet, which in general
never has an ipv4 L3 mtu higher than 1500.

(We could probably hit this on a jumboframe enabled IPv6-only
wifi network [ http://b/292057969#comment18

 ] where RA claims
MTU of 9K [9170])

Bug: 292057969
Test: TreeHugger
Signed-off-by: default avatarMaciej Żenczykowski <maze@google.com>
Change-Id: I7a32455571458b8a3f1121ad980d54323b2ef06b
parent 868859d4
No related branches found
No related tags found
No related merge requests found
......@@ -78,7 +78,7 @@ public class ClatCoordinator {
@VisibleForTesting
static final int MTU_DELTA = 28;
@VisibleForTesting
static final int CLAT_MAX_MTU = 65536;
static final int CLAT_MAX_MTU = 1500 + MTU_DELTA;
// This must match the interface prefix in clatd.c.
private static final String CLAT_PREFIX = "v4-";
......@@ -673,7 +673,7 @@ public class ClatCoordinator {
throw new IOException("Detect MTU on " + tunIface + " failed: " + e);
}
final int mtu = adjustMtu(detectedMtu);
Log.i(TAG, "ipv4 mtu is " + mtu);
Log.i(TAG, "detected ipv4 mtu of " + detectedMtu + " adjusted to " + mtu);
// Config tun interface mtu, address and bring up.
try {
......
......@@ -508,10 +508,10 @@ public class ClatCoordinatorTest {
// Expected mtu is that the detected mtu minus MTU_DELTA(28).
assertEquals(1372, ClatCoordinator.adjustMtu(1400));
assertEquals(1472, ClatCoordinator.adjustMtu(ETHER_MTU));
assertEquals(65508, ClatCoordinator.adjustMtu(CLAT_MAX_MTU));
assertEquals(1500, ClatCoordinator.adjustMtu(CLAT_MAX_MTU));
// Expected mtu is that CLAT_MAX_MTU(65536) minus MTU_DELTA(28).
assertEquals(65508, ClatCoordinator.adjustMtu(CLAT_MAX_MTU + 1 /* over maximum mtu */));
// Expected mtu is that CLAT_MAX_MTU(1528) minus MTU_DELTA(28).
assertEquals(1500, ClatCoordinator.adjustMtu(CLAT_MAX_MTU + 1 /* over maximum mtu */));
}
private void verifyDump(final ClatCoordinator coordinator, boolean clatStarted) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment