Jelajahi Sumber

qcacmn: Enable scan mac randomization if user cfg is set

Enable scan randomization only if gEnableMacAddrSpoof
configuration is enabled

Change-Id: I1b9accb7fe1049ee6c5dda2a4f5920c0908196ff
CRs-Fixed: 2104796
Kiran Kumar Lokere 7 tahun lalu
induk
melakukan
584e6617ca

+ 5 - 3
os_if/linux/scan/src/wlan_cfg80211_scan.c

@@ -81,6 +81,7 @@ static void wlan_fill_scan_rand_attrs(struct wlan_objmgr_vdev *vdev,
 				      uint8_t *addr,
 				      uint8_t *mask)
 {
+	*randomize = false;
 	if (!(flags & NL80211_SCAN_FLAG_RANDOM_ADDR))
 		return;
 
@@ -531,8 +532,8 @@ int wlan_cfg80211_sched_scan_start(struct wlan_objmgr_pdev *pdev,
 	cfg80211_notice("Number of hidden networks being Configured = %d",
 		  request->n_ssids);
 
-	wlan_pno_scan_rand_attr(vdev, request, req);
-
+	if (req->scan_random.randomize)
+		wlan_pno_scan_rand_attr(vdev, request, req);
 	/*
 	 * Before Kernel 4.4
 	 *   Driver gets only one time interval which is hard coded in
@@ -1314,7 +1315,8 @@ int wlan_cfg80211_scan(struct wlan_objmgr_pdev *pdev,
 	}
 
 	if (!is_p2p_scan) {
-		wlan_scan_rand_attrs(vdev, request, req);
+		if (req->scan_req.scan_random.randomize)
+			wlan_scan_rand_attrs(vdev, request, req);
 		if (ucfg_ie_whitelist_enabled(psoc, vdev) &&
 		    ucfg_copy_ie_whitelist_attrs(psoc,
 					&req->scan_req.ie_whitelist))

+ 2 - 0
umac/scan/core/src/wlan_scan_main.h

@@ -233,6 +233,7 @@ struct pno_def_config {
  *      its RSSI is lower by select_5gh_margin dbm than 2.4G AP.
  *      applicable if prefer_5ghz is set.
  * @is_bssid_hint_priority: True if bssid_hint is given priority
+ * @enable_mac_spoofing: enable mac address spoof in scan
  * @bss_prefer_val: bss prefer value for the RSSI category
  * @rssi_cat: RSSI category
  * @max_bss_per_pdev: maximum number of bss entries to be maintained per pdev
@@ -299,6 +300,7 @@ struct scan_default_params {
 	uint32_t scan_cache_aging_time;
 	uint32_t prefer_5ghz;
 	uint32_t select_5ghz_margin;
+	bool enable_mac_spoofing;
 	bool is_bssid_hint_priority;
 	uint32_t usr_cfg_probe_rpt_time;
 	uint32_t usr_cfg_num_probes;

+ 2 - 0
umac/scan/dispatcher/inc/wlan_scan_public_structs.h

@@ -1092,6 +1092,7 @@ struct pno_user_cfg {
  * @pno_cfg: Pno related config params
  * @ie_whitelist: probe req IE whitelist attrs
  * @is_bssid_hint_priority: True if bssid_hint is priority
+ * @enable_mac_spoofing: enable mac address spoof in scan
  */
 struct scan_user_cfg {
 	uint32_t active_dwell;
@@ -1113,6 +1114,7 @@ struct scan_user_cfg {
 	uint32_t usr_cfg_probe_rpt_time;
 	uint32_t usr_cfg_num_probes;
 	bool is_bssid_hint_priority;
+	bool enable_mac_spoofing;
 };
 
 /**

+ 2 - 0
umac/scan/dispatcher/src/wlan_scan_ucfg_api.c

@@ -992,6 +992,7 @@ ucfg_scan_init_default_params(struct wlan_objmgr_vdev *vdev,
 		def->adaptive_dwell_time_mode;
 	req->scan_req.scan_flags = def->scan_flags;
 	req->scan_req.scan_events = def->scan_events;
+	req->scan_req.scan_random.randomize = def->enable_mac_spoofing;
 	ucfg_scan_req_update_params(vdev, req);
 
 	return QDF_STATUS_SUCCESS;
@@ -1244,6 +1245,7 @@ QDF_STATUS ucfg_scan_update_user_config(struct wlan_objmgr_psoc *psoc,
 	scan_def->usr_cfg_probe_rpt_time = scan_cfg->usr_cfg_probe_rpt_time;
 	scan_def->usr_cfg_num_probes = scan_cfg->usr_cfg_num_probes;
 	scan_def->is_bssid_hint_priority = scan_cfg->is_bssid_hint_priority;
+	scan_def->enable_mac_spoofing = scan_cfg->enable_mac_spoofing;
 
 	ucfg_scan_assign_rssi_category(scan_def,
 			scan_cfg->scan_bucket_threshold,