]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
AP MLD: Use a helper function to set whether a STA is a non-AP MLD
authorJouni Malinen <j@w1.fi>
Sun, 21 Jan 2024 17:06:36 +0000 (19:06 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 21 Jan 2024 17:08:08 +0000 (19:08 +0200)
This makes it easier to change the struct sta_info design for MLD by
reducing the number of direct references.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/ap/drv_callbacks.c
src/ap/ieee802_11.c
src/ap/sta_info.h

index 5ceb084a1ce90b6e239d9b33a2341a601ba7e826..39deacd3d900bb9612189aad86c5b107b4a188b5 100644 (file)
@@ -362,7 +362,7 @@ int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
                int i, num_valid_links = 0;
                u8 link_id = hapd->mld_link_id;
 
-               info->mld_sta = true;
+               ap_sta_set_mld(sta, true);
                sta->mld_assoc_link_id = link_id;
                os_memcpy(info->common_info.mld_addr, addr, ETH_ALEN);
                info->links[link_id].valid = true;
@@ -2191,8 +2191,8 @@ static int hostapd_notif_update_dh_ie(struct hostapd_data *hapd,
                struct mld_info *info = &sta->mld_info;
                u8 link_id = hapd->mld_link_id;
 
-               info->mld_sta = true;
-               sta->mld_assoc_link_id = link_id;;
+               ap_sta_set_mld(sta, true);
+               sta->mld_assoc_link_id = link_id;
                os_memcpy(info->common_info.mld_addr, peer, ETH_ALEN);
                info->links[link_id].valid = true;
                os_memcpy(info->links[link_id].local_addr, hapd->own_addr,
index c1299c90da2df612edbba72f107a4b783f87140a..114a01eb14eeabede2dbedef79108d67979e476b 100644 (file)
@@ -3083,7 +3083,7 @@ static void handle_auth(struct hostapd_data *hapd,
                if (mld_sta) {
                        u8 link_id = hapd->mld_link_id;
 
-                       sta->mld_info.mld_sta = true;
+                       ap_sta_set_mld(sta, true);
                        sta->mld_assoc_link_id = link_id;
 
                        /*
@@ -4431,7 +4431,7 @@ static void ieee80211_ml_process_link(struct hostapd_data *hapd,
                goto out;
        }
 
-       sta->mld_info.mld_sta = true;
+       ap_sta_set_mld(sta, true);
        sta->mld_assoc_link_id = origin_sta->mld_assoc_link_id;
 
        os_memcpy(&sta->mld_info, &origin_sta->mld_info, sizeof(sta->mld_info));
index ef60734813458cd5c3acb33f48f95cda63a770fb..d2ff03b3f743e6591e8cfc058eb203a977787e47 100644 (file)
@@ -430,4 +430,12 @@ static inline bool ap_sta_is_mld(struct hostapd_data *hapd,
 #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 */
+}
+
 #endif /* STA_INFO_H */