nl80211: Hide deauth event due to forced deauth-during-auth

If NL80211_CMD_AUTHENTICATE fails due to exiting authentication, forced
deauthentication is used to clear cfg80211 start and a new
authentication command is retried. This resulted in an extra
disconnection event getting delivered to the core wpa_supplicant code
and that could end up confusing state there, e.g., by clearing
connection parameters like wpa_s->key_mgmt and preventing the following
association from reaching proper COMPLETED state with open networks.

Fix this by hiding the unnecessary disconnection event when using the
deauth-for-auth workaround.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2014-03-11 20:02:23 +02:00 committed by Jouni Malinen
parent 0f44ec8eba
commit e8d70a739b

View file

@ -302,6 +302,7 @@ struct wpa_driver_nl80211_data {
unsigned int start_mode_ap:1; unsigned int start_mode_ap:1;
unsigned int start_iface_up:1; unsigned int start_iface_up:1;
unsigned int test_use_roc_tx:1; unsigned int test_use_roc_tx:1;
unsigned int ignore_deauth_event:1;
u64 remain_on_chan_cookie; u64 remain_on_chan_cookie;
u64 send_action_cookie; u64 send_action_cookie;
@ -1827,6 +1828,11 @@ static void mlme_event_deauth_disassoc(struct wpa_driver_nl80211_data *drv,
mgmt->u.disassoc.variable; mgmt->u.disassoc.variable;
} }
} else { } else {
if (drv->ignore_deauth_event) {
wpa_printf(MSG_DEBUG, "nl80211: Ignore deauth event due to previous forced deauth-during-auth");
drv->ignore_deauth_event = 0;
return;
}
event.deauth_info.locally_generated = event.deauth_info.locally_generated =
!os_memcmp(mgmt->sa, drv->first_bss->addr, ETH_ALEN); !os_memcmp(mgmt->sa, drv->first_bss->addr, ETH_ALEN);
event.deauth_info.addr = bssid; event.deauth_info.addr = bssid;
@ -5926,6 +5932,7 @@ static int wpa_driver_nl80211_authenticate(
is_retry = drv->retry_auth; is_retry = drv->retry_auth;
drv->retry_auth = 0; drv->retry_auth = 0;
drv->ignore_deauth_event = 0;
nl80211_mark_disconnected(drv); nl80211_mark_disconnected(drv);
os_memset(drv->auth_bssid, 0, ETH_ALEN); os_memset(drv->auth_bssid, 0, ETH_ALEN);
@ -6027,6 +6034,7 @@ retry:
*/ */
wpa_printf(MSG_DEBUG, "nl80211: Retry authentication " wpa_printf(MSG_DEBUG, "nl80211: Retry authentication "
"after forced deauthentication"); "after forced deauthentication");
drv->ignore_deauth_event = 1;
wpa_driver_nl80211_deauthenticate( wpa_driver_nl80211_deauthenticate(
bss, params->bssid, bss, params->bssid,
WLAN_REASON_PREV_AUTH_NOT_VALID); WLAN_REASON_PREV_AUTH_NOT_VALID);