diff --git a/wpa_supplicant/bss.c b/wpa_supplicant/bss.c index 329d3cdc7..e07061abb 100644 --- a/wpa_supplicant/bss.c +++ b/wpa_supplicant/bss.c @@ -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); diff --git a/wpa_supplicant/bss.h b/wpa_supplicant/bss.h index bacf0a8e9..7b13ef96b 100644 --- a/wpa_supplicant/bss.h +++ b/wpa_supplicant/bss.h @@ -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); diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 7430e51b6..b91fd11bf 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -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; diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c index 2d26c1256..c6d725808 100644 --- a/wpa_supplicant/sme.c +++ b/wpa_supplicant/sme.c @@ -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);