SAE: Avoid driver STA entry removal unnecessarily when using H2E/PK

The new status code values for SAE H2E and PK resulted in the
sta->added_unassoc cases incorrectly removing the STA entry after
successful SAE commit messages. Fix this by using sae_status_success()
instead of direct check for WLAN_STATUS_SUCCESS when processing SAE
commit messages before removing station entry.

Signed-off-by: Aloka Dixit <alokad@codeaurora.org>
Signed-off-by: Pradeep Kumar Chitrapu <pradeepc@codeaurora.org>
This commit is contained in:
Aloka Dixit 2021-02-07 18:49:17 -08:00 committed by Jouni Malinen
parent 99cd453720
commit 598f671321

View file

@ -1277,6 +1277,7 @@ static void handle_auth_sae(struct hostapd_data *hapd, struct sta_info *sta,
int default_groups[] = { 19, 0 };
const u8 *pos, *end;
int sta_removed = 0;
bool success_status;
if (!groups)
groups = default_groups;
@ -1562,9 +1563,12 @@ reply:
}
remove_sta:
if (auth_transaction == 1)
success_status = sae_status_success(hapd, status_code);
else
success_status = status_code == WLAN_STATUS_SUCCESS;
if (!sta_removed && sta->added_unassoc &&
(resp != WLAN_STATUS_SUCCESS ||
status_code != WLAN_STATUS_SUCCESS)) {
(resp != WLAN_STATUS_SUCCESS || !success_status)) {
hostapd_drv_sta_remove(hapd, sta->addr);
sta->added_unassoc = 0;
}
@ -6188,6 +6192,7 @@ static void handle_auth_cb(struct hostapd_data *hapd,
{
u16 auth_alg, auth_transaction, status_code;
struct sta_info *sta;
bool success_status;
sta = ap_get_sta(hapd, mgmt->da);
if (!sta) {
@ -6226,7 +6231,12 @@ static void handle_auth_cb(struct hostapd_data *hapd,
}
fail:
if (status_code != WLAN_STATUS_SUCCESS && sta->added_unassoc) {
success_status = status_code == WLAN_STATUS_SUCCESS;
#ifdef CONFIG_SAE
if (auth_alg == WLAN_AUTH_SAE && auth_transaction == 1)
success_status = sae_status_success(hapd, status_code);
#endif /* CONFIG_SAE */
if (!success_status && sta->added_unassoc) {
hostapd_drv_sta_remove(hapd, sta->addr);
sta->added_unassoc = 0;
}