Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commiteffd05a

Browse files
jmberg-intelegrumbach
authored andcommitted
iwlwifi: mvm: support random MAC address for scanning
For background and scheduled scan, using the new unified scan API,support random MAC address scanning.Unfortunately, the firmware right now doesn't support randomisingitself, so for now do it on the host - we'll change this once thefirmware supports randomising the address for each scan iterationusing the address/mask.Signed-off-by: Johannes Berg <johannes.berg@intel.com>Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
1 parentb975e55 commiteffd05a

File tree

2 files changed

+34
-7
lines changed

2 files changed

+34
-7
lines changed

‎drivers/net/wireless/iwlwifi/mvm/mac80211.c‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,12 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
344344
}
345345

346346
if (mvm->fw->ucode_capa.api[0]&IWL_UCODE_TLV_API_LMAC_SCAN||
347-
mvm->fw->ucode_capa.capa[0]&IWL_UCODE_TLV_CAPA_UMAC_SCAN)
347+
mvm->fw->ucode_capa.capa[0]&IWL_UCODE_TLV_CAPA_UMAC_SCAN) {
348348
hw->flags |=IEEE80211_SINGLE_HW_SCAN_ON_ALL_BANDS;
349+
hw->wiphy->features |=
350+
NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR |
351+
NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR;
352+
}
349353

350354
hw->sta_data_size=sizeof(structiwl_mvm_sta);
351355
hw->vif_data_size=sizeof(structiwl_mvm_vif);

‎drivers/net/wireless/iwlwifi/mvm/scan.c‎

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,14 +1224,25 @@ static u8 *iwl_mvm_copy_and_insert_ds_elem(struct iwl_mvm *mvm, const u8 *ies,
12241224
staticvoid
12251225
iwl_mvm_build_unified_scan_probe(structiwl_mvm*mvm,structieee80211_vif*vif,
12261226
structieee80211_scan_ies*ies,
1227-
structiwl_scan_probe_req*preq)
1227+
structiwl_scan_probe_req*preq,
1228+
constu8*mac_addr,constu8*mac_addr_mask)
12281229
{
12291230
structieee80211_mgmt*frame= (structieee80211_mgmt*)preq->buf;
12301231
u8*pos,*newpos;
12311232

1233+
/*
1234+
* Unfortunately, right now the offload scan doesn't support randomising
1235+
* within the firmware, so until the firmware API is ready we implement
1236+
* it in the driver. This means that the scan iterations won't really be
1237+
* random, only when it's restarted, but at least that helps a bit.
1238+
*/
1239+
if (mac_addr)
1240+
get_random_mask_addr(frame->sa,mac_addr,mac_addr_mask);
1241+
else
1242+
memcpy(frame->sa,vif->addr,ETH_ALEN);
1243+
12321244
frame->frame_control=cpu_to_le16(IEEE80211_STYPE_PROBE_REQ);
12331245
eth_broadcast_addr(frame->da);
1234-
memcpy(frame->sa,vif->addr,ETH_ALEN);
12351246
eth_broadcast_addr(frame->bssid);
12361247
frame->seq_ctrl=0;
12371248

@@ -1375,7 +1386,10 @@ int iwl_mvm_unified_scan_lmac(struct iwl_mvm *mvm,
13751386
preq= (void*)(cmd->data+sizeof(structiwl_scan_channel_cfg_lmac)*
13761387
mvm->fw->ucode_capa.n_scan_channels);
13771388

1378-
iwl_mvm_build_unified_scan_probe(mvm,vif,&req->ies,preq);
1389+
iwl_mvm_build_unified_scan_probe(mvm,vif,&req->ies,preq,
1390+
req->req.flags&NL80211_SCAN_FLAG_RANDOM_ADDR ?
1391+
req->req.mac_addr :NULL,
1392+
req->req.mac_addr_mask);
13791393

13801394
ret=iwl_mvm_send_cmd(mvm,&hcmd);
13811395
if (!ret) {
@@ -1466,7 +1480,10 @@ int iwl_mvm_unified_sched_scan_lmac(struct iwl_mvm *mvm,
14661480
preq= (void*)(cmd->data+sizeof(structiwl_scan_channel_cfg_lmac)*
14671481
mvm->fw->ucode_capa.n_scan_channels);
14681482

1469-
iwl_mvm_build_unified_scan_probe(mvm,vif,ies,preq);
1483+
iwl_mvm_build_unified_scan_probe(mvm,vif,ies,preq,
1484+
req->flags&NL80211_SCAN_FLAG_RANDOM_ADDR ?
1485+
req->mac_addr :NULL,
1486+
req->mac_addr_mask);
14701487

14711488
ret=iwl_mvm_send_cmd(mvm,&hcmd);
14721489
if (!ret) {
@@ -1796,7 +1813,10 @@ int iwl_mvm_scan_umac(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
17961813
sec_part->schedule[0].iter_count=1;
17971814
sec_part->delay=0;
17981815

1799-
iwl_mvm_build_unified_scan_probe(mvm,vif,&req->ies,&sec_part->preq);
1816+
iwl_mvm_build_unified_scan_probe(mvm,vif,&req->ies,&sec_part->preq,
1817+
req->req.flags&NL80211_SCAN_FLAG_RANDOM_ADDR ?
1818+
req->req.mac_addr :NULL,
1819+
req->req.mac_addr_mask);
18001820

18011821
iwl_mvm_scan_fill_ssids(sec_part->direct_scan,req->req.ssids,
18021822
req->req.n_ssids,0);
@@ -1901,7 +1921,10 @@ int iwl_mvm_sched_scan_umac(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
19011921

19021922
sec_part->delay=0;
19031923

1904-
iwl_mvm_build_unified_scan_probe(mvm,vif,ies,&sec_part->preq);
1924+
iwl_mvm_build_unified_scan_probe(mvm,vif,ies,&sec_part->preq,
1925+
req->flags&NL80211_SCAN_FLAG_RANDOM_ADDR ?
1926+
req->mac_addr :NULL,
1927+
req->mac_addr_mask);
19051928

19061929
ret=iwl_mvm_send_cmd(mvm,&hcmd);
19071930
if (!ret) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2026 Movatter.jp