Loading src/java/com/android/internal/telephony/dataconnection/DataConnection.java +25 −1 Original line number Diff line number Diff line Loading @@ -127,6 +127,8 @@ public class DataConnection extends StateMachine { private static final String RAT_NAME_5G = "nr"; private static final String RAT_NAME_EVDO = "evdo"; private static final int MIN_V6_MTU = 1280; /** * The data connection is not being or been handovered. Note this is the state for the source * data connection, not destination data connection Loading Loading @@ -1603,9 +1605,31 @@ public class DataConnection extends StateMachine { } } boolean useLowerMtuValue = false; CarrierConfigManager configManager = (CarrierConfigManager) mPhone.getContext().getSystemService(Context.CARRIER_CONFIG_SERVICE); if (configManager != null) { PersistableBundle bundle = configManager.getConfigForSubId(mSubId); if (bundle != null) { useLowerMtuValue = bundle.getBoolean( CarrierConfigManager.KEY_USE_LOWER_MTU_VALUE_IF_BOTH_RECEIVED) && response.getMtuV4() != PhoneConstants.UNSET_MTU && response.getMtuV6() != PhoneConstants.UNSET_MTU; } } int interfaceMtu = response.getMtu(); for (InetAddress gateway : response.getGatewayAddresses()) { int mtu = gateway instanceof java.net.Inet6Address ? response.getMtuV6() : response.getMtuV4(); if (useLowerMtuValue) { mtu = Math.min(response.getMtuV4(), response.getMtuV6()); // Never set an MTU below MIN_V6_MTU on a network that has IPv6. if (mtu < MIN_V6_MTU) { mtu = MIN_V6_MTU; } interfaceMtu = mtu; } // Allow 0.0.0.0 or :: as a gateway; // this indicates a point-to-point interface. linkProperties.addRoute(new RouteInfo(null, gateway, null, Loading @@ -1615,7 +1639,7 @@ public class DataConnection extends StateMachine { // set interface MTU // this may clobber the setting read from the APN db, but that's ok // TODO: remove once LinkProperties#setMtu is deprecated linkProperties.setMtu(response.getMtu()); linkProperties.setMtu(interfaceMtu); result = SetupResult.SUCCESS; } catch (UnknownHostException e) { Loading Loading
src/java/com/android/internal/telephony/dataconnection/DataConnection.java +25 −1 Original line number Diff line number Diff line Loading @@ -127,6 +127,8 @@ public class DataConnection extends StateMachine { private static final String RAT_NAME_5G = "nr"; private static final String RAT_NAME_EVDO = "evdo"; private static final int MIN_V6_MTU = 1280; /** * The data connection is not being or been handovered. Note this is the state for the source * data connection, not destination data connection Loading Loading @@ -1603,9 +1605,31 @@ public class DataConnection extends StateMachine { } } boolean useLowerMtuValue = false; CarrierConfigManager configManager = (CarrierConfigManager) mPhone.getContext().getSystemService(Context.CARRIER_CONFIG_SERVICE); if (configManager != null) { PersistableBundle bundle = configManager.getConfigForSubId(mSubId); if (bundle != null) { useLowerMtuValue = bundle.getBoolean( CarrierConfigManager.KEY_USE_LOWER_MTU_VALUE_IF_BOTH_RECEIVED) && response.getMtuV4() != PhoneConstants.UNSET_MTU && response.getMtuV6() != PhoneConstants.UNSET_MTU; } } int interfaceMtu = response.getMtu(); for (InetAddress gateway : response.getGatewayAddresses()) { int mtu = gateway instanceof java.net.Inet6Address ? response.getMtuV6() : response.getMtuV4(); if (useLowerMtuValue) { mtu = Math.min(response.getMtuV4(), response.getMtuV6()); // Never set an MTU below MIN_V6_MTU on a network that has IPv6. if (mtu < MIN_V6_MTU) { mtu = MIN_V6_MTU; } interfaceMtu = mtu; } // Allow 0.0.0.0 or :: as a gateway; // this indicates a point-to-point interface. linkProperties.addRoute(new RouteInfo(null, gateway, null, Loading @@ -1615,7 +1639,7 @@ public class DataConnection extends StateMachine { // set interface MTU // this may clobber the setting read from the APN db, but that's ok // TODO: remove once LinkProperties#setMtu is deprecated linkProperties.setMtu(response.getMtu()); linkProperties.setMtu(interfaceMtu); result = SetupResult.SUCCESS; } catch (UnknownHostException e) { Loading