From: Aditya Kumar Singh Date: Sat, 7 Sep 2024 04:08:00 +0000 (+0530) Subject: scan: Pass correct link ID in all cases X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b83859c785160b0bdff60dfdb2820f1800acb0a9;p=thirdparty%2Fhostap.git scan: Pass correct link ID in all cases In hostapd, when a scan was initiated, the link ID parameter was not populated in all scenarios, such as ACS. Additionally, each caller of hostapd_driver_scan() provided the link ID. However, since hostapd_driver_scan() has access to the hapd pointer, it can populate the link ID itself. And from wpa_supplicant, link ID was passed as 0 which does not seem to be correct. Fix that as well. Signed-off-by: Aditya Kumar Singh --- diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c index 977610927..f82bfd077 100644 --- a/src/ap/ap_drv_ops.c +++ b/src/ap/ap_drv_ops.c @@ -781,6 +781,12 @@ bool hostapd_drv_nl80211(struct hostapd_data *hapd) int hostapd_driver_scan(struct hostapd_data *hapd, struct wpa_driver_scan_params *params) { + params->link_id = -1; +#ifdef CONFIG_IEEE80211BE + if (hapd->conf->mld_ap) + params->link_id = hapd->mld_link_id; +#endif /* CONFIG_IEEE80211BE */ + if (hapd->driver && hapd->driver->scan2) return hapd->driver->scan2(hapd->drv_priv, params); return -1; diff --git a/src/ap/hw_features.c b/src/ap/hw_features.c index 02d67593a..cef38173e 100644 --- a/src/ap/hw_features.c +++ b/src/ap/hw_features.c @@ -528,12 +528,6 @@ static void ap_ht40_scan_retry(void *eloop_data, void *user_data) else ieee80211n_scan_channels_5g(iface, ¶ms); - params.link_id = -1; -#ifdef CONFIG_IEEE80211BE - if (iface->bss[0]->conf->mld_ap) - params.link_id = iface->bss[0]->mld_link_id; -#endif /* CONFIG_IEEE80211BE */ - ret = hostapd_driver_scan(iface->bss[0], ¶ms); iface->num_ht40_scan_tries++; os_free(params.freqs); @@ -585,11 +579,6 @@ static int ieee80211n_check_40mhz(struct hostapd_iface *iface) else ieee80211n_scan_channels_5g(iface, ¶ms); - params.link_id = -1; -#ifdef CONFIG_IEEE80211BE - if (iface->bss[0]->conf->mld_ap) - params.link_id = iface->bss[0]->mld_link_id; -#endif /* CONFIG_IEEE80211BE */ ret = hostapd_driver_scan(iface->bss[0], ¶ms); os_free(params.freqs); diff --git a/wpa_supplicant/driver_i.h b/wpa_supplicant/driver_i.h index b6c7f5085..cd74e31d3 100644 --- a/wpa_supplicant/driver_i.h +++ b/wpa_supplicant/driver_i.h @@ -104,6 +104,8 @@ static inline int wpa_drv_mesh_link_probe(struct wpa_supplicant *wpa_s, static inline int wpa_drv_scan(struct wpa_supplicant *wpa_s, struct wpa_driver_scan_params *params) { + params->link_id = -1; + #ifdef CONFIG_TESTING_OPTIONS if (wpa_s->test_failure == WPAS_TEST_FAILURE_SCAN_TRIGGER) return -EBUSY;