From: Aloka Dixit Date: Mon, 8 Feb 2021 02:49:17 +0000 (-0800) Subject: SAE: Avoid driver STA entry removal unnecessarily when using H2E/PK X-Git-Tag: hostap_2_10~596 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=598f6713219bfd1fd8d4736c065d5bd3cc76f88c;p=thirdparty%2Fhostap.git 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 Signed-off-by: Pradeep Kumar Chitrapu --- diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c index 595718f42..76a7ffa9e 100644 --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c @@ -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; }