]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
AP: MLO: Forward link specific events to the identified link
authorAndrei Otcheretianski <andrei.otcheretianski@intel.com>
Mon, 22 May 2023 19:33:58 +0000 (22:33 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 12 Jun 2023 20:19:14 +0000 (23:19 +0300)
Process Management and EAPOL frames on the correct link.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
src/ap/drv_callbacks.c

index 7d15ceaab39570de188cf654012a6ab07b68872b..6c1510a6bff6d5bbc0990a807983f0835e8de1e1 100644 (file)
@@ -1418,6 +1418,23 @@ static void hostapd_action_rx(struct hostapd_data *hapd,
 
 #ifdef NEED_AP_MLME
 
+static struct hostapd_data *
+switch_link_hapd(struct hostapd_data *hapd, int link_id)
+{
+#ifdef CONFIG_IEEE80211BE
+       if (hapd->conf->mld_ap && link_id >= 0) {
+               struct hostapd_data *link_bss;
+
+               link_bss = hostapd_mld_get_link_bss(hapd, link_id);
+               if (link_bss)
+                       return link_bss;
+       }
+#endif /* CONFIG_IEEE80211BE */
+
+       return hapd;
+}
+
+
 #define HAPD_BROADCAST ((struct hostapd_data *) -1)
 
 static struct hostapd_data * get_hapd_bssid(struct hostapd_iface *iface,
@@ -1454,13 +1471,16 @@ static void hostapd_rx_from_unknown_sta(struct hostapd_data *hapd,
 
 static int hostapd_mgmt_rx(struct hostapd_data *hapd, struct rx_mgmt *rx_mgmt)
 {
-       struct hostapd_iface *iface = hapd->iface;
+       struct hostapd_iface *iface;
        const struct ieee80211_hdr *hdr;
        const u8 *bssid;
        struct hostapd_frame_info fi;
        int ret;
        bool is_mld = false;
 
+       hapd = switch_link_hapd(hapd, rx_mgmt->link_id);
+       iface = hapd->iface;
+
 #ifdef CONFIG_TESTING_OPTIONS
        if (hapd->ext_mgmt_frame_handling) {
                size_t hex_len = 2 * rx_mgmt->frame_len + 1;
@@ -1596,12 +1616,16 @@ static int hostapd_event_new_sta(struct hostapd_data *hapd, const u8 *addr)
 
 static void hostapd_event_eapol_rx(struct hostapd_data *hapd, const u8 *src,
                                   const u8 *data, size_t data_len,
-                                  enum frame_encryption encrypted)
+                                  enum frame_encryption encrypted,
+                                  int link_id)
 {
-       struct hostapd_iface *iface = hapd->iface;
+       struct hostapd_iface *iface;
        struct sta_info *sta;
        size_t j;
 
+       hapd = switch_link_hapd(hapd, link_id);
+       iface = hapd->iface;
+
        for (j = 0; j < iface->num_bss; j++) {
                sta = ap_get_sta(iface->bss[j], src);
                if (sta && sta->flags & WLAN_STA_ASSOC) {
@@ -2003,7 +2027,8 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
                hostapd_event_eapol_rx(hapd, data->eapol_rx.src,
                                       data->eapol_rx.data,
                                       data->eapol_rx.data_len,
-                                      data->eapol_rx.encrypted);
+                                      data->eapol_rx.encrypted,
+                                      data->eapol_rx.link_id);
                break;
        case EVENT_ASSOC:
                if (!data)