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

Change-Id: If4dc99c558dc45c9a7ff8d3ea5be69578b4ee793
diff --git a/cmds/dumpstate/dumpstate.c b/cmds/dumpstate/dumpstate.c
index 4926db2..52b2d91 100644
--- a/cmds/dumpstate/dumpstate.c
+++ b/cmds/dumpstate/dumpstate.c
@@ -113,8 +113,8 @@
     dump_file("NETWORK ROUTES", "/proc/net/route");
     dump_file("NETWORK ROUTES IPV6", "/proc/net/ipv6_route");
     dump_file("ARP CACHE", "/proc/net/arp");
-    run_command("IPTABLES", 10, "su", "root", "iptables", "-L", NULL);
-    run_command("IPTABLE NAT", 10, "su", "root", "iptables", "-t", "nat", "-L", NULL);
+    run_command("IPTABLES", 10, "su", "root", "iptables", "-L", "-n", NULL);
+    run_command("IPTABLE NAT", 10, "su", "root", "iptables", "-t", "nat", "-L", "-n", NULL);
 
     run_command("WIFI NETWORKS", 20,
             "su", "root", "wpa_cli", "list_networks", NULL);
diff --git a/core/java/android/os/INetworkManagementService.aidl b/core/java/android/os/INetworkManagementService.aidl
index 1174e3b..03a6c07 100644
--- a/core/java/android/os/INetworkManagementService.aidl
+++ b/core/java/android/os/INetworkManagementService.aidl
@@ -252,12 +252,12 @@
     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 0843948..8a21f4f 100644
--- a/services/java/com/android/server/ConnectivityService.java
+++ b/services/java/com/android/server/ConnectivityService.java
@@ -1985,6 +1985,12 @@
             LinkProperties p = nt.getLinkProperties();
             if (p == null) return;
             Collection<InetAddress> dnses = p.getDnses();
+            try {
+                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()) {
                 String network = nt.getNetworkInfo().getTypeName();
diff --git a/services/java/com/android/server/NetworkManagementService.java b/services/java/com/android/server/NetworkManagementService.java
index 17ad268..a16f748 100644
--- a/services/java/com/android/server/NetworkManagementService.java
+++ b/services/java/com/android/server/NetworkManagementService.java
@@ -1375,18 +1375,17 @@
         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);
         }
     }
 
@@ -1412,7 +1411,7 @@
             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);
         }
     }
 }
diff --git a/telephony/java/com/android/internal/telephony/DataCallState.java b/telephony/java/com/android/internal/telephony/DataCallState.java
index a69ce8b..6d8956f 100644
--- a/telephony/java/com/android/internal/telephony/DataCallState.java
+++ b/telephony/java/com/android/internal/telephony/DataCallState.java
@@ -142,13 +142,15 @@
                         } catch (IllegalArgumentException e) {
                             throw new UnknownHostException("Non-numeric ip addr=" + addr);
                         }
-                        if (addrPrefixLen == 0) {
-                            // Assume point to point
-                            addrPrefixLen = (ia instanceof Inet4Address) ? 32 : 128;
+                        if (! ia.isAnyLocalAddress()) {
+                            if (addrPrefixLen == 0) {
+                                // Assume point to point
+                                addrPrefixLen = (ia instanceof Inet4Address) ? 32 : 128;
+                            }
+                            if (DBG) Log.d(LOG_TAG, "addr/pl=" + addr + "/" + addrPrefixLen);
+                            la = new LinkAddress(ia, addrPrefixLen);
+                            linkProperties.addLinkAddress(la);
                         }
-                        if (DBG) Log.d(LOG_TAG, "addr/pl=" + addr + "/" + addrPrefixLen);
-                        la = new LinkAddress(ia, addrPrefixLen);
-                        linkProperties.addLinkAddress(la);
                     }
                 } else {
                     throw new UnknownHostException("no address for ifname=" + ifname);
@@ -163,21 +165,24 @@
                         } catch (IllegalArgumentException e) {
                             throw new UnknownHostException("Non-numeric dns addr=" + addr);
                         }
-                        linkProperties.addDns(ia);
+                        if (! ia.isAnyLocalAddress()) {
+                            linkProperties.addDns(ia);
+                        }
                     }
                 } else if (okToUseSystemPropertyDns){
                     String dnsServers[] = new String[2];
                     dnsServers[0] = SystemProperties.get(propertyPrefix + "dns1");
                     dnsServers[1] = SystemProperties.get(propertyPrefix + "dns2");
                     for (String dnsAddr : dnsServers) {
-                            InetAddress ia;
-                            try {
-                                ia = NetworkUtils.numericToInetAddress(dnsAddr);
-                            } catch (IllegalArgumentException e) {
-                                throw new UnknownHostException("Non-numeric dns addr="
-                                            + dnsAddr);
-                            }
+                        InetAddress ia;
+                        try {
+                            ia = NetworkUtils.numericToInetAddress(dnsAddr);
+                        } catch (IllegalArgumentException e) {
+                            throw new UnknownHostException("Non-numeric dns addr=" + dnsAddr);
+                        }
+                        if (! ia.isAnyLocalAddress()) {
                             linkProperties.addDns(ia);
+                        }
                     }
                 } else {
                     throw new UnknownHostException("Empty dns response and no system default dns");
@@ -199,7 +204,9 @@
                     } catch (IllegalArgumentException e) {
                         throw new UnknownHostException("Non-numeric gateway addr=" + addr);
                     }
-                    linkProperties.addRoute(new RouteInfo(ia));
+                    if (! ia.isAnyLocalAddress()) {
+                        linkProperties.addRoute(new RouteInfo(ia));
+                    }
                 }
 
                 result = SetupResult.SUCCESS;