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

Commit 794b99d6 authored by Subash Abhinov Kasiviswanathan's avatar Subash Abhinov Kasiviswanathan Committed by Linux Build Service Account
Browse files

connectivity: Update the logic for running clatd

Enable/disable Android XLAT feature based on persist property
"persist.net.doxlat". Disabling this property allows hardware
to take over the XLAT functionality.

CRs-Fixed: 1017795
Change-Id: Iae830e7d74e08161ed8ab1ff0ea50c5b2cb97079
parent 3b00945c
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.os.Handler;
import android.os.Message;
import android.os.INetworkManagementService;
import android.os.RemoteException;
import android.os.SystemProperties;
import android.util.Slog;

import com.android.server.net.BaseNetworkObserver;
@@ -96,7 +97,12 @@ public class Nat464Xlat extends BaseNetworkObserver {
                (nai.linkProperties != null) ? nai.linkProperties.hasIPv4Address() : false;
        // Only support clat on mobile and wifi for now, because these are the only IPv6-only
        // networks we can connect to.
        return connected && !hasIPv4Address && ArrayUtils.contains(NETWORK_TYPES, netType);
        boolean doXlat = SystemProperties.getBoolean("persist.net.doxlat",true);
        if(!doXlat) {
            Slog.i(TAG, "Android Xlat is disabled");
        }
        return connected && !hasIPv4Address && ArrayUtils.contains(NETWORK_TYPES, netType)
               && ((netType == ConnectivityManager.TYPE_MOBILE) ? doXlat : true);
    }

    /**