]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
AP MLD: Handle channel switch event in correct link
authorChenming Huang <quic_chenhuan@quicinc.com>
Tue, 5 Sep 2023 02:26:09 +0000 (07:56 +0530)
committerJouni Malinen <j@w1.fi>
Sun, 26 Nov 2023 15:25:41 +0000 (17:25 +0200)
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>
src/ap/drv_callbacks.c
src/drivers/driver_nl80211_event.c

index a1ee1bb70e303604c62ed1b2357325ff5521ac96..0e1a8502708ade95e7915ba60929e20fd9bb5a9c 100644 (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,
index 0b97cbf5dde1b7a96f95656e2e0858a90d8921b5..463cf6e0ae1a2089157d0b47006358245c24d237 100644 (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(