From 1213182012effaaff63c329cd58b26ecc389a9dd Mon Sep 17 00:00:00 2001 From: Marek Kwaczynski Date: Tue, 24 Jun 2025 09:44:10 +0200 Subject: [PATCH] mpskd: fix incorrect MPSK value assignment If MPSK is enabled on any interface, `ssid.mpsk` should be true. Prevents overwriting true with a false value when multiple interfaces share the same SSID. Also allow handling of the 'reload' event even when MPSK is not enabled, to ensure config reloads are not skipped, e.g. when configuration is empty. Fixes: WIFI-14484 Signed-off-by: Marek Kwaczynski --- feeds/ipq807x_v5.4/hostapd/files/mpskd | 10 +++++----- feeds/qca-wifi-7/hostapd/files/mpskd | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/feeds/ipq807x_v5.4/hostapd/files/mpskd b/feeds/ipq807x_v5.4/hostapd/files/mpskd index 5164d7a2f..e76d92781 100644 --- a/feeds/ipq807x_v5.4/hostapd/files/mpskd +++ b/feeds/ipq807x_v5.4/hostapd/files/mpskd @@ -144,7 +144,7 @@ function netifd_reload() { push(ssid.interfaces, iface.ifname); ssid.bands[band] = iface.ifname; - ssid.mpsk = config.multi_psk; + ssid.mpsk = ssid?.mpsk ? true : config.multi_psk; for (let sta in iface.stations) { let stacfg = sta.config; @@ -308,18 +308,18 @@ function sta_auth_cache(ifname, addr, idx, phrase) { function auth_cb(msg) { let data = msg.data; - if (!is_ssid_mpsk(data.iface)) - return; - printf(`Event ${msg.type}: ${msg.data}\n`); switch (msg.type) { case 'sta_auth': + if (!is_ssid_mpsk(data.iface)) + return; + return { psk: sta_auth_psk(data.iface, data.sta), force_psk: true, }; case 'sta_connected': - if (data.psk_idx == null) + if (data.psk_idx == null || !is_ssid_mpsk(data.iface)) return; return sta_auth_cache(data.iface, data.sta, data.psk_idx, data.psk); case 'reload': diff --git a/feeds/qca-wifi-7/hostapd/files/mpskd b/feeds/qca-wifi-7/hostapd/files/mpskd index 2495fceb9..5b888a714 100644 --- a/feeds/qca-wifi-7/hostapd/files/mpskd +++ b/feeds/qca-wifi-7/hostapd/files/mpskd @@ -144,7 +144,7 @@ function netifd_reload() { push(ssid.interfaces, iface.ifname); ssid.bands[band] = iface.ifname; - ssid.mpsk = config.multi_psk; + ssid.mpsk = ssid?.mpsk ? true : config.multi_psk; for (let sta in iface.stations) { let stacfg = sta.config; @@ -308,18 +308,18 @@ function sta_auth_cache(ifname, addr, idx, phrase) { function auth_cb(msg) { let data = msg.data; - if (!is_ssid_mpsk(data.iface)) - return; - printf(`Event ${msg.type}: ${msg.data}\n`); switch (msg.type) { case 'sta_auth': + if (!is_ssid_mpsk(data.iface)) + return; + return { psk: sta_auth_psk(data.iface, data.sta), force_psk: true, }; case 'sta_connected': - if (data.psk_idx == null) + if (data.psk_idx == null || !is_ssid_mpsk(data.iface)) return; return sta_auth_cache(data.iface, data.sta, data.psk_idx, data.psk); case 'reload':