AP MLD: Handle channel switch event in correct link

USe the link ID information to determine the specific affiliated link
when processing channel switch events on an AP MLD.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
This commit is contained in:
Chenming Huang 2023-09-05 07:56:09 +05:30 committed by Jouni Malinen
parent fb6598864b
commit f1fee0d1ff
2 changed files with 18 additions and 2 deletions

View file

@ -2361,6 +2361,18 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
case EVENT_CH_SWITCH:
if (!data)
break;
#ifdef CONFIG_IEEE80211BE
if (data->ch_switch.link_id != -1) {
hapd = hostapd_mld_get_link_bss(
hapd, data->ch_switch.link_id);
if (!hapd) {
wpa_printf(MSG_ERROR,
"MLD: Failed to get link (ID %d) BSS for EVENT_CH_SWITCH/EVENT_CH_SWITCH_STARTED",
data->ch_switch.link_id);
break;
}
}
#endif /* CONFIG_IEEE80211BE */
hostapd_event_ch_switch(hapd, data->ch_switch.freq,
data->ch_switch.ht_enabled,
data->ch_switch.ch_offset,

View file

@ -1272,12 +1272,16 @@ static void mlme_event_ch_switch(struct wpa_driver_nl80211_data *drv,
if (finished)
bss->flink->freq = data.ch_switch.freq;
if (link)
data.ch_switch.link_id = nla_get_u8(link);
else
data.ch_switch.link_id = NL80211_DRV_LINK_ID_NA;
if (link && is_sta_interface(drv->nlmode)) {
u8 link_id = nla_get_u8(link);
u8 link_id = data.ch_switch.link_id;
if (link_id < MAX_NUM_MLD_LINKS &&
drv->sta_mlo_info.valid_links & BIT(link_id)) {
data.ch_switch.link_id = link_id;
drv->sta_mlo_info.links[link_id].freq =
data.ch_switch.freq;
wpa_supplicant_event(