]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
SAE: Avoid driver STA entry removal unnecessarily when using H2E/PK
authorAloka Dixit <alokad@codeaurora.org>
Mon, 8 Feb 2021 02:49:17 +0000 (18:49 -0800)
committerJouni Malinen <j@w1.fi>
Mon, 8 Feb 2021 21:56:59 +0000 (23:56 +0200)
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>
src/ap/ieee802_11.c

index 595718f42313bb1ccd927b36263763b885d151b8..76a7ffa9ec0bd584b3b92da3c3ab52a38b70c12b 100644 (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;
        }