]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
AP: Fill MLO information in struct hostapd_sta_add_params
authorAndrei Otcheretianski <andrei.otcheretianski@intel.com>
Mon, 22 May 2023 19:33:43 +0000 (22:33 +0300)
committerJouni Malinen <j@w1.fi>
Wed, 7 Jun 2023 18:12:47 +0000 (21:12 +0300)
Provide MLO information when adding a new station to the driver.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
src/ap/ap_drv_ops.c
src/ap/ap_drv_ops.h
src/ap/ieee802_11.c
src/ap/sta_info.c

index a67a6a296f68e7b34dce88fffe4a4c2a7b97175e..389b35bfe2c77cc4d9630204b8d56a6ef5fa2b71 100644 (file)
@@ -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
+       /*
+        * An AP MLD needs 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, &params);
 }
 
index 844d2d87ac6841268702559f3e8bc9796c51e8d2..971e02866152e536fde88fff34b4a0b66cb44a0d 100644 (file)
@@ -47,7 +47,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);
 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);
index f003a76428ee1db693d25fdf9d4e079259f9c796..03ce0b5b4540637d9be715b69d8e012d2d03488e 100644 (file)
@@ -4245,6 +4245,20 @@ 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
@@ -4273,7 +4287,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) &&
@@ -4323,7 +4337,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",
index 2fb6edf09ff97522a0c008973e3f78cf1b089419..041c95961dd537570049f20e798d269e54b320bd 100644 (file)
@@ -1569,6 +1569,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
@@ -1576,6 +1579,16 @@ 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 && 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;
+       }
+#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);
@@ -1584,7 +1597,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,