Pass both IPv4 and IPv6 nameservers to dnsmasq

Additionally, store and return a list of strings for
DNS forwarders, since that's what is most useful. These
strings are guaranteed to be valid IP string literals by
virtue of validation on input.

Bug: 9580643
Change-Id: I4fbaf19835055b12e38d585c0bfba0d2b18b9717
diff --git a/server/TetherController.cpp b/server/TetherController.cpp
index 3b6d0fb..19d9aa6 100644
--- a/server/TetherController.cpp
+++ b/server/TetherController.cpp
@@ -236,9 +236,11 @@
     for (i = 0; i < numServers; i++) {
         ALOGD("setDnsForwarders(0x%x %d = '%s')", fwmark.intValue, i, servers[i]);
 
-        struct in_addr a;
+        struct in_addr v4dns;
+        struct in6_addr v6dns;
 
-        if (!inet_aton(servers[i], &a)) {
+        if (!inet_aton(servers[i], &v4dns) &&
+            (inet_pton(AF_INET6, servers[i], &v6dns) != 1)) {
             ALOGE("Failed to parse DNS server '%s'", servers[i]);
             mDnsForwarders->clear();
             return -1;
@@ -252,7 +254,7 @@
 
         strcat(daemonCmd, SEPARATOR);
         strcat(daemonCmd, servers[i]);
-        mDnsForwarders->push_back(a);
+        mDnsForwarders->push_back(servers[i]);
     }
 
     mDnsNetId = netId;