summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/android/net/dhcp/DhcpClient.java6
-rw-r--r--src/android/net/ip/IpClient.java26
2 files changed, 25 insertions, 7 deletions
diff --git a/src/android/net/dhcp/DhcpClient.java b/src/android/net/dhcp/DhcpClient.java
index 5564503..4404273 100644
--- a/src/android/net/dhcp/DhcpClient.java
+++ b/src/android/net/dhcp/DhcpClient.java
@@ -503,9 +503,9 @@ public class DhcpClient extends StateMachine {
* check whether or not to support caching the last lease info and INIT-REBOOT state.
*
* INIT-REBOOT state is supported on Android R by default if there is no experiment flag set to
- * disable this feature explicitly, meanwhile we still hope to be able to control this feature
- * on/off by pushing experiment flag for A/B testing and metrics collection on both of Android
- * Q and R version, however it's disbled on Android Q by default.
+ * disable this feature explicitly, meanwhile turning this feature on/off by pushing experiment
+ * flag makes it possible to do A/B test and metrics collection on both of Android Q and R, but
+ * it's disabled on Android Q by default.
*/
public boolean isDhcpLeaseCacheEnabled() {
final boolean defaultEnabled =
diff --git a/src/android/net/ip/IpClient.java b/src/android/net/ip/IpClient.java
index 018d6ab..629d216 100644
--- a/src/android/net/ip/IpClient.java
+++ b/src/android/net/ip/IpClient.java
@@ -482,6 +482,7 @@ public class IpClient extends StateMachine {
private boolean mMulticastFiltering;
private long mStartTimeMillis;
private MacAddress mCurrentBssid;
+ private boolean mHasDisabledIPv6OnProvLoss;
/**
* Reading the snapshot is an asynchronous operation initiated by invoking
@@ -1137,9 +1138,9 @@ public class IpClient extends StateMachine {
// Note that we can still be disconnected by IpReachabilityMonitor
// if the IPv6 default gateway (but not the IPv6 DNS servers; see
// accompanying code in IpReachabilityMonitor) is unreachable.
- final boolean ignoreIPv6ProvisioningLoss =
- mConfiguration != null && mConfiguration.mUsingMultinetworkPolicyTracker
- && !mCm.shouldAvoidBadWifi();
+ final boolean ignoreIPv6ProvisioningLoss = mHasDisabledIPv6OnProvLoss
+ || (mConfiguration != null && mConfiguration.mUsingMultinetworkPolicyTracker
+ && !mCm.shouldAvoidBadWifi());
// Additionally:
//
@@ -1163,7 +1164,23 @@ public class IpClient extends StateMachine {
// IPv6 default route then also consider the loss of that default route
// to be a loss of provisioning. See b/27962810.
if (oldLp.hasGlobalIpv6Address() && (lostIPv6Router && !ignoreIPv6ProvisioningLoss)) {
- delta = PROV_CHANGE_LOST_PROVISIONING;
+ // Although link properties have lost IPv6 default route in this case, if IPv4 is still
+ // working with appropriate routes and DNS servers, we can keep the current connection
+ // without disconnecting from the network, just disable IPv6 on that given network until
+ // to the next provisioning. Disabling IPv6 will result in all IPv6 connectivity torn
+ // down and all IPv6 sockets being closed, the non-routable IPv6 DNS servers will be
+ // stripped out, so applications will be able to reconnect immediately over IPv4. See
+ // b/131781810.
+ if (newLp.isIpv4Provisioned()) {
+ mInterfaceCtrl.disableIPv6();
+ mHasDisabledIPv6OnProvLoss = true;
+ delta = PROV_CHANGE_STILL_PROVISIONED;
+ if (DBG) {
+ mLog.log("Disable IPv6 stack completely when the default router has gone");
+ }
+ } else {
+ delta = PROV_CHANGE_LOST_PROVISIONING;
+ }
}
return delta;
@@ -1591,6 +1608,7 @@ public class IpClient extends StateMachine {
@Override
public void enter() {
stopAllIP();
+ mHasDisabledIPv6OnProvLoss = false;
mLinkObserver.clearInterfaceParams();
resetLinkProperties();