summaryrefslogtreecommitdiffstats
path: root/services/java/com/android/server/ConnectivityService.java
diff options
context:
space:
mode:
Diffstat (limited to 'services/java/com/android/server/ConnectivityService.java')
-rw-r--r--services/java/com/android/server/ConnectivityService.java17
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 a6ddcab..f735c4c 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. */