]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
scan: Include AP MLD ID in ML probe request if needed
authorIlan Peer <ilan.peer@intel.com>
Mon, 20 Nov 2023 23:51:37 +0000 (01:51 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 25 Nov 2023 19:38:57 +0000 (21:38 +0200)
According to IEEE P802.11be/D4.0, 35.3.4.2, the AP MLD ID must be
included in the Probe Request ML element in case it is sent to a
transmitted BSS in which case it should be set to 0. If it is sent to an
non-transmitted BSSID, the AP MLD ID should not be included.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
wpa_supplicant/bss.c
wpa_supplicant/bss.h
wpa_supplicant/events.c
wpa_supplicant/sme.c

index 329d3cdc7fce32818f36164dc8609119f9baf8b1..e07061abb57164db814d0887a8f27bda2a253188 100644 (file)
@@ -1571,6 +1571,7 @@ wpa_bss_parse_ml_rnr_ap_info(struct wpa_supplicant *wpa_s,
  *   should be initialized and #MAX_NUM_MLD_LINKS elements long
  * @missing_links: Result bitmask of links that were not discovered (or %NULL)
  * @ssid: Target SSID (or %NULL)
+ * @ap_mld_id: On return would hold the corresponding AP MLD ID (or %NULL)
  * Returns: 0 on success or -1 for non-MLD or parsing failures
  *
  * Parses the Basic Multi-Link element of the BSS into @link_info using the scan
@@ -1582,7 +1583,8 @@ int wpa_bss_parse_basic_ml_element(struct wpa_supplicant *wpa_s,
                                   struct wpa_bss *bss,
                                   u8 *ap_mld_addr,
                                   u16 *missing_links,
-                                  struct wpa_ssid *ssid)
+                                  struct wpa_ssid *ssid,
+                                  u8 *ap_mld_id)
 {
        struct ieee802_11_elems elems;
        struct wpabuf *mlbuf;
@@ -1747,6 +1749,9 @@ int wpa_bss_parse_basic_ml_element(struct wpa_supplicant *wpa_s,
        if (missing_links)
                *missing_links = missing;
 
+       if (ap_mld_id)
+               *ap_mld_id = mbssid_idx;
+
        ret = 0;
 out:
        wpabuf_free(mlbuf);
index bacf0a8e9cf1cad143b4a16aed31e81d65b60a1a..7b13ef96b80c2c0c27610ccbef970049596695a2 100644 (file)
@@ -216,7 +216,8 @@ int wpa_bss_parse_basic_ml_element(struct wpa_supplicant *wpa_s,
                                   struct wpa_bss *bss,
                                   u8 *ap_mld_addr,
                                   u16 *missing_links,
-                                  struct wpa_ssid *ssid);
+                                  struct wpa_ssid *ssid,
+                                  u8 *ap_mld_id);
 u16 wpa_bss_parse_reconf_ml_element(struct wpa_supplicant *wpa_s,
                                    struct wpa_bss *bss);
 
index 7430e51b63cb5cb513da79b012e3c34959a3be69..b91fd11bfc2b4f7fa74a58a485a73e0fc6dfac70 100644 (file)
@@ -1153,7 +1153,7 @@ static bool wpas_valid_ml_bss(struct wpa_supplicant *wpa_s, struct wpa_bss *bss)
 {
        u16 removed_links;
 
-       if (wpa_bss_parse_basic_ml_element(wpa_s, bss, NULL, NULL, NULL))
+       if (wpa_bss_parse_basic_ml_element(wpa_s, bss, NULL, NULL, NULL, NULL))
                return true;
 
        if (bss->n_mld_links == 0)
@@ -1871,6 +1871,7 @@ static int wpa_supplicant_connect_ml_missing(struct wpa_supplicant *wpa_s,
 {
        int *freqs;
        u16 missing_links = 0, removed_links;
+       u8 ap_mld_id;
 
        if (!((wpa_s->drv_flags2 & WPA_DRIVER_FLAGS2_MLO) &&
              (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME)))
@@ -1878,7 +1879,8 @@ static int wpa_supplicant_connect_ml_missing(struct wpa_supplicant *wpa_s,
 
        /* Try to resolve any missing link information */
        if (wpa_bss_parse_basic_ml_element(wpa_s, selected, NULL,
-                                          &missing_links, ssid) ||
+                                          &missing_links, ssid,
+                                          &ap_mld_id) ||
            !missing_links)
                return 0;
 
@@ -1910,7 +1912,19 @@ static int wpa_supplicant_connect_ml_missing(struct wpa_supplicant *wpa_s,
        wpa_s->manual_scan_freqs = freqs;
 
        os_memcpy(wpa_s->ml_probe_bssid, selected->bssid, ETH_ALEN);
-       wpa_s->ml_probe_mld_id = -1;
+
+       /*
+        * In case the ML probe request is intended to retrieve information from
+        * the transmitted BSS, the AP MLD ID should be included and should be
+        * set to zero.
+        * In case the ML probe requested is intended to retrieve information
+        * from a non-transmitted BSS, the AP MLD ID should not be included.
+        */
+       if (ap_mld_id)
+               wpa_s->ml_probe_mld_id = -1;
+       else
+               wpa_s->ml_probe_mld_id = 0;
+
        wpa_s->ml_probe_links = missing_links;
 
        wpa_s->normal_scans = 0;
index 2d26c12561183a5a175f6d6327c4198d0dfea441..c6d725808f7f98e8bb9ff82f5e66f3e802b5956b 100644 (file)
@@ -575,7 +575,7 @@ static void sme_send_authentication(struct wpa_supplicant *wpa_s,
 
        if ((wpa_s->drv_flags2 & WPA_DRIVER_FLAGS2_MLO) &&
            !wpa_bss_parse_basic_ml_element(wpa_s, bss, wpa_s->ap_mld_addr,
-                                           NULL, ssid) &&
+                                           NULL, ssid, NULL) &&
            bss->n_mld_links) {
                wpa_printf(MSG_DEBUG, "MLD: In authentication");
                wpas_sme_set_mlo_links(wpa_s, bss);