This patch fixes a number of bugs in the authentication process: 1) When falling back to Shared Key authentication mode from Open System, a missing 'return' would cause the auth request to be sent, but would drop the card into Management Error state. When falling back, the driver should also indicate that it is switching to Shared Key mode by setting exclude_unencrypted.
2) Initial authentication modes were apparently wrong in some cases, causing the driver to attempt Shared Key authentication mode when in fact the access point didn't support that mode or even had WEP disabled. The driver should set the correct initial authentication mode based on wep_is_on and exclude_unencrypted. 3) Authentication response packets from the access point in Open System mode were getting ignored because the driver was expecting the sequence number of a Shared Key mode response. The patch separates the OS and SK mode handling to provide the correct behavior. Signed-off-by: Dan Williams <[EMAIL PROTECTED]> --- a/drivers/net/wireless/atmel.c 2006-02-02 00:58:44.000000000 -0500 +++ b/drivers/net/wireless/atmel.c 2006-02-02 10:47:15.000000000 -0500 @@ -3023,17 +3023,26 @@ } if (status == WLAN_STATUS_SUCCESS && priv->wep_is_on) { + int should_associate = 0; /* WEP */ if (trans_seq_no != priv->ExpectedAuthentTransactionSeqNum) return; - if (trans_seq_no == 0x0002 && - auth->el_id == MFIE_TYPE_CHALLENGE) { - send_authentication_request(priv, system, auth->chall_text, auth->chall_text_len); - return; + if (system == WLAN_AUTH_OPEN) { + if (trans_seq_no == 0x0002) { + should_associate = 1; + } + } else if (system == WLAN_AUTH_SHARED_KEY) { + if (trans_seq_no == 0x0002 && + auth->el_id == MFIE_TYPE_CHALLENGE) { + send_authentication_request(priv, system, auth->chall_text, auth->chall_text_len); + return; + } else if (trans_seq_no == 0x0004) { + should_associate = 1; + } } - if (trans_seq_no == 0x0004) { + if (should_associate) { if(priv->station_was_associated) { atmel_enter_state(priv, STATION_STATE_REASSOCIATING); send_association_request(priv, 1); @@ -3048,9 +3057,11 @@ if (status == WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG) { /* Do opensystem first, then try sharedkey */ - if (system == WLAN_AUTH_OPEN) { + if (system == WLAN_AUTH_OPEN) { priv->CurrentAuthentTransactionSeqNum = 0x001; + priv->exclude_unencrypted = 1; send_authentication_request(priv, WLAN_AUTH_SHARED_KEY, NULL, 0); + return; } else if (priv->connect_to_any_BSS) { int bss_index; @@ -3401,10 +3412,13 @@ priv->AuthenticationRequestRetryCnt = 0; restart_search(priv); } else { + int auth = WLAN_AUTH_OPEN; priv->AuthenticationRequestRetryCnt++; priv->CurrentAuthentTransactionSeqNum = 0x0001; mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); - send_authentication_request(priv, WLAN_AUTH_OPEN, NULL, 0); + if (priv->wep_is_on && priv->exclude_unencrypted) + auth = WLAN_AUTH_SHARED_KEY; + send_authentication_request(priv, auth, NULL, 0); } break; @@ -3503,12 +3517,15 @@ priv->station_was_associated = priv->station_is_associated; atmel_enter_state(priv, STATION_STATE_READY); } else { + int auth = WLAN_AUTH_OPEN; priv->AuthenticationRequestRetryCnt = 0; atmel_enter_state(priv, STATION_STATE_AUTHENTICATING); mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); priv->CurrentAuthentTransactionSeqNum = 0x0001; - send_authentication_request(priv, WLAN_AUTH_SHARED_KEY, NULL, 0); + if (priv->wep_is_on && priv->exclude_unencrypted) + auth = WLAN_AUTH_SHARED_KEY; + send_authentication_request(priv, auth, NULL, 0); } return; } - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html