From 05b103ff39458e459c90ba5cc09998e143d797fc Mon Sep 17 00:00:00 2001 From: Amar Singhal Date: Fri, 30 Nov 2018 11:34:13 -0800 Subject: [PATCH] qcacld-3.0: Validate hostapd country code Hostapd is expected to use country code already programmed in the driver. Therefore, validate the country code sent by hostapd. Enable SAP 11d only if country code from hostapd is same as driver country code. Change-Id: I88d6603f4e696c86ffb85b798221d750f71b741b CRs-Fixed: 2359333 --- core/hdd/src/wlan_hdd_hostapd.c | 19 ++++++++----------- core/sap/src/sap_module.c | 29 ----------------------------- 2 files changed, 8 insertions(+), 40 deletions(-) diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index c23e66167925..0591ab642d60 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -4875,19 +4875,16 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter, goto error; } - pConfig->ieee80211d = 1; - qdf_mem_copy(pConfig->countryCode, &pIe[2], 3); - status = ucfg_reg_set_country(hdd_ctx->pdev, - pConfig->countryCode); - if (QDF_IS_STATUS_ERROR(status)) { - hdd_err("Failed to set country"); + if (!qdf_mem_cmp(hdd_ctx->reg.alpha2, &pIe[2], + REG_ALPHA2_LEN)) + pConfig->ieee80211d = 1; + else pConfig->ieee80211d = 0; - } - } else { - pConfig->countryCode[0] = hdd_ctx->reg.alpha2[0]; - pConfig->countryCode[1] = hdd_ctx->reg.alpha2[1]; + } else pConfig->ieee80211d = 0; - } + + pConfig->countryCode[0] = hdd_ctx->reg.alpha2[0]; + pConfig->countryCode[1] = hdd_ctx->reg.alpha2[1]; ret = wlan_hdd_sap_cfg_dfs_override(adapter); if (ret < 0) diff --git a/core/sap/src/sap_module.c b/core/sap/src/sap_module.c index f3e6fdc3fd4a..fba46d264ce2 100644 --- a/core/sap/src/sap_module.c +++ b/core/sap/src/sap_module.c @@ -525,21 +525,6 @@ wlansap_set_scan_acs_channel_params(tsap_config_t *pconfig, QDF_TRACE_ERROR(QDF_MODULE_ID_SAP, "Invalid MAC context"); return QDF_STATUS_E_FAULT; } - /* - * If concurrent session is running that is already associated - * then we just follow that sessions country info (whether - * present or not doesn't matter as we have to follow whatever - * STA session does) - */ - if ((0 == sme_get_concurrent_operation_channel(MAC_HANDLE(mac))) && - pconfig->ieee80211d) { - /* Setting the region/country information */ - status = ucfg_reg_set_country(mac->pdev, - pconfig->countryCode); - if (QDF_IS_STATUS_ERROR(status)) - QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR, - FL("Failed to set country")); - } return status; } @@ -703,20 +688,6 @@ QDF_STATUS wlansap_start_bss(struct sap_context *sap_ctx, goto fail; } - /* If concurrent session is running that is already associated - * then we just follow that sessions country info (whether - * present or not doesn't matter as we have to follow whatever - * STA session does) */ - if ((0 == sme_get_concurrent_operation_channel(MAC_HANDLE(pmac))) && - pConfig->ieee80211d) { - /* Setting the region/country information */ - qdf_status = ucfg_reg_set_country(pmac->pdev, - pConfig->countryCode); - if (QDF_IS_STATUS_ERROR(qdf_status)) - QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR, - FL("Failed to set country")); - } - /* * Copy the DFS Test Mode setting to pmac for * access in lower layers