summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Kline <ek@google.com>2015-01-07 16:51:01 +0900
committerErik Kline <ek@google.com>2015-01-07 17:47:53 +0900
commitac9667902d52ef3efdb53125080419fbbdc7ba80 (patch)
treeb25d18f34f2f6f8218e64ae53eb41de302b19f60
parent104a9803187593ab25d3784b420077022686dbe4 (diff)
downloadwifi-ac9667902d52ef3efdb53125080419fbbdc7ba80.tar.gz
Disconnect if we had IPv4 and lost it.
More specifically, the DHCP_FAILURE case is entered when a DHCPv4 RENEW fails. Even though we would connect to a network with no IPv4, when roaming to a "same network" and losing IPv4 it's probably better to disconnect and start afresh. Bug: 18867306 Change-Id: Ie667b4f0481ae0510d0dc00db819f4e5d43d98a9
-rw-r--r--service/java/com/android/server/wifi/WifiStateMachine.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java
index c22e9edb0..78f37ad78 100644
--- a/service/java/com/android/server/wifi/WifiStateMachine.java
+++ b/service/java/com/android/server/wifi/WifiStateMachine.java
@@ -3966,6 +3966,8 @@ public class WifiStateMachine extends StateMachine {
final boolean linkChanged = !newLp.equals(mLinkProperties);
final boolean wasProvisioned = isProvisioned(mLinkProperties);
final boolean isProvisioned = isProvisioned(newLp);
+ final boolean lostIPv4Provisioning =
+ mLinkProperties.hasIPv4Address() && !newLp.hasIPv4Address();
final DetailedState detailedState = getNetworkDetailedState();
if (linkChanged) {
@@ -4033,9 +4035,10 @@ public class WifiStateMachine extends StateMachine {
break;
case DhcpStateMachine.DHCP_FAILURE:
- // DHCP failed. If we're not already provisioned, give up and disconnect.
+ // DHCP failed. If we're not already provisioned, or we had IPv4 and now lost it,
+ // give up and disconnect.
// If we're already provisioned (e.g., IPv6-only network), stay connected.
- if (!isProvisioned) {
+ if (!isProvisioned || lostIPv4Provisioning) {
sendMessage(CMD_IP_CONFIGURATION_LOST);
} else {
// DHCP failed, but we're provisioned (e.g., if we're on an IPv6-only network).