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: Maciej Żenczykowski <maze@google.com> Change-Id: I7a32455571458b8a3f1121ad980d54323b2ef06b
This commit is contained in:
@@ -78,7 +78,7 @@ public class ClatCoordinator {
|
|||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
static final int MTU_DELTA = 28;
|
static final int MTU_DELTA = 28;
|
||||||
@VisibleForTesting
|
@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.
|
// This must match the interface prefix in clatd.c.
|
||||||
private static final String CLAT_PREFIX = "v4-";
|
private static final String CLAT_PREFIX = "v4-";
|
||||||
@@ -673,7 +673,7 @@ public class ClatCoordinator {
|
|||||||
throw new IOException("Detect MTU on " + tunIface + " failed: " + e);
|
throw new IOException("Detect MTU on " + tunIface + " failed: " + e);
|
||||||
}
|
}
|
||||||
final int mtu = adjustMtu(detectedMtu);
|
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.
|
// Config tun interface mtu, address and bring up.
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -508,10 +508,10 @@ public class ClatCoordinatorTest {
|
|||||||
// Expected mtu is that the detected mtu minus MTU_DELTA(28).
|
// Expected mtu is that the detected mtu minus MTU_DELTA(28).
|
||||||
assertEquals(1372, ClatCoordinator.adjustMtu(1400));
|
assertEquals(1372, ClatCoordinator.adjustMtu(1400));
|
||||||
assertEquals(1472, ClatCoordinator.adjustMtu(ETHER_MTU));
|
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).
|
// Expected mtu is that CLAT_MAX_MTU(1528) minus MTU_DELTA(28).
|
||||||
assertEquals(65508, ClatCoordinator.adjustMtu(CLAT_MAX_MTU + 1 /* over maximum mtu */));
|
assertEquals(1500, ClatCoordinator.adjustMtu(CLAT_MAX_MTU + 1 /* over maximum mtu */));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void verifyDump(final ClatCoordinator coordinator, boolean clatStarted) {
|
private void verifyDump(final ClatCoordinator coordinator, boolean clatStarted) {
|
||||||
|
|||||||
Reference in New Issue
Block a user