@@ -1224,14 +1224,25 @@ static u8 *iwl_mvm_copy_and_insert_ds_elem(struct iwl_mvm *mvm, const u8 *ies,
12241224static void
12251225iwl_mvm_build_unified_scan_probe (struct iwl_mvm * mvm ,struct ieee80211_vif * vif ,
12261226struct ieee80211_scan_ies * ies ,
1227- struct iwl_scan_probe_req * preq )
1227+ struct iwl_scan_probe_req * preq ,
1228+ const u8 * mac_addr ,const u8 * mac_addr_mask )
12281229{
12291230struct ieee80211_mgmt * frame = (struct ieee80211_mgmt * )preq -> buf ;
12301231u8 * 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+
12321244frame -> frame_control = cpu_to_le16 (IEEE80211_STYPE_PROBE_REQ );
12331245eth_broadcast_addr (frame -> da );
1234- memcpy (frame -> sa ,vif -> addr ,ETH_ALEN );
12351246eth_broadcast_addr (frame -> bssid );
12361247frame -> seq_ctrl = 0 ;
12371248
@@ -1375,7 +1386,10 @@ int iwl_mvm_unified_scan_lmac(struct iwl_mvm *mvm,
13751386preq = (void * )(cmd -> data + sizeof (struct iwl_scan_channel_cfg_lmac )*
13761387mvm -> 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
13801394ret = iwl_mvm_send_cmd (mvm ,& hcmd );
13811395if (!ret ) {
@@ -1466,7 +1480,10 @@ int iwl_mvm_unified_sched_scan_lmac(struct iwl_mvm *mvm,
14661480preq = (void * )(cmd -> data + sizeof (struct iwl_scan_channel_cfg_lmac )*
14671481mvm -> 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
14711488ret = iwl_mvm_send_cmd (mvm ,& hcmd );
14721489if (!ret ) {
@@ -1796,7 +1813,10 @@ int iwl_mvm_scan_umac(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
17961813sec_part -> schedule [0 ].iter_count = 1 ;
17971814sec_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
18011821iwl_mvm_scan_fill_ssids (sec_part -> direct_scan ,req -> req .ssids ,
18021822req -> req .n_ssids ,0 );
@@ -1901,7 +1921,10 @@ int iwl_mvm_sched_scan_umac(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
19011921
19021922sec_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
19061929ret = iwl_mvm_send_cmd (mvm ,& hcmd );
19071930if (!ret ) {