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

Commit 1db7f794 authored by Chia-chi Yeh's avatar Chia-chi Yeh Committed by Android (Google) Code Review
Browse files

Merge "VPN: reset legacy VPN when resetting IPv4 addresses."

parents f01e16a0 0c074e68
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -1780,14 +1780,20 @@ public class ConnectivityService extends IConnectivityManager.Stub {
        mCurrentLinkProperties[netType] = newLp;
        boolean resetDns = updateRoutes(newLp, curLp, mNetConfigs[netType].isDefault());

        if (doReset || resetMask != 0 || resetDns) {
        if (resetMask != 0 || resetDns) {
            LinkProperties linkProperties = mNetTrackers[netType].getLinkProperties();
            if (linkProperties != null) {
                String iface = linkProperties.getInterfaceName();
                if (TextUtils.isEmpty(iface) == false) {
                    if (doReset || resetMask != 0) {
                    if (resetMask != 0) {
                        if (DBG) log("resetConnections(" + iface + ", " + resetMask + ")");
                        NetworkUtils.resetConnections(iface, resetMask);

                        // Tell VPN the interface is down. It is a temporary
                        // but effective fix to make VPN aware of the change.
                        if ((resetMask & NetworkUtils.RESET_IPV4_ADDRESSES) != 0) {
                            mVpn.interfaceStatusChanged(iface, false);
                        }
                    }
                    if (resetDns) {
                        if (DBG) log("resetting DNS cache for " + iface);
+3 −1
Original line number Diff line number Diff line
@@ -265,7 +265,6 @@ public class Vpn extends INetworkManagementEventObserver.Stub {
    // INetworkManagementEventObserver.Stub
    @Override
    public void interfaceLinkStateChanged(String interfaze, boolean up) {
        interfaceStatusChanged(interfaze, up);
    }

    // INetworkManagementEventObserver.Stub
@@ -280,6 +279,9 @@ public class Vpn extends INetworkManagementEventObserver.Stub {
            if (mConnection != null) {
                mContext.unbindService(mConnection);
                mConnection = null;
            } else if (mLegacyVpnRunner != null) {
                mLegacyVpnRunner.exit();
                mLegacyVpnRunner = null;
            }
        }
    }