hostapd: fix wifi-7 e-mpsk

Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin
2025-02-03 14:26:00 +01:00
parent 4050db8ed6
commit 3e7fd62fc2
2 changed files with 13 additions and 6 deletions

View File

@@ -96,14 +96,14 @@ function cache_gc() {
for (let addr in keys(ssid_cache)) { for (let addr in keys(ssid_cache)) {
let sta = ssid_cache[addr]; let sta = ssid_cache[addr];
let keep = ts < cache.timeout; let keep = ts < sta.timeout;
if (keep && !ssid.keys[sta.key]) if (keep && !ssid.keys[sta.key])
keep = false; keep = false;
if (keep) if (keep)
sta.keydata = ssid.keys[sta.key]; sta.keydata = ssid.keys[sta.key];
if (!keep) if (!keep)
delete cache[addr]; delete sta[addr];
} }
} }
} }

View File

@@ -754,7 +754,7 @@ as adding/removing interfaces.
if (vlan_id) if (vlan_id)
*vlan_id = 0; *vlan_id = 0;
if (psk_len) if (psk_len)
@@ -387,13 +388,16 @@ static const u8 * hostapd_wpa_auth_get_p @@ -387,13 +388,18 @@ static const u8 * hostapd_wpa_auth_get_p
* returned psk which should not be returned again. * returned psk which should not be returned again.
* logic list (all hostapd_get_psk; all sta->psk) * logic list (all hostapd_get_psk; all sta->psk)
*/ */
@@ -768,16 +768,23 @@ as adding/removing interfaces.
*vlan_id = 0; *vlan_id = 0;
psk = sta->psk->psk; psk = sta->psk->psk;
- for (pos = sta->psk; pos; pos = pos->next) { - for (pos = sta->psk; pos; pos = pos->next) {
+ if (vlan_id)
+ sta->psk_idx = psk_idx;
+ for (pos = sta->psk; pos; pos = pos->next, psk_idx++) { + for (pos = sta->psk; pos; pos = pos->next, psk_idx++) {
if (pos->is_passphrase) { if (pos->is_passphrase) {
if (pbkdf2_sha1(pos->passphrase, if (pbkdf2_sha1(pos->passphrase,
hapd->conf->ssid.ssid, hapd->conf->ssid.ssid,
@@ -410,6 +414,8 @@ static const u8 * hostapd_wpa_auth_get_p @@ -407,9 +413,13 @@ static const u8 * hostapd_wpa_auth_get_p
}
if (pos->psk == prev_psk) {
psk = pos->next ? pos->next->psk : NULL;
+ if (vlan_id)
+ sta->psk_idx = psk_idx + 1;
break; break;
} }
} }
+ if (psk) + if (vlan_id && !psk)
+ sta->psk_idx = psk_idx; + sta->psk_idx = 0;
} }
return psk; return psk;
} }