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

Commit 2cd6cd8d authored by Erik Kline's avatar Erik Kline Committed by android-build-merger
Browse files

Don\'t flush DNS cache on route changes. am: 94887874

am: 09a5fbd6

* commit '09a5fbd6':
  Don't flush DNS cache on route changes.

Change-Id: I0e019a46548bbc81628939989fad39f96bc83ebe
parents 914c689a 09a5fbd6
Loading
Loading
Loading
Loading
+0 −5
Original line number Original line Diff line number Diff line
@@ -328,11 +328,6 @@ interface INetworkManagementService
     */
     */
    void setDnsServersForNetwork(int netId, in String[] servers, String domains);
    void setDnsServersForNetwork(int netId, in String[] servers, String domains);


    /**
     * Flush the DNS cache associated with the specified network.
     */
    void flushNetworkDnsCache(int netId);

    void setFirewallEnabled(boolean enabled);
    void setFirewallEnabled(boolean enabled);
    boolean isFirewallEnabled();
    boolean isFirewallEnabled();
    void setFirewallInterfaceRule(String iface, boolean allow);
    void setFirewallInterfaceRule(String iface, boolean allow);
+19 −25
Original line number Original line Diff line number Diff line
@@ -4137,8 +4137,8 @@ public class ConnectivityService extends IConnectivityManager.Stub
//        }
//        }
        updateTcpBufferSizes(networkAgent);
        updateTcpBufferSizes(networkAgent);


        final boolean flushDns = updateRoutes(newLp, oldLp, netId);
        updateRoutes(newLp, oldLp, netId);
        updateDnses(newLp, oldLp, netId, flushDns);
        updateDnses(newLp, oldLp, netId);


        updateClat(newLp, oldLp, networkAgent);
        updateClat(newLp, oldLp, networkAgent);
        if (isDefaultNetwork(networkAgent)) {
        if (isDefaultNetwork(networkAgent)) {
@@ -4241,14 +4241,16 @@ public class ConnectivityService extends IConnectivityManager.Stub
        return !routeDiff.added.isEmpty() || !routeDiff.removed.isEmpty();
        return !routeDiff.added.isEmpty() || !routeDiff.removed.isEmpty();
    }
    }


    private void updateDnses(LinkProperties newLp, LinkProperties oldLp, int netId,
    private void updateDnses(LinkProperties newLp, LinkProperties oldLp, int netId) {
                             boolean flush) {
        if (oldLp != null && newLp.isIdenticalDnses(oldLp)) {
        if (oldLp == null || (newLp.isIdenticalDnses(oldLp) == false)) {
            return;  // no updating necessary
        }

        Collection<InetAddress> dnses = newLp.getDnsServers();
        Collection<InetAddress> dnses = newLp.getDnsServers();
        if (DBG) log("Setting Dns servers for network " + netId + " to " + dnses);
        if (DBG) log("Setting Dns servers for network " + netId + " to " + dnses);
        try {
        try {
                mNetd.setDnsServersForNetwork(netId, NetworkUtils.makeStrings(dnses),
            mNetd.setDnsServersForNetwork(
                    newLp.getDomains());
                    netId, NetworkUtils.makeStrings(dnses), newLp.getDomains());
        } catch (Exception e) {
        } catch (Exception e) {
            loge("Exception in setDnsServersForNetwork: " + e);
            loge("Exception in setDnsServersForNetwork: " + e);
        }
        }
@@ -4257,14 +4259,6 @@ public class ConnectivityService extends IConnectivityManager.Stub
            setDefaultDnsSystemProperties(dnses);
            setDefaultDnsSystemProperties(dnses);
        }
        }
        flushVmDnsCache();
        flushVmDnsCache();
        } else if (flush) {
            try {
                mNetd.flushNetworkDnsCache(netId);
            } catch (Exception e) {
                loge("Exception in flushNetworkDnsCache: " + e);
            }
            flushVmDnsCache();
        }
    }
    }


    private void setDefaultDnsSystemProperties(Collection<InetAddress> dnses) {
    private void setDefaultDnsSystemProperties(Collection<InetAddress> dnses) {
+0 −10
Original line number Original line Diff line number Diff line
@@ -1936,16 +1936,6 @@ public class NetworkManagementService extends INetworkManagementService.Stub
        }
        }
    }
    }


    @Override
    public void flushNetworkDnsCache(int netId) {
        mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
        try {
            mConnector.execute("resolver", "flushnet", netId);
        } catch (NativeDaemonConnectorException e) {
            throw e.rethrowAsParcelableException();
        }
    }

    @Override
    @Override
    public void setFirewallEnabled(boolean enabled) {
    public void setFirewallEnabled(boolean enabled) {
        enforceSystemUid();
        enforceSystemUid();