]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Send allowed BSSIDs, if set, for an NL80211_CMD_CONNECT command
authorJay Shukla <quic_jayshukl@quicinc.com>
Thu, 20 Feb 2025 10:36:24 +0000 (16:06 +0530)
committerJouni Malinen <j@w1.fi>
Thu, 3 Apr 2025 20:00:38 +0000 (23:00 +0300)
Add support for configuring the allowed BSSIDs to the driver with the
vendor command QCA_NL80211_VENDOR_SUBCMD_CONNECT_EXT when using
NL80211_CMD_CONNECT for the connection. This limits which BSSIDs the
driver-based SME can consider for the connection similarly to the
wpa_supplicant-based SME design.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
src/drivers/driver.h
src/drivers/driver_nl80211.c
wpa_supplicant/wpa_supplicant.c

index b356371b590cc9678eb135028d27ebd89d325b2c..48092ea9afd6bb54d4bc5f9e1e82e30b0307c89b 100644 (file)
@@ -1412,6 +1412,16 @@ struct wpa_driver_associate_params {
         * spp_amsdu - SPP A-MSDU used on this connection
         */
        bool spp_amsdu;
+
+       /**
+        * bssid_filter - Allowed BSSIDs for the current association
+        * This can be %NULL to indicate no constraint. */
+       const u8 *bssid_filter;
+
+       /**
+        * bssid_filter_count - Number of allowed BSSIDs
+        */
+       unsigned int bssid_filter_count;
 };
 
 enum hide_ssid {
index 1ba8f1f331ec6c01695e21074ecec072cb107e93..d54c3e07844d034a5fb5646e0d26903a93ba7c94 100644 (file)
@@ -7205,6 +7205,26 @@ static int nl80211_connect_ext(struct wpa_driver_nl80211_data *drv,
                    sizeof(features), features))
                goto fail;
 
+       if (params->bssid_filter && params->bssid_filter_count) {
+               struct nlattr *bssid_list;
+               unsigned int i;
+
+               bssid_list = nla_nest_start(
+                       msg, QCA_WLAN_VENDOR_ATTR_CONNECT_EXT_ALLOWED_BSSIDS);
+               if (!bssid_list)
+                       goto fail;
+
+               for (i = 0; i < params->bssid_filter_count; i++) {
+                       wpa_printf(MSG_DEBUG, "- bssid_filter[%d]=" MACSTR, i,
+                                  MAC2STR(&params->bssid_filter[i * ETH_ALEN]));
+                       if (nla_put(msg, i + 1, ETH_ALEN,
+                                   &params->bssid_filter[i * ETH_ALEN]))
+                               goto fail;
+               }
+
+               nla_nest_end(msg, bssid_list);
+       }
+
        nla_nest_end(msg, attr);
 
        return send_and_recv_cmd(drv, msg);
index e63048d187b8af9fe76e66a53086870e88dd2682..cbda854c5833783da09240108ac6513b828c07f7 100644 (file)
@@ -4573,6 +4573,9 @@ static void wpas_start_assoc_cb(struct wpa_radio_work *work, int deinit)
                params.pbss = (ssid->pbss != 2) ? ssid->pbss : 0;
        }
 
+       params.bssid_filter = wpa_s->bssid_filter;
+       params.bssid_filter_count = wpa_s->bssid_filter_count;
+
        if (ssid->mode == WPAS_MODE_IBSS && ssid->bssid_set &&
            wpa_s->conf->ap_scan == 2) {
                params.bssid = ssid->bssid;