immortalwrt/package/network/services/hostapd/patches/803-hostapd-fix-80211be-build.patch
Felix Fietkau cb4d2b3fb2 hostapd: fix sta psk index for dynamic psk auth
Depending on the config / circumstances, the get_psk call can be called
multiple times from differnt places, which can lead to wrong sta->psk_idx
values. The correct call is the one that is also interested in the vlan_id,
so use the vlan_id pointer as indication of when to set sta->psk_idx.
Also fix off-by-one error for secondary PSKs

Fixes: b2a2c286170d ("hostapd: add support for authenticating with multiple PSKs via ubus helper")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
(cherry picked from commit 8118b2dace06de839e1e23f018059995f4af5e11)
2025-02-12 12:00:19 +01:00

54 lines
1.3 KiB
Diff

--- a/src/ap/sta_info.c
+++ b/src/ap/sta_info.c
@@ -1914,3 +1914,22 @@ void ap_sta_free_sta_profile(struct mld_
}
}
#endif /* CONFIG_IEEE80211BE */
+
+bool ap_sta_is_mld(struct hostapd_data *hapd,
+ struct sta_info *sta)
+{
+#ifdef CONFIG_IEEE80211BE
+ return hapd->conf->mld_ap && sta && sta->mld_info.mld_sta;
+#else /* CONFIG_IEEE80211BE */
+ return false;
+#endif /* CONFIG_IEEE80211BE */
+}
+
+void ap_sta_set_mld(struct sta_info *sta, bool mld)
+{
+#ifdef CONFIG_IEEE80211BE
+ if (sta)
+ sta->mld_info.mld_sta = mld;
+#endif /* CONFIG_IEEE80211BE */
+}
+
--- a/src/ap/sta_info.h
+++ b/src/ap/sta_info.h
@@ -408,23 +408,8 @@ int ap_sta_re_add(struct hostapd_data *h
void ap_free_sta_pasn(struct hostapd_data *hapd, struct sta_info *sta);
-static inline bool ap_sta_is_mld(struct hostapd_data *hapd,
- struct sta_info *sta)
-{
-#ifdef CONFIG_IEEE80211BE
- return hapd->conf->mld_ap && sta && sta->mld_info.mld_sta;
-#else /* CONFIG_IEEE80211BE */
- return false;
-#endif /* CONFIG_IEEE80211BE */
-}
-
-static inline void ap_sta_set_mld(struct sta_info *sta, bool mld)
-{
-#ifdef CONFIG_IEEE80211BE
- if (sta)
- sta->mld_info.mld_sta = mld;
-#endif /* CONFIG_IEEE80211BE */
-}
+bool ap_sta_is_mld(struct hostapd_data *hapd, struct sta_info *sta);
+void ap_sta_set_mld(struct sta_info *sta, bool mld);
void ap_sta_free_sta_profile(struct mld_info *info);