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

Commit 6fde4445 authored by Seweryn Fornalik's avatar Seweryn Fornalik
Browse files

Test if it's possible to block IP from ConnectivityService

parent 40f01bc1
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -81,6 +81,7 @@ import android.net.ITetheringEventCallback;
import android.net.InetAddresses;
import android.net.IpMemoryStore;
import android.net.IpPrefix;
import android.net.LinkAddress;
import android.net.LinkProperties;
import android.net.LinkProperties.CompareResult;
import android.net.MatchAllNetworkSpecifier;
@@ -1262,6 +1263,15 @@ public class ConnectivityService extends IConnectivityManager.Stub
        if (isUidIsolated(uid)) {
            return true;
        }

        //firewall test - try to block hardcoded IP address 51.158.73.142, 188.165.21.119
        for (LinkAddress la : lp.getLinkAddresses()) {
            if (la.getAddress().getHostAddress().contains("51.158.73.142") ||
                    la.getAddress().getHostAddress().contains("188.165.21.119")) {
                return true;
            }
        }

        // Networks aren't blocked when ignoring blocked status
        if (ignoreBlocked) {
            return false;