diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c index a1ee1bb70..0e1a85027 100644 --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c @@ -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, diff --git a/src/drivers/driver_nl80211_event.c b/src/drivers/driver_nl80211_event.c index 0b97cbf5d..463cf6e0a 100644 --- a/src/drivers/driver_nl80211_event.c +++ b/src/drivers/driver_nl80211_event.c @@ -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(