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

Commit a64db9a7 authored by Jack Yu's avatar Jack Yu Committed by Automerger Merge Worker
Browse files

Fixed anomaly detector for IP type mismatch am: 46dbee08

parents 93af7fa8 46dbee08
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -2461,26 +2461,31 @@ public class DataNetwork extends StateMachine {
                reportAnomaly("Invalid DataCallResponse detected",
                        "1f273e9d-b09c-46eb-ad1c-421d01f61164");
            }
            if (mDataProfile.getApnSetting() != null && mPhone.getServiceState().getDataRegState()
                    == ServiceState.STATE_IN_SERVICE) {
            NetworkRegistrationInfo nri = getNetworkRegistrationInfo();
            if (mDataProfile.getApnSetting() != null && nri != null && nri.isInService()) {
                boolean isRoaming = mPhone.getServiceState().getDataRoamingFromRegistration();
                int protocol = isRoaming ? mDataProfile.getApnSetting().getRoamingProtocol()
                        : mDataProfile.getApnSetting().getProtocol();
                String underlyingDataService = mTransport
                        == AccessNetworkConstants.TRANSPORT_TYPE_WWAN
                        ? "RIL" : "IWLAN data service";
                if (protocol == ApnSetting.PROTOCOL_IP) {
                    if (response.getAddresses().stream().anyMatch(
                            la -> la.getAddress() instanceof java.net.Inet6Address)) {
                        loge("Invalid DataCallResponse. Requested IPv4 but got IPv6 address. "
                                + response);
                        reportAnomaly("RIL reported mismatched IP type. Requested IPv6 "
                                + "but got IPv4 address.", "7744f920-fb64-4db0-ba47-de0eae485a7f");
                        reportAnomaly(underlyingDataService + " reported mismatched IP "
                                + "type. Requested IPv4 but got IPv6 address.",
                                "7744f920-fb64-4db0-ba47-de0eae485a80");
                    }
                } else if (protocol == ApnSetting.PROTOCOL_IPV6) {
                    if (response.getAddresses().stream().anyMatch(
                            la -> la.getAddress() instanceof java.net.Inet4Address)) {
                        loge("Invalid DataCallResponse. Requested IPv6 but got IPv4 address. "
                                + response);
                        reportAnomaly("RIL reported mismatched IP type. Requested IPv4 "
                                + "but got IPv6 address.", "7744f920-fb64-4db0-ba47-de0eae485a7f");
                        reportAnomaly(underlyingDataService + " reported mismatched IP "
                                        + "type. Requested IPv6 but got IPv4 address.",
                                "7744f920-fb64-4db0-ba47-de0eae485a80");
                    }
                }
            }