From: Ilan Peer Date: Fri, 17 Oct 2025 14:00:36 +0000 (+0200) Subject: nl80211: Support scanning as AP when not beaconing X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ba9dacb42c4de8f59a6c7a8a5d3e98b2cc535e8d;p=thirdparty%2Fhostap.git nl80211: Support scanning as AP when not beaconing If the kernel indicated support for scanning on AP interface, set NL80211_SCAN_FLAG_AP in the scan request when the interface is not yet beaconing. In that case, it is possible to do a scan without interfering with normal AP operation so it is safe to set the flag. This is important because otherwise it may not be possible to do the appropriate scans required to bring up an interface that is part of an MLD. Signed-off-by: Ilan Peer Reviewed-by: Andrei Otcheretianski --- diff --git a/src/drivers/driver_nl80211.h b/src/drivers/driver_nl80211.h index 3d5eb493d..df9765833 100644 --- a/src/drivers/driver_nl80211.h +++ b/src/drivers/driver_nl80211.h @@ -210,6 +210,7 @@ struct wpa_driver_nl80211_data { unsigned int puncturing:1; unsigned int qca_ap_allowed_freqs:1; unsigned int connect_ext_vendor_cmd_avail:1; + unsigned int support_ap_scan:1; u8 extra_bss_membership_selectors[8]; diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c index 2aba1f9a4..aed2774dc 100644 --- a/src/drivers/driver_nl80211_capa.c +++ b/src/drivers/driver_nl80211_capa.c @@ -82,6 +82,7 @@ struct wiphy_info_data { unsigned int update_ft_ies_supported:1; unsigned int has_key_mgmt:1; unsigned int has_key_mgmt_iftype:1; + unsigned int support_ap_scan:1; }; @@ -789,6 +790,9 @@ static void wiphy_info_feature_flags(struct wiphy_info_data *info, if (flags & NL80211_FEATURE_FULL_AP_CLIENT_STATE) capa->flags |= WPA_DRIVER_FLAGS_FULL_AP_CLIENT_STATE; + + if (flags & NL80211_FEATURE_AP_SCAN) + info->support_ap_scan = 1; } @@ -1583,6 +1587,7 @@ int wpa_driver_nl80211_capa(struct wpa_driver_nl80211_data *drv) if (info.set_qos_map_supported) drv->capa.flags |= WPA_DRIVER_FLAGS_QOS_MAPPING; drv->have_low_prio_scan = info.have_low_prio_scan; + drv->support_ap_scan = info.support_ap_scan; /* * If the driver doesn't support data TX status, we won't get TX diff --git a/src/drivers/driver_nl80211_scan.c b/src/drivers/driver_nl80211_scan.c index b39943f60..88ceb9119 100644 --- a/src/drivers/driver_nl80211_scan.c +++ b/src/drivers/driver_nl80211_scan.c @@ -270,6 +270,12 @@ nl80211_scan_common(struct i802_bss *bss, u8 cmd, if (!drv->hostapd && is_ap_interface(drv->nlmode)) { wpa_printf(MSG_DEBUG, "nl80211: Add NL80211_SCAN_FLAG_AP"); scan_flags |= NL80211_SCAN_FLAG_AP; + } else if (drv->support_ap_scan && is_ap_interface(drv->nlmode) && + !nl80211_get_link(bss, params->link_id)->beacon_set) { + wpa_printf(MSG_DEBUG, + "nl80211: Add NL80211_SCAN_FLAG_AP for scan for link %d that is not beaconing", + params->link_id); + scan_flags |= NL80211_SCAN_FLAG_AP; } if (params->only_new_results) {