wlan: Update gEnableMacAddrSpoof ini parameter
Added support for mac spoofing of firmware initiated scans only.
gEnableMacAddrSpoof can now take the following values:
0 -> disable mac spoofing
1 -> Enable mac spoofing for host and firmware scans
2 -> Enable mac spoofing for firmware scans only (disabled in host scans)
Change-Id: Ieeb407cb6c08695a73fafe9bef08813b86ac4a0a
CRs-Fixed: 930151
diff --git a/CORE/HDD/inc/wlan_hdd_cfg.h b/CORE/HDD/inc/wlan_hdd_cfg.h
index 2a4dfa4..fac1dca 100644
--- a/CORE/HDD/inc/wlan_hdd_cfg.h
+++ b/CORE/HDD/inc/wlan_hdd_cfg.h
@@ -2359,10 +2359,15 @@
#define CFG_ENABLE_DEAUTH_BEFORE_CONNECTION_MAX (1)
#define CFG_ENABLE_DEAUTH_BEFORE_CONNECTION_DEFAULT (0)
+/* gEnableMacAddrSpoof = 0 => disable mac spoofing
+ = 1 => enable mac spoofing in both HOST and FW
+ = 2 => enable mac spoofing in FW and
+ disable mac spoofing in HOST
+ */
#define CFG_ENABLE_MAC_ADDR_SPOOFING "gEnableMacAddrSpoof"
#define CFG_ENABLE_MAC_ADDR_SPOOFING_MIN (0)
-#define CFG_ENABLE_MAC_ADDR_SPOOFING_MAX (1)
-#define CFG_ENABLE_MAC_ADDR_SPOOFING_DEFAULT (1)
+#define CFG_ENABLE_MAC_ADDR_SPOOFING_MAX (2)
+#define CFG_ENABLE_MAC_ADDR_SPOOFING_DEFAULT (0)
/* Disable Mac Spoof for p2p Scan */
#define CFG_DISABLE_P2P_MAC_ADDR_SPOOFING "gDisableP2PMacAddrSpoof"
@@ -3057,7 +3062,7 @@
#endif
v_U32_t deferImpsTime;
v_BOOL_t sendDeauthBeforeCon;
- v_BOOL_t enableMacSpoofing;
+ v_U8_t enableMacSpoofing;
v_BOOL_t disableP2PMacSpoofing;
v_BOOL_t enableFatalEvent;
v_BOOL_t enableMgmtLogging;
diff --git a/CORE/HDD/src/wlan_hdd_cfg.c b/CORE/HDD/src/wlan_hdd_cfg.c
index b324823..fae3dd1 100644
--- a/CORE/HDD/src/wlan_hdd_cfg.c
+++ b/CORE/HDD/src/wlan_hdd_cfg.c
@@ -5454,6 +5454,15 @@
fStatus = FALSE;
hddLog(LOGE, "Could not pass on WNI_CFG_ACTIVE_PASSIVE_CON ");
}
+
+ if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_ENABLE_MAC_ADDR_SPOOFING,
+ pConfig->enableMacSpoofing, NULL,
+ eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
+ {
+ fStatus = FALSE;
+ hddLog(LOGE, "Could not pass on WNI_CFG_ENABLE_MAC_ADDR_SPOOFING ");
+ }
+
return fStatus;
}
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 9c5642c..1d43e6d 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -173,6 +173,14 @@
*/
#define EXTTDLS_EVENT_BUF_SIZE 4096
+/*
+ * Values for Mac spoofing feature
+ *
+ */
+#define MAC_ADDR_SPOOFING_FW_HOST_DISABLE 0
+#define MAC_ADDR_SPOOFING_FW_HOST_ENABLE 1
+#define MAC_ADDR_SPOOFING_FW_ENABLE_HOST_DISABLE 2
+
static const u32 hdd_cipher_suites[] =
{
WLAN_CIPHER_SUITE_WEP40,
@@ -5053,7 +5061,7 @@
if (0 != wlan_hdd_validate_context(pHddCtx)){
return -EINVAL;
}
- if (FALSE == pHddCtx->cfg_ini->enableMacSpoofing) {
+ if (0 == pHddCtx->cfg_ini->enableMacSpoofing) {
hddLog(VOS_TRACE_LEVEL_INFO, FL("MAC_SPOOFED_SCAN disabled in ini"));
return -ENOTSUPP;
}
@@ -12617,7 +12625,9 @@
cfg80211_scan_done(req, aborted);
complete(&pScanInfo->abortscan_event_var);
- if (pHddCtx->spoofMacAddr.isEnabled || pHddCtx->spoofMacAddr.isReqDeferred) {
+ if ((pHddCtx->cfg_ini->enableMacSpoofing == MAC_ADDR_SPOOFING_FW_HOST_ENABLE
+ ) && (pHddCtx->spoofMacAddr.isEnabled
+ || pHddCtx->spoofMacAddr.isReqDeferred)) {
/* Generate new random mac addr for next scan */
hddLog(VOS_TRACE_LEVEL_INFO, "scan completed - generate new spoof mac addr");
hdd_processSpoofMacAddrRequest(pHddCtx);
@@ -13183,7 +13193,8 @@
scanRequest.minChnTime, scanRequest.maxChnTime,
scanRequest.p2pSearch, scanRequest.skipDfsChnlInP2pSearch);
- if (pHddCtx->spoofMacAddr.isEnabled)
+ if (pHddCtx->spoofMacAddr.isEnabled &&
+ pHddCtx->cfg_ini->enableMacSpoofing == 1)
{
hddLog(VOS_TRACE_LEVEL_INFO,
"%s: MAC Spoofing enabled for current scan", __func__);