Don\'t flush DNS cache on route changes. am: b988890
am: 09a5fbd * commit '09a5fbd6ec86000f95423a47e9266ee124609cb3': Don't flush DNS cache on route changes. Change-Id: I0e019a46548bbc81628939989fad39f96bc83ebe
This commit is contained in:
@@ -4137,8 +4137,8 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
||||
// }
|
||||
updateTcpBufferSizes(networkAgent);
|
||||
|
||||
final boolean flushDns = updateRoutes(newLp, oldLp, netId);
|
||||
updateDnses(newLp, oldLp, netId, flushDns);
|
||||
updateRoutes(newLp, oldLp, netId);
|
||||
updateDnses(newLp, oldLp, netId);
|
||||
|
||||
updateClat(newLp, oldLp, networkAgent);
|
||||
if (isDefaultNetwork(networkAgent)) {
|
||||
@@ -4241,30 +4241,24 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
||||
return !routeDiff.added.isEmpty() || !routeDiff.removed.isEmpty();
|
||||
}
|
||||
|
||||
private void updateDnses(LinkProperties newLp, LinkProperties oldLp, int netId,
|
||||
boolean flush) {
|
||||
if (oldLp == null || (newLp.isIdenticalDnses(oldLp) == false)) {
|
||||
Collection<InetAddress> dnses = newLp.getDnsServers();
|
||||
if (DBG) log("Setting Dns servers for network " + netId + " to " + dnses);
|
||||
try {
|
||||
mNetd.setDnsServersForNetwork(netId, NetworkUtils.makeStrings(dnses),
|
||||
newLp.getDomains());
|
||||
} catch (Exception e) {
|
||||
loge("Exception in setDnsServersForNetwork: " + e);
|
||||
}
|
||||
final NetworkAgentInfo defaultNai = getDefaultNetwork();
|
||||
if (defaultNai != null && defaultNai.network.netId == netId) {
|
||||
setDefaultDnsSystemProperties(dnses);
|
||||
}
|
||||
flushVmDnsCache();
|
||||
} else if (flush) {
|
||||
try {
|
||||
mNetd.flushNetworkDnsCache(netId);
|
||||
} catch (Exception e) {
|
||||
loge("Exception in flushNetworkDnsCache: " + e);
|
||||
}
|
||||
flushVmDnsCache();
|
||||
private void updateDnses(LinkProperties newLp, LinkProperties oldLp, int netId) {
|
||||
if (oldLp != null && newLp.isIdenticalDnses(oldLp)) {
|
||||
return; // no updating necessary
|
||||
}
|
||||
|
||||
Collection<InetAddress> dnses = newLp.getDnsServers();
|
||||
if (DBG) log("Setting Dns servers for network " + netId + " to " + dnses);
|
||||
try {
|
||||
mNetd.setDnsServersForNetwork(
|
||||
netId, NetworkUtils.makeStrings(dnses), newLp.getDomains());
|
||||
} catch (Exception e) {
|
||||
loge("Exception in setDnsServersForNetwork: " + e);
|
||||
}
|
||||
final NetworkAgentInfo defaultNai = getDefaultNetwork();
|
||||
if (defaultNai != null && defaultNai.network.netId == netId) {
|
||||
setDefaultDnsSystemProperties(dnses);
|
||||
}
|
||||
flushVmDnsCache();
|
||||
}
|
||||
|
||||
private void setDefaultDnsSystemProperties(Collection<InetAddress> dnses) {
|
||||
|
||||
Reference in New Issue
Block a user