summaryrefslogtreecommitdiffstats
path: root/services/core/java/com/android/server/connectivity/Tethering.java
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2014-08-22 17:10:50 -0700
committerLorenzo Colitti <lorenzo@google.com>2014-08-29 10:21:58 -0700
commitb57edc5ae999abd9c7310833f4f10bbacbc469d7 (patch)
tree03730061a19b829be5d603fb72b47bcc305dc708 /services/core/java/com/android/server/connectivity/Tethering.java
parent551056ec0fd274f4696c2cf1ec9c62298f7f7226 (diff)
downloadframeworks_base-b57edc5ae999abd9c7310833f4f10bbacbc469d7.zip
frameworks_base-b57edc5ae999abd9c7310833f4f10bbacbc469d7.tar.gz
frameworks_base-b57edc5ae999abd9c7310833f4f10bbacbc469d7.tar.bz2
Pass the socket mark for DNS queries to dnsmasq.
This makes tethered clients use the correct DNS servers when tethering to non-default networks like the DUN APN. Bug: 16357676 Change-Id: I8933b6de198a92c2aaf0291931ace8966ddba275
Diffstat (limited to 'services/core/java/com/android/server/connectivity/Tethering.java')
-rw-r--r--services/core/java/com/android/server/connectivity/Tethering.java21
1 files changed, 13 insertions, 8 deletions
diff --git a/services/core/java/com/android/server/connectivity/Tethering.java b/services/core/java/com/android/server/connectivity/Tethering.java
index 1fd114c..7c303ff 100644
--- a/services/core/java/com/android/server/connectivity/Tethering.java
+++ b/services/core/java/com/android/server/connectivity/Tethering.java
@@ -31,6 +31,7 @@ import android.net.INetworkStatsService;
import android.net.InterfaceConfiguration;
import android.net.LinkAddress;
import android.net.LinkProperties;
+import android.net.Network;
import android.net.NetworkInfo;
import android.net.NetworkUtils;
import android.net.RouteInfo;
@@ -56,6 +57,7 @@ import java.io.PrintWriter;
import java.net.InetAddress;
import java.net.Inet4Address;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
@@ -742,7 +744,7 @@ public class Tethering extends BaseNetworkObserver {
static final int CMD_IP_FORWARDING_ENABLE_ERROR = 7;
// notification from the master SM that it had trouble disabling IP Forwarding
static final int CMD_IP_FORWARDING_DISABLE_ERROR = 8;
- // notification from the master SM that it had trouble staring tethering
+ // notification from the master SM that it had trouble starting tethering
static final int CMD_START_TETHERING_ERROR = 9;
// notification from the master SM that it had trouble stopping tethering
static final int CMD_STOP_TETHERING_ERROR = 10;
@@ -1235,12 +1237,6 @@ public class Tethering extends BaseNetworkObserver {
return false;
}
}
- try {
- mNMService.setDnsForwarders(mDefaultDnsServers);
- } catch (Exception e) {
- transitionTo(mSetDnsForwardersErrorState);
- return false;
- }
return true;
}
protected boolean turnOffMasterTetherSettings() {
@@ -1348,8 +1344,17 @@ public class Tethering extends BaseNetworkObserver {
}
}
try {
- mNMService.setDnsForwarders(dnsServers);
+ Network network = getConnectivityManager().getNetworkForType(upType);
+ if (network == null) {
+ Log.e(TAG, "No Network for upstream type " + upType + "!");
+ }
+ if (VDBG) {
+ Log.d(TAG, "Setting DNS forwarders: Network=" + network +
+ ", dnsServers=" + Arrays.toString(dnsServers));
+ }
+ mNMService.setDnsForwarders(network, dnsServers);
} catch (Exception e) {
+ Log.e(TAG, "Setting DNS forwarders failed!");
transitionTo(mSetDnsForwardersErrorState);
}
}