summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwadesong <wadesong@codeaurora.org>2018-06-29 18:51:52 +0800
committernshrivas <nshrivas@codeaurora.org>2018-07-03 06:28:33 -0700
commit69d7ddaa3caf9f83075b3c3855205154dd962d0e (patch)
tree22e048ae3530de04fc47880f76e4fd9adccf2956
parent7d61fdfe0f092974fe5ea4b547620bcc14d8cad4 (diff)
qcacld-3.0: Limit concurrency of STA(WAPI)
When STA role is coexisting with other sessions(P2P, SAP or IBSS), WAPI encryption mode is not allowed. Add a new API to check if the connection/start request should be rejected when: 1) A STA with WAPI encryption is to be connected while there is at least one concurrent session already running. 2) A new session is to be started while there is already a STA connection with WAPI encryption enabled. Change-Id: Id3cc90a63a1b502a3a0783ebbc1af33f96620559 CRs-Fixed: 2271280
-rw-r--r--core/cds/inc/cds_concurrency.h17
-rw-r--r--core/cds/src/cds_concurrency.c47
-rw-r--r--core/hdd/src/wlan_hdd_cfg80211.c40
3 files changed, 89 insertions, 15 deletions
diff --git a/core/cds/inc/cds_concurrency.h b/core/cds/inc/cds_concurrency.h
index a514ebead39d..b81dc61d702f 100644
--- a/core/cds/inc/cds_concurrency.h
+++ b/core/cds/inc/cds_concurrency.h
@@ -751,6 +751,23 @@ bool cds_is_any_nondfs_chnl_present(uint8_t *channel);
bool cds_is_any_dfs_beaconing_session_present(uint8_t *channel);
bool cds_allow_concurrency(enum cds_con_mode mode,
uint8_t channel, enum hw_mode_bandwidth bw);
+
+/**
+ * cds_check_privacy_with_concurrency() - privacy/concurrency checker
+ *
+ * This function checks the new device mode of the current adapter against its
+ * privacy settings and concurrency settings to see if there are any conflicts.
+ *
+ * Return: true if all checkings are passed, false if any conflict detected
+ */
+#ifdef FEATURE_WLAN_WAPI
+bool cds_check_privacy_with_concurrency(void);
+#else
+static inline bool cds_check_privacy_with_concurrency(void)
+{
+ return true;
+}
+#endif
enum cds_conc_priority_mode cds_get_first_connection_pcl_table_index(void);
enum cds_one_connection_mode cds_get_second_connection_pcl_table_index(void);
enum cds_two_connection_mode cds_get_third_connection_pcl_table_index(void);
diff --git a/core/cds/src/cds_concurrency.c b/core/cds/src/cds_concurrency.c
index b676d42e9d17..1a35d567b371 100644
--- a/core/cds/src/cds_concurrency.c
+++ b/core/cds/src/cds_concurrency.c
@@ -6285,6 +6285,11 @@ bool cds_allow_concurrency(enum cds_con_mode mode,
goto done;
}
+ if (!cds_check_privacy_with_concurrency()) {
+ hdd_err("Privacy setting not allowed with current concurrency setting!");
+ goto done;
+ }
+
status = true;
done:
@@ -11117,3 +11122,45 @@ bool cds_is_sta_sap_scc(uint8_t sap_ch)
return is_scc;
}
+#ifdef FEATURE_WLAN_WAPI
+bool cds_check_privacy_with_concurrency(void)
+{
+ bool ret = true;
+ uint32_t con_count;
+ hdd_adapter_t *adapter;
+ hdd_context_t *hdd_ctx;
+ hdd_adapter_list_node_t *adapter_node, *next;
+ QDF_STATUS status;
+ bool wapi_sta_present = false;
+
+ hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
+ if (NULL == hdd_ctx) {
+ cds_err("HDD context is NULL");
+ return false;
+ }
+
+ status = hdd_get_front_adapter(hdd_ctx, &adapter_node);
+ while (NULL != adapter_node && QDF_STATUS_SUCCESS == status) {
+ adapter = adapter_node->pAdapter;
+ if (adapter &&
+ (QDF_STA_MODE == adapter->device_mode) &&
+ adapter->wapi_info.nWapiMode &&
+ (adapter->wapi_info.wapiAuthMode != WAPI_AUTH_MODE_OPEN)) {
+ wapi_sta_present = true;
+ break;
+ }
+ status = hdd_get_next_adapter(hdd_ctx, adapter_node, &next);
+ adapter_node = next;
+ }
+
+ con_count = cds_get_connection_count();
+ cds_debug("No. of concurrent connections: %d", con_count);
+
+ if (wapi_sta_present && con_count) {
+ cds_err("STA with WAPI not allowed when concurrent session(s) exist!");
+ ret = false;
+ }
+
+ return ret;
+}
+#endif
diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c
index ad85a85b803e..c6012b50d73c 100644
--- a/core/hdd/src/wlan_hdd_cfg80211.c
+++ b/core/hdd/src/wlan_hdd_cfg80211.c
@@ -14521,6 +14521,17 @@ static int __wlan_hdd_cfg80211_change_iface(struct wiphy *wiphy,
return -EINVAL;
}
+ pConfig = pHddCtx->config;
+ wdev = ndev->ieee80211_ptr;
+
+ /* Reset the current device mode bit mask */
+ cds_clear_concurrency_mode(pAdapter->device_mode);
+
+ /*
+ * must be called after cds_clear_concurrency_mode's invocation so the
+ * current adapter's old device mode mapping is removed from our
+ * internal records.
+ */
if (!cds_allow_concurrency(
wlan_hdd_convert_nl_iftype_to_hdd_type(type),
0, HW_MODE_20_MHZ)) {
@@ -14528,12 +14539,6 @@ static int __wlan_hdd_cfg80211_change_iface(struct wiphy *wiphy,
return -EINVAL;
}
- pConfig = pHddCtx->config;
- wdev = ndev->ieee80211_ptr;
-
- /* Reset the current device mode bit mask */
- cds_clear_concurrency_mode(pAdapter->device_mode);
-
hdd_update_tdls_ct_and_teardown_links(pHddCtx);
if ((pAdapter->device_mode == QDF_STA_MODE) ||
(pAdapter->device_mode == QDF_P2P_CLIENT_MODE) ||
@@ -18379,7 +18384,20 @@ static int __wlan_hdd_cfg80211_connect(struct wiphy *wiphy,
return -EALREADY;
}
- /* Check for max concurrent connections after doing disconnect if any */
+ /*initialise security parameters */
+ status = wlan_hdd_cfg80211_set_privacy(pAdapter, req);
+
+ if (0 > status) {
+ hdd_err("Failed to set security params");
+ return status;
+ }
+
+ /*
+ * Check for max concurrent connections after doing disconnect if any,
+ * must be called after the invocation of wlan_hdd_cfg80211_set_privacy
+ * so privacy is already set for the current adapter before it's
+ * checked against concurrency.
+ */
if (req->channel) {
if (!cds_allow_concurrency(
cds_convert_device_mode_to_qdf_type(
@@ -18397,14 +18415,6 @@ static int __wlan_hdd_cfg80211_connect(struct wiphy *wiphy,
}
}
- /*initialise security parameters */
- status = wlan_hdd_cfg80211_set_privacy(pAdapter, req);
-
- if (0 > status) {
- hdd_err("Failed to set security params");
- return status;
- }
-
if (req->channel)
channel = req->channel->hw_value;
else