Setting MTU size for specific network.
Able to config network specific MTU size. Normally, the default size of MTU is 1500. US - ATT 1410, TMUS 1440, SPRINT 1422 KR - SKT 1440, KT 1450, LGU+ 1428 JP - KDDI 1420, SoftBank 1340 CA - RGS 1430, FIDO 1430, MTS 1430, BELL 1358, SaskTel 1358 AU - TEL 1400 Bug: 10195070 Change-Id: Ie18650b37a3d44af944f2dae4aa97c04fb12cd5e
This commit is contained in:
@@ -2299,6 +2299,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
}
|
||||
thisNet.setTeardownRequested(false);
|
||||
updateNetworkSettings(thisNet);
|
||||
updateMtuSizeSettings(thisNet);
|
||||
handleConnectivityChange(newNetType, false);
|
||||
sendConnectedBroadcastDelayed(info, getConnectivityChangeDelay());
|
||||
|
||||
@@ -2636,6 +2637,26 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
return routesChanged;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the network specific MTU size from reources.
|
||||
* and set it on it's iface.
|
||||
*/
|
||||
private void updateMtuSizeSettings(NetworkStateTracker nt) {
|
||||
final String iface = nt.getLinkProperties().getInterfaceName();
|
||||
final int mtu = nt.getLinkProperties().getMtu();
|
||||
|
||||
if (mtu < 68 || mtu > 10000) {
|
||||
loge("Unexpected mtu value: " + nt);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if (VDBG) log("Setting MTU size: " + iface + ", " + mtu);
|
||||
mNetd.setMtu(iface, mtu);
|
||||
} catch (Exception e) {
|
||||
Slog.e(TAG, "exception in setMtu()" + e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the network specific TCP buffer sizes from SystemProperties
|
||||
@@ -4774,4 +4795,3 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, wakeupTime, intent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user