[PATCH RFC] wifi: ath12k: use random address for scan vdev
Alexander Wilhelm
alexander.wilhelm at westermo.com
Thu Nov 26 05:54:28 PST 2026
A scan on a radio without an active link creates a temporary scan vdev with
the vif address. An MLD capable station associated to a non-MLD AP uses the
vif (MLD) address for link 0 as well (IEEE 802.11be-2024 35.3.1).
A scan on another radio of the same device, e.g. on 2.4 GHz while connected
on 6 GHz, thus creates a second vdev with the same address. The firmware
rejects such a scan with WMI_SCAN_REASON_INTERNAL_FAILURE and the
subsequent scan vdev delete times out. As a result, roaming between non-MLD
APs on different radios fails.
Create scan vdevs with a random locally administered address instead and
send probe requests with the vif address using the spoofed MAC scan
feature, so mac80211 still accepts the probe responses.
Signed-off-by: Alexander Wilhelm <alexander.wilhelm at westermo.com>
---
drivers/net/wireless/ath/ath12k/mac.c | 9 ++++++++-
drivers/net/wireless/ath/ath12k/wmi.c | 2 ++
drivers/net/wireless/ath/ath12k/wmi.h | 2 ++
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index a247dcf387de..047d448a6fbb 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -5737,6 +5737,7 @@ static int ath12k_mac_initiate_hw_scan(struct ieee80211_hw *hw,
* above, assign arvif again for create.
*/
arvif = ath12k_mac_assign_link_vif(ah, vif, link_id);
+ eth_random_addr(arvif->bssid);
ret = ath12k_mac_vdev_create(ar, arvif);
if (ret) {
@@ -5779,6 +5780,12 @@ static int ath12k_mac_initiate_hw_scan(struct ieee80211_hw *hw,
arg->vdev_id = arvif->vdev_id;
arg->scan_id = ATH12K_SCAN_ID;
+ if (arvif->link_id >= IEEE80211_MLD_MAX_NUM_LINKS) {
+ arg->scan_f_add_spoofed_mac_in_probe = 1;
+ ether_addr_copy(arg->mac_addr.addr, vif->addr);
+ eth_broadcast_addr(arg->mac_mask.addr);
+ }
+
if (req->ie_len) {
arg->extraie.ptr = kmemdup(req->ie, req->ie_len, GFP_KERNEL);
if (!arg->extraie.ptr) {
@@ -10523,7 +10530,7 @@ int ath12k_mac_vdev_create(struct ath12k *ar, struct ath12k_link_vif *arvif)
if (link_conf)
memcpy(arvif->bssid, link_conf->addr, ETH_ALEN);
- else
+ else if (is_zero_ether_addr(arvif->bssid))
memcpy(arvif->bssid, vif->addr, ETH_ALEN);
arvif->ar = ar;
diff --git a/drivers/net/wireless/ath/ath12k/wmi.c b/drivers/net/wireless/ath/ath12k/wmi.c
index f41138a7c68e..d3f8fb1f308a 100644
--- a/drivers/net/wireless/ath/ath12k/wmi.c
+++ b/drivers/net/wireless/ath/ath12k/wmi.c
@@ -2774,6 +2774,8 @@ int ath12k_wmi_send_scan_start_cmd(struct ath12k *ar,
cmd->num_ssids = cpu_to_le32(arg->num_ssids);
cmd->ie_len = cpu_to_le32(arg->extraie.len);
cmd->n_probes = cpu_to_le32(arg->n_probes);
+ ether_addr_copy(cmd->mac_addr.addr, arg->mac_addr.addr);
+ ether_addr_copy(cmd->mac_mask.addr, arg->mac_mask.addr);
ptr += sizeof(*cmd);
diff --git a/drivers/net/wireless/ath/ath12k/wmi.h b/drivers/net/wireless/ath/ath12k/wmi.h
index 843f1d11f9c8..c0b474632e01 100644
--- a/drivers/net/wireless/ath/ath12k/wmi.h
+++ b/drivers/net/wireless/ath/ath12k/wmi.h
@@ -3648,6 +3648,8 @@ struct ath12k_wmi_scan_req_arg {
u32 num_hint_bssid;
struct ath12k_wmi_hint_short_ssid_arg hint_s_ssid[WLAN_SCAN_MAX_HINT_S_SSID];
struct ath12k_wmi_hint_bssid_arg hint_bssid[WLAN_SCAN_MAX_HINT_BSSID];
+ struct ath12k_wmi_mac_addr_params mac_addr;
+ struct ath12k_wmi_mac_addr_params mac_mask;
u32 chan_list[] __counted_by(num_chan);
};
---
base-commit: ba015e05863e3e57cb4c07ca94f78aba05b1ba23
change-id: 20261126-ath12k-scan-vdev-random-addr-0d3809606610
Best regards,
--
Alexander Wilhelm <alexander.wilhelm at westermo.com>
More information about the ath12k
mailing list