diff options
| author | Lorenzo Colitti <lorenzo@google.com> | 2013-03-15 04:22:37 +0900 |
|---|---|---|
| committer | Lorenzo Colitti <lorenzo@google.com> | 2013-03-15 14:41:55 +0900 |
| commit | 13c9fdefdec907aaa339ffd67c0ded116cccba01 (patch) | |
| tree | 2e89b0c6576b0629db92d7ff1c0653b56e06ebe4 /services/java/com/android/server/ConnectivityService.java | |
| parent | f83d90c6671371c9fb95c7946461795efe5a1da3 (diff) | |
Framework changes for 464xlat.
1. Add a Nat464Xlat service that ConnectivityService can use
to start and stop clat. When clat is started, the service
waits for the clat interface to come up and then calls
ConnectivityService to add the appropriate routes.
2. Make ConnectivityService start clat when an IPv6-only mobile
interface is connected. We only support clat on mobile for
now.
3. Make tethering use the interface that has the IPv4 default
route insted of using the base interface of the
LinkProperties. This allows us to tether to a stacked
interface, which is needed for tethering with 464xlat.
Bug: 8276725
Change-Id: I24480af69ee280f504399062638af0836a56268e
Diffstat (limited to 'services/java/com/android/server/ConnectivityService.java')
| -rw-r--r-- | services/java/com/android/server/ConnectivityService.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java index a6ddcab670ef..f735c4ce79f2 100644 --- a/services/java/com/android/server/ConnectivityService.java +++ b/services/java/com/android/server/ConnectivityService.java @@ -96,6 +96,7 @@ import com.android.internal.telephony.Phone; import com.android.internal.telephony.PhoneConstants; import com.android.internal.util.IndentingPrintWriter; import com.android.server.am.BatteryStatsService; +import com.android.server.connectivity.Nat464Xlat; import com.android.server.connectivity.Tethering; import com.android.server.connectivity.Vpn; import com.android.server.net.BaseNetworkObserver; @@ -154,6 +155,8 @@ public class ConnectivityService extends IConnectivityManager.Stub { private boolean mLockdownEnabled; private LockdownVpnTracker mLockdownTracker; + private Nat464Xlat mClat; + /** Lock around {@link #mUidRules} and {@link #mMeteredIfaces}. */ private Object mRulesLock = new Object(); /** Currently active network rules by UID. */ @@ -544,9 +547,12 @@ public class ConnectivityService extends IConnectivityManager.Stub { mVpn = new Vpn(mContext, mVpnCallback, mNetd); mVpn.startMonitoring(mContext, mTrackerHandler); + mClat = new Nat464Xlat(mContext, mNetd, this, mTrackerHandler); + try { mNetd.registerObserver(mTethering); mNetd.registerObserver(mDataActivityObserver); + mNetd.registerObserver(mClat); } catch (RemoteException e) { loge("Error registering observer :" + e); } @@ -2276,6 +2282,17 @@ public class ConnectivityService extends IConnectivityManager.Stub { } } + // Update 464xlat state. + // TODO: Move to handleConnect() + NetworkStateTracker tracker = mNetTrackers[netType]; + if (mClat.requiresClat(netType, tracker)) { + if (mNetTrackers[netType].getNetworkInfo().isConnected()) { + mClat.startClat(tracker); + } else { + mClat.stopClat(); + } + } + // TODO: Temporary notifying upstread change to Tethering. // @see bug/4455071 /** Notify TetheringService if interface name has been changed. */ |
