From 3b68eef7d7683bbf7ecf9d4950820fe2f09013a9 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 22 Apr 2024 13:31:43 +0300 Subject: [PATCH] AP MLD: Do not store per-supplicant AP MLD MAC address information There is no need to store the AP MLD MAC address within per-supplicant data structure in struct wpa_state_machine since that MLD MAC address is available from the generic authenticator data in struct wpa_authenticator. Signed-off-by: Jouni Malinen --- src/ap/drv_callbacks.c | 2 +- src/ap/ieee802_11.c | 3 +-- src/ap/wpa_auth.c | 11 +++++------ src/ap/wpa_auth.h | 2 +- src/ap/wpa_auth_i.h | 1 - 5 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c index e026d9a6e..25e008ad2 100644 --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c @@ -517,7 +517,7 @@ int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr, if (ap_sta_is_mld(hapd, sta)) { wpa_printf(MSG_DEBUG, "MLD: Set ML info in RSN Authenticator"); - wpa_auth_set_ml_info(sta->wpa_sm, hapd->mld->mld_addr, + wpa_auth_set_ml_info(sta->wpa_sm, sta->mld_assoc_link_id, &sta->mld_info); } diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c index a2b02ee01..4fd86b715 100644 --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c @@ -3763,7 +3763,7 @@ u16 owe_process_rsn_ie(struct hostapd_data *hapd, } #ifdef CONFIG_IEEE80211BE if (ap_sta_is_mld(hapd, sta)) - wpa_auth_set_ml_info(sta->wpa_sm, hapd->mld->mld_addr, + wpa_auth_set_ml_info(sta->wpa_sm, sta->mld_assoc_link_id, &sta->mld_info); #endif /* CONFIG_IEEE80211BE */ rsn_ie -= 2; @@ -4056,7 +4056,6 @@ static int __check_assoc_ies(struct hostapd_data *hapd, struct sta_info *sta, "MLD: %s ML info in RSN Authenticator", init ? "Set" : "Reset"); wpa_auth_set_ml_info(sta->wpa_sm, - hapd->mld->mld_addr, sta->mld_assoc_link_id, info); } diff --git a/src/ap/wpa_auth.c b/src/ap/wpa_auth.c index 9b6e6430a..2b985ad10 100644 --- a/src/ap/wpa_auth.c +++ b/src/ap/wpa_auth.c @@ -90,7 +90,7 @@ static const u8 * wpa_auth_get_aa(const struct wpa_state_machine *sm) { #ifdef CONFIG_IEEE80211BE if (sm->mld_assoc_link_id >= 0) - return sm->own_mld_addr; + return sm->wpa_auth->mld_addr; #endif /* CONFIG_IEEE80211BE */ return sm->wpa_auth->addr; } @@ -2806,7 +2806,7 @@ SM_STATE(WPA_PTK, PTKSTART) "RSN: MLD: Add MAC Address KDE: kde_len=%zu", kde_len); wpa_add_kde(buf + kde_len, RSN_KEY_DATA_MAC_ADDR, - sm->own_mld_addr, ETH_ALEN, NULL, 0); + sm->wpa_auth->mld_addr, ETH_ALEN, NULL, 0); kde_len += 2 + RSN_SELECTOR_LEN + ETH_ALEN; } #endif /* CONFIG_IEEE80211BE */ @@ -4441,7 +4441,7 @@ static u8 * wpa_auth_ml_kdes(struct wpa_state_machine *sm, u8 *pos) wpa_printf(MSG_DEBUG, "RSN: MLD: Adding MAC Address KDE"); pos = wpa_add_kde(pos, RSN_KEY_DATA_MAC_ADDR, - sm->own_mld_addr, ETH_ALEN, NULL, 0); + sm->wpa_auth->mld_addr, ETH_ALEN, NULL, 0); for (link_id = 0; link_id < MAX_NUM_MLD_LINKS; link_id++) { if (!sm->mld_links[link_id].valid) @@ -7114,7 +7114,7 @@ void wpa_auth_sta_radius_psk_resp(struct wpa_state_machine *sm, bool success) } -void wpa_auth_set_ml_info(struct wpa_state_machine *sm, const u8 *mld_addr, +void wpa_auth_set_ml_info(struct wpa_state_machine *sm, u8 mld_assoc_link_id, struct mld_info *info) { #ifdef CONFIG_IEEE80211BE @@ -7130,7 +7130,6 @@ void wpa_auth_set_ml_info(struct wpa_state_machine *sm, const u8 *mld_addr, wpa_auth_logger(sm->wpa_auth, wpa_auth_get_spa(sm), LOGGER_DEBUG, "MLD: Initialization"); - os_memcpy(sm->own_mld_addr, mld_addr, ETH_ALEN); os_memcpy(sm->peer_mld_addr, info->common_info.mld_addr, ETH_ALEN); sm->mld_assoc_link_id = mld_assoc_link_id; @@ -7176,7 +7175,7 @@ void wpa_auth_set_ml_info(struct wpa_state_machine *sm, const u8 *mld_addr, wpa_printf(MSG_ERROR, "Unable to find authenticator object for ML STA " MACSTR " on link " MACSTR " link id %d", - MAC2STR(sm->own_mld_addr), + MAC2STR(sm->wpa_auth->mld_addr), MAC2STR(sm_link->own_addr), link_id); } diff --git a/src/ap/wpa_auth.h b/src/ap/wpa_auth.h index 117ac1d48..a8f2fc622 100644 --- a/src/ap/wpa_auth.h +++ b/src/ap/wpa_auth.h @@ -646,7 +646,7 @@ void wpa_auth_set_ocv_override_freq(struct wpa_authenticator *wpa_auth, void wpa_auth_sta_radius_psk_resp(struct wpa_state_machine *sm, bool success); -void wpa_auth_set_ml_info(struct wpa_state_machine *sm, const u8 *mld_addr, +void wpa_auth_set_ml_info(struct wpa_state_machine *sm, u8 mld_assoc_link_id, struct mld_info *info); void wpa_auth_ml_get_rsn_info(struct wpa_authenticator *a, struct wpa_auth_ml_link_rsn_info *info); diff --git a/src/ap/wpa_auth_i.h b/src/ap/wpa_auth_i.h index ac45cc413..07204c7c4 100644 --- a/src/ap/wpa_auth_i.h +++ b/src/ap/wpa_auth_i.h @@ -172,7 +172,6 @@ struct wpa_state_machine { #endif /* CONFIG_TESTING_OPTIONS */ #ifdef CONFIG_IEEE80211BE - u8 own_mld_addr[ETH_ALEN]; u8 peer_mld_addr[ETH_ALEN]; s8 mld_assoc_link_id; u8 n_mld_affiliated_links;