AP MLD: Use a helper function to set whether a STA is a non-AP MLD

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>
This commit is contained in:
Jouni Malinen 2024-01-21 19:06:36 +02:00
parent 6bda0aca8b
commit fa79e46c78
3 changed files with 13 additions and 5 deletions

View file

@ -362,7 +362,7 @@ int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
int i, num_valid_links = 0; int i, num_valid_links = 0;
u8 link_id = hapd->mld_link_id; u8 link_id = hapd->mld_link_id;
info->mld_sta = true; ap_sta_set_mld(sta, true);
sta->mld_assoc_link_id = link_id; sta->mld_assoc_link_id = link_id;
os_memcpy(info->common_info.mld_addr, addr, ETH_ALEN); os_memcpy(info->common_info.mld_addr, addr, ETH_ALEN);
info->links[link_id].valid = true; 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; struct mld_info *info = &sta->mld_info;
u8 link_id = hapd->mld_link_id; u8 link_id = hapd->mld_link_id;
info->mld_sta = true; ap_sta_set_mld(sta, true);
sta->mld_assoc_link_id = link_id;; sta->mld_assoc_link_id = link_id;
os_memcpy(info->common_info.mld_addr, peer, ETH_ALEN); os_memcpy(info->common_info.mld_addr, peer, ETH_ALEN);
info->links[link_id].valid = true; info->links[link_id].valid = true;
os_memcpy(info->links[link_id].local_addr, hapd->own_addr, os_memcpy(info->links[link_id].local_addr, hapd->own_addr,

View file

@ -3083,7 +3083,7 @@ static void handle_auth(struct hostapd_data *hapd,
if (mld_sta) { if (mld_sta) {
u8 link_id = hapd->mld_link_id; 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; sta->mld_assoc_link_id = link_id;
/* /*
@ -4431,7 +4431,7 @@ static void ieee80211_ml_process_link(struct hostapd_data *hapd,
goto out; 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; sta->mld_assoc_link_id = origin_sta->mld_assoc_link_id;
os_memcpy(&sta->mld_info, &origin_sta->mld_info, sizeof(sta->mld_info)); os_memcpy(&sta->mld_info, &origin_sta->mld_info, sizeof(sta->mld_info));

View file

@ -430,4 +430,12 @@ static inline bool ap_sta_is_mld(struct hostapd_data *hapd,
#endif /* CONFIG_IEEE80211BE */ #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 */ #endif /* STA_INFO_H */