diff options
| author | 2011-07-27 09:27:00 -0700 | |
|---|---|---|
| committer | 2011-07-27 09:27:00 -0700 | |
| commit | af75fdb16566c3011284afaa7d12bcf6126dd4f3 (patch) | |
| tree | cb2545e1c51caf9314b4e092484a75e6db60142f | |
| parent | fada80df08dd0b608eeb9737af413f8df1eb5252 (diff) | |
| parent | 41394a361020e9f58524f23d6831bb8e63063856 (diff) | |
resolved conflicts for merge of 41394a36 to honeycomb-plus-aosp
Change-Id: Ic839eb7bd8081b94802dbbf9140b9d1fa0cf7df3
3 files changed, 15 insertions, 15 deletions
diff --git a/core/java/android/os/INetworkManagementService.aidl b/core/java/android/os/INetworkManagementService.aidl index 3f02a6794315..1b51f346084b 100644 --- a/core/java/android/os/INetworkManagementService.aidl +++ b/core/java/android/os/INetworkManagementService.aidl @@ -235,12 +235,12 @@ interface INetworkManagementService 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(); /** - * Flush the DNS cache associated with the specified interface + * Flush the DNS cache associated with the specified interface. */ void flushInterfaceDnsCache(String iface); } diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java index 335d3fef1161..2f6bbeccbad3 100644 --- a/services/java/com/android/server/ConnectivityService.java +++ b/services/java/com/android/server/ConnectivityService.java @@ -1785,13 +1785,18 @@ public class ConnectivityService extends IConnectivityManager.Stub { if (p == null) return; Collection<InetAddress> dnses = p.getDnses(); try { - mNetd.setDnsServersForInterface(Integer.toString(netType), + mNetd.setDnsServersForInterface(p.getInterfaceName(), NetworkUtils.makeStrings(dnses)); } catch (Exception e) { Slog.e(TAG, "exception setting dns servers: " + e); } boolean changed = false; if (mNetConfigs[netType].isDefault()) { + try { + mNetd.setDefaultInterfaceForDns(p.getInterfaceName()); + } catch (Exception e) { + Slog.e(TAG, "exception setting default dns interface: " + e); + } int j = 1; if (dnses.size() == 0 && mDefaultDns != null) { String dnsString = mDefaultDns.getHostAddress(); @@ -1818,10 +1823,6 @@ public class ConnectivityService extends IConnectivityManager.Stub { 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++) { if (changed || !TextUtils.isEmpty(SystemProperties.get("net.dns" + k))) { if (DBG) log("erasing net.dns" + k); diff --git a/services/java/com/android/server/NetworkManagementService.java b/services/java/com/android/server/NetworkManagementService.java index b34906fbda23..1c4f7807f797 100644 --- a/services/java/com/android/server/NetworkManagementService.java +++ b/services/java/com/android/server/NetworkManagementService.java @@ -970,18 +970,17 @@ class NetworkManagementService extends INetworkManagementService.Stub { try { String cmd = "resolver setifdns " + iface; for (String s : servers) { - if (s != null && !"0.0.0.0".equals(s) && - !"::".equals(s) && !"0:0:0:0:0:0:0:0".equals(s)) { - cmd += " " + InetAddress.getByName(s).getHostAddress(); + InetAddress a = NetworkUtils.numericToInetAddress(s); + if (a.isAnyLocalAddress() == false) { + cmd += " " + a.getHostAddress(); } } - mConnector.doCommand(cmd); - } catch (UnknownHostException e) { - throw new IllegalStateException("failed to resolve dns address.", e); + } catch (IllegalArgumentException e) { + throw new IllegalStateException("Error setting dnsn for interface", e); } catch (NativeDaemonConnectorException e) { 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); } catch (NativeDaemonConnectorException e) { throw new IllegalStateException( - "Error communicating with native deamon to flush interface " + iface, e); + "Error communicating with native daemon to flush interface " + iface, e); } } } |