]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Support scanning as AP when not beaconing
authorIlan Peer <ilan.peer@intel.com>
Fri, 17 Oct 2025 14:00:36 +0000 (16:00 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 13 Dec 2025 18:39:54 +0000 (20:39 +0200)
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 <ilan.peer@intel.com>
Reviewed-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
src/drivers/driver_nl80211.h
src/drivers/driver_nl80211_capa.c
src/drivers/driver_nl80211_scan.c

index 3d5eb493d68b730ac3a3ec86806447b6ad6bb389..df97658332c1a32a1ba93bd8dc66e0fb1f4fb4e9 100644 (file)
@@ -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];
 
index 2aba1f9a42f33216c8e2e3fe2a8ffe997c3fe28f..aed2774dce69a439c0d5fae60688565d8f22b1f5 100644 (file)
@@ -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
index b39943f60de3d318ad1a4b8ce9b78ed9f2bae70e..88ceb911909b20ed1788214035d49a72d8c64c79 100644 (file)
@@ -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) {