From caee55a61f80f34ac603e0ad314e3f2f16fdfd03 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Wed, 26 Mar 2025 07:40:55 +0100 Subject: [PATCH] hostapd: correctly set the sta->psk_id on 6G band Signed-off-by: John Crispin --- .../hostapd/patches/601-ucode_support.patch | 18 ++++++++++-------- .../hostapd/patches/601-ucode_support.patch | 18 ++++++++++-------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/feeds/ipq807x_v5.4/hostapd/patches/601-ucode_support.patch b/feeds/ipq807x_v5.4/hostapd/patches/601-ucode_support.patch index 0f6f195fe..94400966a 100644 --- a/feeds/ipq807x_v5.4/hostapd/patches/601-ucode_support.patch +++ b/feeds/ipq807x_v5.4/hostapd/patches/601-ucode_support.patch @@ -606,12 +606,13 @@ for (pw = hapd->conf->sae_passwords; pw; pw = pw->next) { if (!is_broadcast_ether_addr(pw->peer_addr) && os_memcmp(pw->peer_addr, sta->addr, ETH_ALEN) != 0) -@@ -519,6 +525,31 @@ static const char * sae_get_password(str +@@ -519,6 +525,33 @@ static const char * sae_get_password(str pt = hapd->conf->ssid.pt; } +use_sta_psk: + if (!password && sta) { ++ sta->psk_idx = 0; + for (psk = sta->psk; psk; psk = psk->next) { + if (!psk->is_passphrase) + continue; @@ -620,6 +621,7 @@ + if (!sta->use_sta_psk) + break; + ++ sta->psk_idx = 1; + if (sta->sae_pt) { + pt = sta->sae_pt; + break; @@ -638,7 +640,7 @@ if (pw_entry) *pw_entry = pw; if (s_pt) -@@ -3698,6 +3729,12 @@ static void handle_auth(struct hostapd_d +@@ -3698,6 +3731,12 @@ static void handle_auth(struct hostapd_d goto fail; } @@ -686,14 +688,14 @@ char *radius_cui; /* Chargeable-User-Identity from RADIUS */ --- a/src/ap/wpa_auth_glue.c +++ b/src/ap/wpa_auth_glue.c -@@ -337,6 +337,7 @@ static const u8 * hostapd_wpa_auth_get_p - struct sta_info *sta = ap_get_sta(hapd, addr); - const u8 *psk; +@@ -355,6 +355,7 @@ static const u8 * hostapd_wpa_auth_get_p + } + #endif /* CONFIG_SAE */ + sta->psk_idx = 0; - if (vlan_id) - *vlan_id = 0; - if (psk_len) + #ifdef CONFIG_OWE + if ((hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_OWE) && + sta && sta->owe_pmk) { @@ -381,12 +382,17 @@ static const u8 * hostapd_wpa_auth_get_p * returned psk which should not be returned again. * logic list (all hostapd_get_psk; all sta->psk) diff --git a/feeds/qca-wifi-7/hostapd/patches/601-ucode_support.patch b/feeds/qca-wifi-7/hostapd/patches/601-ucode_support.patch index 681f82d70..848803972 100644 --- a/feeds/qca-wifi-7/hostapd/patches/601-ucode_support.patch +++ b/feeds/qca-wifi-7/hostapd/patches/601-ucode_support.patch @@ -665,12 +665,13 @@ as adding/removing interfaces. for (pw = hapd->conf->sae_passwords; pw; pw = pw->next) { if (!is_broadcast_ether_addr(pw->peer_addr) && os_memcmp(pw->peer_addr, sta->addr, ETH_ALEN) != 0) -@@ -573,12 +578,28 @@ static const char * sae_get_password(str +@@ -573,12 +578,30 @@ static const char * sae_get_password(str pt = hapd->conf->ssid.pt; } +use_sta_psk: if (!password) { ++ sta->psk_idx = 0; for (psk = sta->psk; psk; psk = psk->next) { - if (psk->is_passphrase) { - password = psk->passphrase; @@ -680,6 +681,7 @@ as adding/removing interfaces. + if (!sta->use_sta_psk) + break; +#ifdef CONFIG_SAE ++ sta->psk_idx = 1; + if (sta->sae_pt) { + pt = sta->sae_pt; break; @@ -696,7 +698,7 @@ as adding/removing interfaces. } } -@@ -3097,6 +3118,12 @@ static void handle_auth(struct hostapd_d +@@ -3097,6 +3120,12 @@ static void handle_auth(struct hostapd_d goto fail; } @@ -746,14 +748,14 @@ as adding/removing interfaces. char *radius_cui; /* Chargeable-User-Identity from RADIUS */ --- a/src/ap/wpa_auth_glue.c +++ b/src/ap/wpa_auth_glue.c -@@ -341,6 +341,7 @@ static const u8 * hostapd_wpa_auth_get_p - struct sta_info *sta = ap_get_sta(hapd, addr); - const u8 *psk; +@@ -361,6 +361,7 @@ static const u8 * hostapd_wpa_auth_get_p + } + #endif /* CONFIG_SAE */ + sta->psk_idx = 0; - if (vlan_id) - *vlan_id = 0; - if (psk_len) + #ifdef CONFIG_OWE + if ((hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_OWE) && + sta && sta->owe_pmk) { @@ -387,13 +388,18 @@ static const u8 * hostapd_wpa_auth_get_p * returned psk which should not be returned again. * logic list (all hostapd_get_psk; all sta->psk)