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

Commit 7470ff0a authored by Jack Yu's avatar Jack Yu
Browse files

Fixed the anomaly report

Changed the detection logic. If requesting protocol is IPv4, then
at least one of the IP addresses needs to be IPv4. If requesting
protocol is IPv6, then at least one of the IP addresses needs to be
IPv6.

Test: Basic telephony functionality tests
Test: atest FrameworksTelephonyTests
Bug: 323441807

Change-Id: I31f1d6cb60d2df19a6b4e75bb04cc37e16b45613
parent 1c1b5918
Loading
Loading
Loading
Loading
+12 −12
Original line number Diff line number Diff line
@@ -2822,22 +2822,22 @@ public class DataNetwork extends StateMachine {
                            == 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);
                        if (response.getAddresses().stream().noneMatch(
                                la -> la.getAddress() instanceof java.net.Inet4Address)) {
                            loge("Invalid DataCallResponse. Requested IPv4 but didn't get an "
                                    + "IPv4 address." + response);
                            reportAnomaly(underlyingDataService + " reported mismatched IP "
                                            + "type. Requested IPv4 but got IPv6 address.",
                                    "7744f920-fb64-4db0-ba47-de0eae485a81");
                                    + "type. Requested IPv4 but didn't get an IPv4 "
                                    + "address.", "7744f920-fb64-4db0-ba47-de0eae485a82");
                        }
                    } 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);
                        if (response.getAddresses().stream().noneMatch(
                                la -> la.getAddress() instanceof java.net.Inet6Address)) {
                            loge("Invalid DataCallResponse. Requested IPv6 but didn't get an "
                                    + "IPv6 address." + response);
                            reportAnomaly(underlyingDataService + " reported mismatched IP "
                                            + "type. Requested IPv6 but got IPv4 address.",
                                    "7744f920-fb64-4db0-ba47-de0eae485a81");
                                    + "type. Requested IPv6 but didn't get an IPv6 "
                                    + "address.", "7744f920-fb64-4db0-ba47-de0eae485a82");
                        }
                    }
                }