Merge "Setting MTU size for specific network." into klp-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
67e0bdf7cf
@@ -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
|
||||
@@ -4771,4 +4792,3 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, wakeupTime, intent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user