Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bd36ce0f authored by Sarah Chin's avatar Sarah Chin Committed by Automerger Merge Worker
Browse files

Merge "Revert "Use lower of IPv4/IPv6 MTU values based on config"" am:...

Merge "Revert "Use lower of IPv4/IPv6 MTU values based on config"" am: 14a8d7c1 am: 93256ec5 am: 428b38ea

Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/1891526

Change-Id: If567d9cb0eafb2925d9cd3c2a3116edbf01064fa
parents fd602544 428b38ea
Loading
Loading
Loading
Loading
+1 −25
Original line number Diff line number Diff line
@@ -150,8 +150,6 @@ public class DataConnection extends StateMachine {
     */
    private static final UUID OS_ID = UUID.fromString("97a498e3-fc92-5c94-8986-0333d06e4e47");

    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
@@ -2097,31 +2095,9 @@ 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,
@@ -2131,7 +2107,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(interfaceMtu);
                linkProperties.setMtu(response.getMtu());

                result = SetupResult.SUCCESS;
            } catch (UnknownHostException e) {