]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
dbus: Add NonColoc6GHz and 6GHzOnly flags in wpa_supplicant scan
authorKaidong Wang <kaidong@chromium.org>
Tue, 10 Oct 2023 19:52:02 +0000 (19:52 +0000)
committerJouni Malinen <j@w1.fi>
Sun, 29 Oct 2023 15:46:35 +0000 (17:46 +0200)
Handler function for "Scan" method call of a network device doesn't set
non_coloc_6ghz, therefore wpa_supplicant doesn't scan non-PSC channels
on 6GHz band only if a co-located AP was reported on the channel.

Add NonColoc6GHz and 6GHzOnly flags to the wpas_dbus_handler_scan, so
that dBus scan requests can cover non-PSC channels and scan only 6 GHz
channels.

Signed-off-by: Kaidong Wang <kaidong@chromium.org>
doc/dbus.doxygen
wpa_supplicant/dbus/dbus_new_handlers.c

index 87f4c02fbbd4c4187b76f5a499730d369fe3fe2e..409db9522f85b19f44558d98800deb21a5690899 100644 (file)
@@ -212,6 +212,8 @@ fi.w1.wpa_supplicant1.CreateInterface.
              <tr><td>IEs</td><td>aay</td><td>Information elements to used in active scan (applies only if scan type is active)</td><td>No</td>
              <tr><td>Channels</td><td>a(uu)</td><td>Array of frequencies to scan in form of (center, width) in MHz.</td><td>No</td>
              <tr><td>AllowRoam</td><td>b</td><td>TRUE (or absent) to allow a roaming decision based on the results of this scan, FALSE to prevent a roaming decision.</td><td>No</td>
+             <tr><td>NonColoc6GHz</td><td>b</td><td>TRUE to force scanning of non-PSC 6 GHz channels, FALSE (or absent) to skip scanning of non-PSC 6 GHz channels.</td><td>No</td>
+             <tr><td>6GHzOnly</td><td>b</td><td>TRUE to scan only 6 GHz channels, FALSE (or absent) to scan all channels. Applies only if Channels is absent.</td><td>No</td>
            </table>
          </dd>
        </dl>
index 67ce970d01bd6ae2d88f1dd7a41e5d114cc37d6d..12d6f67594b8901d7cee4e6a183ac9ade5a9abb5 100644 (file)
@@ -1594,10 +1594,10 @@ static int wpas_dbus_get_scan_channels(DBusMessage *message,
 }
 
 
-static int wpas_dbus_get_scan_allow_roam(DBusMessage *message,
-                                        DBusMessageIter *var,
-                                        dbus_bool_t *allow,
-                                        DBusMessage **reply)
+static int wpas_dbus_get_scan_boolean(DBusMessage *message,
+                                     DBusMessageIter *var,
+                                     dbus_bool_t *allow,
+                                     DBusMessage **reply)
 {
        if (dbus_message_iter_get_arg_type(var) != DBUS_TYPE_BOOLEAN) {
                wpa_printf(MSG_DEBUG, "%s[dbus]: Type must be a boolean",
@@ -1630,6 +1630,8 @@ DBusMessage * wpas_dbus_handler_scan(DBusMessage *message,
        struct wpa_driver_scan_params params;
        size_t i;
        dbus_bool_t allow_roam = 1;
+       dbus_bool_t non_coloc_6ghz = FALSE;
+       dbus_bool_t scan_6ghz_only = FALSE;
 
        os_memset(&params, 0, sizeof(params));
 
@@ -1661,10 +1663,22 @@ DBusMessage * wpas_dbus_handler_scan(DBusMessage *message,
                                                        &params, &reply) < 0)
                                goto out;
                } else if (os_strcmp(key, "AllowRoam") == 0) {
-                       if (wpas_dbus_get_scan_allow_roam(message,
-                                                         &variant_iter,
-                                                         &allow_roam,
-                                                         &reply) < 0)
+                       if (wpas_dbus_get_scan_boolean(message,
+                                                      &variant_iter,
+                                                      &allow_roam,
+                                                      &reply) < 0)
+                               goto out;
+               } else if (os_strcmp(key, "NonColoc6GHz") == 0) {
+                       if (wpas_dbus_get_scan_boolean(message,
+                                                      &variant_iter,
+                                                      &non_coloc_6ghz,
+                                                      &reply) < 0)
+                               goto out;
+               } else if (os_strcmp(key, "6GHzOnly") == 0) {
+                       if (wpas_dbus_get_scan_boolean(message,
+                                                      &variant_iter,
+                                                      &scan_6ghz_only,
+                                                      &reply) < 0)
                                goto out;
                } else {
                        wpa_printf(MSG_DEBUG, "%s[dbus]: Unknown argument %s",
@@ -1683,6 +1697,13 @@ DBusMessage * wpas_dbus_handler_scan(DBusMessage *message,
                goto out;
        }
 
+       if (non_coloc_6ghz)
+               params.non_coloc_6ghz = 1;
+
+       if (scan_6ghz_only && !params.freqs)
+               wpa_add_scan_freqs_list(wpa_s, HOSTAPD_MODE_IEEE80211A, &params,
+                                       true, false, false);
+
        if (os_strcmp(type, "passive") == 0) {
                if (params.num_ssids || params.extra_ies_len) {
                        wpa_printf(MSG_DEBUG,