[PATCH v2 15/44] AP: MLO: Add MLO information to hostapd_sta_add_params struct
Andrei Otcheretianski
andrei.otcheretianski at intel.com
Mon May 22 12:33:43 PDT 2023
Provide MLO information when adding new station.
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
---
src/ap/ap_drv_ops.c | 15 ++++++++++++++-
src/ap/ap_drv_ops.h | 3 ++-
src/ap/ieee802_11.c | 22 +++++++++++++++++++---
src/ap/sta_info.c | 19 ++++++++++++++++++-
4 files changed, 53 insertions(+), 6 deletions(-)
diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
index 3167bca786..622687befc 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -430,7 +430,7 @@ int hostapd_sta_add(struct hostapd_data *hapd,
size_t eht_capab_len,
const struct ieee80211_he_6ghz_band_cap *he_6ghz_capab,
u32 flags, u8 qosinfo, u8 vht_opmode, int supp_p2p_ps,
- int set)
+ int set, const u8 *link_addr, bool mld_link_sta)
{
struct hostapd_sta_add_params params;
@@ -460,6 +460,19 @@ int hostapd_sta_add(struct hostapd_data *hapd,
params.support_p2p_ps = supp_p2p_ps;
params.set = set;
params.mld_link_id = -1;
+
+#ifdef CONFIG_IEEE80211BE
+ /*
+ * for an MLD AP need to always specify to what link the station needs
+ * to be added
+ */
+ if (hapd->conf->mld_ap) {
+ params.mld_link_id = hapd->mld_link_id;
+ params.mld_link_addr = link_addr;
+ params.mld_link_sta = mld_link_sta;
+ }
+#endif /* CONFIG_IEEE80211BE */
+
return hapd->driver->sta_add(hapd->drv_priv, ¶ms);
}
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
index 844d2d87ac..2aa76385e1 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
@@ -47,7 +47,8 @@ int hostapd_sta_add(struct hostapd_data *hapd,
size_t eht_capab_len,
const struct ieee80211_he_6ghz_band_cap *he_6ghz_capab,
u32 flags, u8 qosinfo, u8 vht_opmode, int supp_p2p_ps,
- int set);
+ int set,
+ const u8 *link_addr, bool mld_link_sta);
int hostapd_set_privacy(struct hostapd_data *hapd, int enabled);
int hostapd_set_generic_elem(struct hostapd_data *hapd, const u8 *elem,
size_t elem_len);
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index 7eccf59bee..7495c04d04 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -4241,6 +4241,21 @@ static int add_associated_sta(struct hostapd_data *hapd,
struct ieee80211_he_capabilities he_cap;
struct ieee80211_eht_capabilities eht_cap;
int set = 1;
+ const u8 *mld_link_addr = NULL;
+ bool mld_link_sta = false;
+
+#ifdef CONFIG_IEEE80211BE
+ if (hapd->conf->mld_ap && sta->mld_info.mld_sta) {
+ u8 mld_link_id = hapd->mld_link_id;
+
+ mld_link_sta = sta->mld_assoc_link_id != mld_link_id;
+ mld_link_addr =
+ sta->mld_info.links[mld_link_id].peer_addr;
+
+ if (hapd->mld_link_id != sta->mld_assoc_link_id)
+ set = 0;
+ }
+#endif /* CONFIG_IEEE80211BE */
/*
* Remove the STA entry to ensure the STA PS state gets cleared and
@@ -4269,7 +4284,7 @@ static int add_associated_sta(struct hostapd_data *hapd,
wpa_auth_sta_ft_tk_already_set(sta->wpa_sm),
wpa_auth_sta_fils_tk_already_set(sta->wpa_sm));
- if (!sta->added_unassoc &&
+ if (!mld_link_sta && !sta->added_unassoc &&
(!(sta->flags & WLAN_STA_AUTHORIZED) ||
(reassoc && sta->ft_over_ds && sta->auth_alg == WLAN_AUTH_FT) ||
(!wpa_auth_sta_ft_tk_already_set(sta->wpa_sm) &&
@@ -4307,7 +4322,8 @@ static int add_associated_sta(struct hostapd_data *hapd,
* will be set when the ACK frame for the (Re)Association Response frame
* is processed (TX status driver event).
*/
- if (hostapd_sta_add(hapd, sta->addr, sta->aid, sta->capability,
+ if (hostapd_sta_add(hapd, sta->addr,
+ sta->aid, sta->capability,
sta->supported_rates, sta->supported_rates_len,
sta->listen_interval,
sta->flags & WLAN_STA_HT ? &ht_cap : NULL,
@@ -4319,7 +4335,7 @@ static int add_associated_sta(struct hostapd_data *hapd,
sta->he_6ghz_capab,
sta->flags | WLAN_STA_ASSOC, sta->qosinfo,
sta->vht_opmode, sta->p2p_ie ? 1 : 0,
- set)) {
+ set, mld_link_addr, mld_link_sta)) {
hostapd_logger(hapd, sta->addr,
HOSTAPD_MODULE_IEEE80211, HOSTAPD_LEVEL_NOTICE,
"Could not %s STA to kernel driver",
diff --git a/src/ap/sta_info.c b/src/ap/sta_info.c
index 0897bcda4d..edfda2abf1 100644
--- a/src/ap/sta_info.c
+++ b/src/ap/sta_info.c
@@ -1564,6 +1564,9 @@ int ap_sta_pending_delayed_1x_auth_fail_disconnect(struct hostapd_data *hapd,
int ap_sta_re_add(struct hostapd_data *hapd, struct sta_info *sta)
{
+ const u8 *mld_link_addr = NULL;
+ bool mld_link_sta = false;
+
/*
* If a station that is already associated to the AP, is trying to
* authenticate again, remove the STA entry, in order to make sure the
@@ -1571,6 +1574,19 @@ int ap_sta_re_add(struct hostapd_data *hapd, struct sta_info *sta)
* this, station's added_unassoc flag is cleared once the station has
* completed association.
*/
+
+#ifdef CONFIG_IEEE80211BE
+ if (hapd->conf->mld_ap) {
+ u8 mld_link_id = hapd->mld_link_id;
+
+ if (sta->mld_info.mld_sta) {
+ mld_link_sta = sta->mld_assoc_link_id != mld_link_id;
+ mld_link_addr =
+ sta->mld_info.links[mld_link_id].peer_addr;
+ }
+ }
+#endif /* CONFIG_IEEE80211BE */
+
ap_sta_set_authorized(hapd, sta, 0);
hostapd_drv_sta_remove(hapd, sta->addr);
sta->flags &= ~(WLAN_STA_ASSOC | WLAN_STA_AUTH | WLAN_STA_AUTHORIZED);
@@ -1579,7 +1595,8 @@ int ap_sta_re_add(struct hostapd_data *hapd, struct sta_info *sta)
sta->supported_rates,
sta->supported_rates_len,
0, NULL, NULL, NULL, 0, NULL, 0, NULL,
- sta->flags, 0, 0, 0, 0)) {
+ sta->flags, 0, 0, 0, 0,
+ mld_link_addr, mld_link_sta)) {
hostapd_logger(hapd, sta->addr,
HOSTAPD_MODULE_IEEE80211,
HOSTAPD_LEVEL_NOTICE,
--
2.38.1
More information about the Hostap
mailing list