From 3e7fd62fc26623a753681d9709a2f1ed0aab7e1d Mon Sep 17 00:00:00 2001 From: John Crispin Date: Mon, 3 Feb 2025 14:26:00 +0100 Subject: [PATCH] hostapd: fix wifi-7 e-mpsk Signed-off-by: John Crispin --- feeds/qca/hostapd/files/mpskd | 4 ++-- feeds/qca/hostapd/patches/601-ucode_support.patch | 15 +++++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/feeds/qca/hostapd/files/mpskd b/feeds/qca/hostapd/files/mpskd index 1700b590d..d03e4a4b1 100644 --- a/feeds/qca/hostapd/files/mpskd +++ b/feeds/qca/hostapd/files/mpskd @@ -96,14 +96,14 @@ function cache_gc() { for (let addr in keys(ssid_cache)) { let sta = ssid_cache[addr]; - let keep = ts < cache.timeout; + let keep = ts < sta.timeout; if (keep && !ssid.keys[sta.key]) keep = false; if (keep) sta.keydata = ssid.keys[sta.key]; if (!keep) - delete cache[addr]; + delete sta[addr]; } } } diff --git a/feeds/qca/hostapd/patches/601-ucode_support.patch b/feeds/qca/hostapd/patches/601-ucode_support.patch index 8277f4003..681f82d70 100644 --- a/feeds/qca/hostapd/patches/601-ucode_support.patch +++ b/feeds/qca/hostapd/patches/601-ucode_support.patch @@ -754,7 +754,7 @@ as adding/removing interfaces. if (vlan_id) *vlan_id = 0; 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. * logic list (all hostapd_get_psk; all sta->psk) */ @@ -768,16 +768,23 @@ as adding/removing interfaces. *vlan_id = 0; psk = sta->psk->psk; - 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++) { if (pos->is_passphrase) { if (pbkdf2_sha1(pos->passphrase, 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; } } -+ if (psk) -+ sta->psk_idx = psk_idx; ++ if (vlan_id && !psk) ++ sta->psk_idx = 0; } return psk; }