resolved conflicts for merge of 41394a36 to honeycomb-plus-aosp

Change-Id: Ic839eb7bd8081b94802dbbf9140b9d1fa0cf7df3
This commit is contained in:
Robert Greenwalt
2011-07-27 09:27:00 -07:00
3 changed files with 15 additions and 15 deletions

View File

@@ -235,12 +235,12 @@ interface INetworkManagementService
void setDnsServersForInterface(String iface, in String[] servers); void setDnsServersForInterface(String iface, in String[] servers);
/** /**
* Flush the DNS cache associated with the default interface * Flush the DNS cache associated with the default interface.
*/ */
void flushDefaultDnsCache(); void flushDefaultDnsCache();
/** /**
* Flush the DNS cache associated with the specified interface * Flush the DNS cache associated with the specified interface.
*/ */
void flushInterfaceDnsCache(String iface); void flushInterfaceDnsCache(String iface);
} }

View File

@@ -1785,13 +1785,18 @@ public class ConnectivityService extends IConnectivityManager.Stub {
if (p == null) return; if (p == null) return;
Collection<InetAddress> dnses = p.getDnses(); Collection<InetAddress> dnses = p.getDnses();
try { try {
mNetd.setDnsServersForInterface(Integer.toString(netType), mNetd.setDnsServersForInterface(p.getInterfaceName(),
NetworkUtils.makeStrings(dnses)); NetworkUtils.makeStrings(dnses));
} catch (Exception e) { } catch (Exception e) {
Slog.e(TAG, "exception setting dns servers: " + e); Slog.e(TAG, "exception setting dns servers: " + e);
} }
boolean changed = false; boolean changed = false;
if (mNetConfigs[netType].isDefault()) { if (mNetConfigs[netType].isDefault()) {
try {
mNetd.setDefaultInterfaceForDns(p.getInterfaceName());
} catch (Exception e) {
Slog.e(TAG, "exception setting default dns interface: " + e);
}
int j = 1; int j = 1;
if (dnses.size() == 0 && mDefaultDns != null) { if (dnses.size() == 0 && mDefaultDns != null) {
String dnsString = mDefaultDns.getHostAddress(); String dnsString = mDefaultDns.getHostAddress();
@@ -1818,10 +1823,6 @@ public class ConnectivityService extends IConnectivityManager.Stub {
SystemProperties.set("net.dns" + j++, dnsString); SystemProperties.set("net.dns" + j++, dnsString);
} }
} }
try {
mNetd.setDefaultInterfaceForDns(Integer.toString(netType));
} catch (Exception e) {
Slog.e(TAG, "exception setting default dns interface: " + e);}
for (int k=j ; k<mNumDnsEntries; k++) { for (int k=j ; k<mNumDnsEntries; k++) {
if (changed || !TextUtils.isEmpty(SystemProperties.get("net.dns" + k))) { if (changed || !TextUtils.isEmpty(SystemProperties.get("net.dns" + k))) {
if (DBG) log("erasing net.dns" + k); if (DBG) log("erasing net.dns" + k);

View File

@@ -970,18 +970,17 @@ class NetworkManagementService extends INetworkManagementService.Stub {
try { try {
String cmd = "resolver setifdns " + iface; String cmd = "resolver setifdns " + iface;
for (String s : servers) { for (String s : servers) {
if (s != null && !"0.0.0.0".equals(s) && InetAddress a = NetworkUtils.numericToInetAddress(s);
!"::".equals(s) && !"0:0:0:0:0:0:0:0".equals(s)) { if (a.isAnyLocalAddress() == false) {
cmd += " " + InetAddress.getByName(s).getHostAddress(); cmd += " " + a.getHostAddress();
} }
} }
mConnector.doCommand(cmd); mConnector.doCommand(cmd);
} catch (UnknownHostException e) { } catch (IllegalArgumentException e) {
throw new IllegalStateException("failed to resolve dns address.", e); throw new IllegalStateException("Error setting dnsn for interface", e);
} catch (NativeDaemonConnectorException e) { } catch (NativeDaemonConnectorException e) {
throw new IllegalStateException( throw new IllegalStateException(
"Error communicating with native deamon to set dns for interface", e); "Error communicating with native daemon to set dns for interface", e);
} }
} }
@@ -1007,7 +1006,7 @@ class NetworkManagementService extends INetworkManagementService.Stub {
mConnector.doCommand(cmd); mConnector.doCommand(cmd);
} catch (NativeDaemonConnectorException e) { } catch (NativeDaemonConnectorException e) {
throw new IllegalStateException( throw new IllegalStateException(
"Error communicating with native deamon to flush interface " + iface, e); "Error communicating with native daemon to flush interface " + iface, e);
} }
} }
} }