hostapd: correctly set the sta->psk_id on 6G band

Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin
2025-03-26 07:40:55 +01:00
parent 502727ad6d
commit caee55a61f
2 changed files with 20 additions and 16 deletions

View File

@@ -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)

View File

@@ -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)