Add new states to support wpa_supplicant 0.8

Latest supplicant introduces the INTERFACE_DISABLED state. This
is entered when the interface is brought down (which is effectively
done by us and tracked already through the driver stop operation)

Also, added is a state for tracking authentication when supplicant acts as
the SME

Change-Id: I76090068d0ebba6df76f16707da559fcbd7512c5
This commit is contained in:
Irfan Sheriff
2011-05-27 12:10:55 -07:00
parent 6c2cb3061d
commit 319da8c4c5
4 changed files with 59 additions and 11 deletions

View File

@@ -11596,12 +11596,14 @@ package android.net.wifi {
method public void writeToParcel(android.os.Parcel, int);
enum_constant public static final android.net.wifi.SupplicantState ASSOCIATED;
enum_constant public static final android.net.wifi.SupplicantState ASSOCIATING;
enum_constant public static final android.net.wifi.SupplicantState AUTHENTICATING;
enum_constant public static final android.net.wifi.SupplicantState COMPLETED;
enum_constant public static final android.net.wifi.SupplicantState DISCONNECTED;
enum_constant public static final android.net.wifi.SupplicantState DORMANT;
enum_constant public static final android.net.wifi.SupplicantState FOUR_WAY_HANDSHAKE;
enum_constant public static final android.net.wifi.SupplicantState GROUP_HANDSHAKE;
enum_constant public static final android.net.wifi.SupplicantState INACTIVE;
enum_constant public static final android.net.wifi.SupplicantState INTERFACE_DISABLED;
enum_constant public static final android.net.wifi.SupplicantState INVALID;
enum_constant public static final android.net.wifi.SupplicantState SCANNING;
enum_constant public static final android.net.wifi.SupplicantState UNINITIALIZED;

View File

@@ -38,6 +38,15 @@ public enum SupplicantState implements Parcelable {
*/
DISCONNECTED,
/**
* Interface is disabled
* <p/>
* This state is entered if the network interface is disabled.
* wpa_supplicant refuses any new operations that would
* use the radio until the interface has been enabled.
*/
INTERFACE_DISABLED,
/**
* Inactive state (wpa_supplicant disabled).
* <p/>
@@ -56,6 +65,15 @@ public enum SupplicantState implements Parcelable {
*/
SCANNING,
/**
* Trying to authenticate with a BSS/SSID
* <p/>
* This state is entered when wpa_supplicant has found a suitable BSS
* to authenticate with and the driver is configured to try to
* authenticate with this BSS.
*/
AUTHENTICATING,
/**
* Trying to associate with a BSS/SSID.
* <p/>
@@ -152,8 +170,33 @@ public enum SupplicantState implements Parcelable {
return state != UNINITIALIZED && state != INVALID;
}
/* Supplicant associating or authenticating is considered a handshake state */
static boolean isHandshakeState(SupplicantState state) {
switch(state) {
case AUTHENTICATING:
case ASSOCIATING:
case ASSOCIATED:
case FOUR_WAY_HANDSHAKE:
case GROUP_HANDSHAKE:
return true;
case COMPLETED:
case DISCONNECTED:
case INTERFACE_DISABLED:
case INACTIVE:
case SCANNING:
case DORMANT:
case UNINITIALIZED:
case INVALID:
return false;
default:
throw new IllegalArgumentException("Unknown supplicant state");
}
}
static boolean isConnecting(SupplicantState state) {
switch(state) {
case AUTHENTICATING:
case ASSOCIATING:
case ASSOCIATED:
case FOUR_WAY_HANDSHAKE:
@@ -161,6 +204,7 @@ public enum SupplicantState implements Parcelable {
case COMPLETED:
return true;
case DISCONNECTED:
case INTERFACE_DISABLED:
case INACTIVE:
case SCANNING:
case DORMANT:

View File

@@ -98,12 +98,16 @@ class SupplicantStateTracker extends StateMachine {
if (DBG) Log.d(TAG, "Supplicant state: " + supState.toString() + "\n");
switch (supState) {
case DISCONNECTED:
case DISCONNECTED:
transitionTo(mDisconnectState);
break;
case INTERFACE_DISABLED:
//we should have received a disconnection already, do nothing
break;
case SCANNING:
transitionTo(mScanState);
break;
case AUTHENTICATING:
case ASSOCIATING:
case ASSOCIATED:
case FOUR_WAY_HANDSHAKE:
@@ -250,10 +254,7 @@ class SupplicantStateTracker extends StateMachine {
case WifiStateMachine.SUPPLICANT_STATE_CHANGE_EVENT:
StateChangeResult stateChangeResult = (StateChangeResult) message.obj;
SupplicantState state = stateChangeResult.state;
if (state == SupplicantState.ASSOCIATING ||
state == SupplicantState.ASSOCIATED ||
state == SupplicantState.FOUR_WAY_HANDSHAKE ||
state == SupplicantState.GROUP_HANDSHAKE) {
if (SupplicantState.isHandshakeState(state)) {
if (mLoopDetectIndex > state.ordinal()) {
mLoopDetectCount++;
}
@@ -296,12 +297,11 @@ class SupplicantStateTracker extends StateMachine {
StateChangeResult stateChangeResult = (StateChangeResult) message.obj;
SupplicantState state = stateChangeResult.state;
sendSupplicantStateChangedBroadcast(state, mAuthFailureInSupplicantBroadcast);
/* Ignore a re-auth in completed state */
if (state == SupplicantState.ASSOCIATING ||
state == SupplicantState.ASSOCIATED ||
state == SupplicantState.FOUR_WAY_HANDSHAKE ||
state == SupplicantState.GROUP_HANDSHAKE ||
state == SupplicantState.COMPLETED) {
/* Ignore any connecting state in completed state. Group re-keying
* events and other auth events that do not affect connectivity are
* ignored
*/
if (SupplicantState.isConnecting(state)) {
break;
}
transitionOnSupplicantStateChange(stateChangeResult);

View File

@@ -41,8 +41,10 @@ public class WifiInfo implements Parcelable {
static {
stateMap.put(SupplicantState.DISCONNECTED, DetailedState.DISCONNECTED);
stateMap.put(SupplicantState.INTERFACE_DISABLED, DetailedState.DISCONNECTED);
stateMap.put(SupplicantState.INACTIVE, DetailedState.IDLE);
stateMap.put(SupplicantState.SCANNING, DetailedState.SCANNING);
stateMap.put(SupplicantState.AUTHENTICATING, DetailedState.CONNECTING);
stateMap.put(SupplicantState.ASSOCIATING, DetailedState.CONNECTING);
stateMap.put(SupplicantState.ASSOCIATED, DetailedState.CONNECTING);
stateMap.put(SupplicantState.FOUR_WAY_HANDSHAKE, DetailedState.AUTHENTICATING);