summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Greenwalt <robdroid@android.com>2010-03-25 14:50:34 -0700
committerRobert Greenwalt <robdroid@android.com>2010-03-25 15:29:57 -0700
commitb37f0c6513241f79a6ea0e3c162dc540d028b60c (patch)
tree1364914cdc98719d498f50c70a98be952a0a7e0b
parentbfb7bfa53847832db2a3eb05e5eff7cb974c3c7a (diff)
downloadframeworks_base-b37f0c6513241f79a6ea0e3c162dc540d028b60c.zip
frameworks_base-b37f0c6513241f79a6ea0e3c162dc540d028b60c.tar.gz
frameworks_base-b37f0c6513241f79a6ea0e3c162dc540d028b60c.tar.bz2
Fix Tethering of multiple downstream ifaces.
We weren't notifying the second tethered iface of it's upstream iface name so its traffic was not getting routed correctly. We also weren't clearing out our connected iface name when we untethered, so the route rules weren't getting flushed when the last tether came down. Change-Id: I34e5d672ea882c89c8f582d69d6dc421cb52d4b4
-rw-r--r--services/java/com/android/server/connectivity/Tethering.java15
1 files changed, 11 insertions, 4 deletions
diff --git a/services/java/com/android/server/connectivity/Tethering.java b/services/java/com/android/server/connectivity/Tethering.java
index b54de0a..f335287 100644
--- a/services/java/com/android/server/connectivity/Tethering.java
+++ b/services/java/com/android/server/connectivity/Tethering.java
@@ -847,6 +847,7 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
if (mMyUpstreamIfaceName != null) {
try {
service.disableNat(mIfaceName, mMyUpstreamIfaceName);
+ mMyUpstreamIfaceName = null;
} catch (Exception e) {
try {
service.untetherInterface(mIfaceName);
@@ -887,6 +888,7 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
if (mMyUpstreamIfaceName != null) {
try {
service.disableNat(mIfaceName, mMyUpstreamIfaceName);
+ mMyUpstreamIfaceName = null;
} catch (Exception e) {
try {
service.untetherInterface(mIfaceName);
@@ -926,6 +928,7 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
if (mMyUpstreamIfaceName != null) {
try {
service.disableNat(mIfaceName, mMyUpstreamIfaceName);
+ mMyUpstreamIfaceName = null;
} catch (Exception e) {
try {
service.untetherInterface(mIfaceName);
@@ -1026,6 +1029,8 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
private boolean mConnectionRequested = false;
+ private String mUpstreamIfaceName = null;
+
private static final int UPSTREAM_SETTLE_TIME_MS = 10000;
private static final int CELL_CONNECTION_RENEW_MS = 40000;
@@ -1228,10 +1233,11 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
// wait for things to settle and retry
sendMessageDelayed(CMD_RETRY_UPSTREAM, UPSTREAM_SETTLE_TIME_MS);
}
- notifyTetheredOfNewIface(iface);
+ notifyTetheredOfNewUpstreamIface(iface);
}
- protected void notifyTetheredOfNewIface(String ifaceName) {
+ protected void notifyTetheredOfNewUpstreamIface(String ifaceName) {
Log.d(TAG, "notifying tethered with iface =" + ifaceName);
+ mUpstreamIfaceName = ifaceName;
for (Object o : mNotifyList) {
TetherInterfaceSM sm = (TetherInterfaceSM)o;
sm.sendMessage(TetherInterfaceSM.CMD_TETHER_CONNECTION_CHANGED,
@@ -1284,7 +1290,7 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
@Override
public void exit() {
turnOffMobileConnection();
- notifyTetheredOfNewIface(null);
+ notifyTetheredOfNewUpstreamIface(null);
}
@Override
public boolean processMessage(Message message) {
@@ -1294,7 +1300,8 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
case CMD_TETHER_MODE_REQUESTED:
TetherInterfaceSM who = (TetherInterfaceSM)message.obj;
mNotifyList.add(who);
- who.sendMessage(TetherInterfaceSM.CMD_TETHER_CONNECTION_CHANGED);
+ who.sendMessage(TetherInterfaceSM.CMD_TETHER_CONNECTION_CHANGED,
+ mUpstreamIfaceName);
break;
case CMD_TETHER_MODE_UNREQUESTED:
who = (TetherInterfaceSM)message.obj;