diff options
| author | bings <bings@codeaurora.org> | 2019-02-18 11:06:08 +0800 |
|---|---|---|
| committer | bings <bings@codeaurora.org> | 2019-02-27 14:22:43 +0800 |
| commit | d4c19205d8ba48cf6f9e47afa86a93098f8e9dc5 (patch) | |
| tree | d66aa4ff2756376a130106bc352cd9844556714d | |
| parent | 985bd570ab37743ca7ac5239badb06225db1bbdc (diff) | |
qcacld-2.0: Trigger/handle SAE using cfg80211
propagation from qcacld-3.0 to qcacld-2.0
Add changes to trigger SAE using cfg80211 API's. Also, add
changes to handle SAE status that comes via cfg80211 ops
Change-Id: Ie113f84d4fdc927fff26b13b0e0551b92b22fd5d
CRs-Fixed: 2405939
| -rw-r--r-- | CORE/HDD/src/wlan_hdd_assoc.c | 54 | ||||
| -rw-r--r-- | CORE/HDD/src/wlan_hdd_cfg80211.c | 66 |
2 files changed, 119 insertions, 1 deletions
diff --git a/CORE/HDD/src/wlan_hdd_assoc.c b/CORE/HDD/src/wlan_hdd_assoc.c index 122a6aec9476..638c203f6fd7 100644 --- a/CORE/HDD/src/wlan_hdd_assoc.c +++ b/CORE/HDD/src/wlan_hdd_assoc.c @@ -149,6 +149,56 @@ static eHalStatus hdd_RoamSetKeyCompleteHandler( hdd_adapter_t *pAdapter, eRoamCmdStatus roamStatus, eCsrRoamResult roamResult ); +#if defined(WLAN_FEATURE_SAE) && \ + defined(CFG80211_EXTERNAL_AUTH_SUPPORT) +/** + * wlan_hdd_sae_callback() - Sends SAE info to supplicant + * @adapter: pointer adapter context + * @roam_info: pointer to roam info + * + * This API is used to send required SAE info to trigger SAE in supplicant. + * + * Return: None + */ +static void wlan_hdd_sae_callback(hdd_adapter_t *adapter, + tCsrRoamInfo *roam_info) +{ + hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); + int flags; + struct sir_sae_info *sae_info = roam_info->sae_info; + struct cfg80211_external_auth_params params = {0}; + + if (wlan_hdd_validate_context(hdd_ctx)) + return; + + if (!sae_info) { + hddLog(LOGE, FL("SAE info in NULL")); + return; + } + + flags = vos_get_gfp_flags(); + + params.key_mgmt_suite = 0x00; + params.key_mgmt_suite |= 0x0F << 8; + params.key_mgmt_suite |= 0xAC << 16; + params.key_mgmt_suite |= 0x8 << 24; + + params.action = NL80211_EXTERNAL_AUTH_START; + vos_mem_copy(params.bssid, sae_info->peer_mac_addr.bytes, + VOS_MAC_ADDR_SIZE); + vos_mem_copy(params.ssid.ssid, sae_info->ssid.ssId, + sae_info->ssid.length); + params.ssid.ssid_len = sae_info->ssid.length; + + cfg80211_external_auth_request(adapter->dev, ¶ms, flags); + hddLog(LOG1, FL("SAE: sent cmd")); +} +#else +static void wlan_hdd_sae_callback(hdd_adapter_t *adapter, + tCsrRoamInfo *roam_info) +{ } +#endif + static v_VOID_t hdd_connSetAuthenticated(hdd_adapter_t *pAdapter, v_U8_t authState) { @@ -4977,6 +5027,10 @@ hdd_smeRoamCallback(void *pContext, tCsrRoamInfo *pRoamInfo, tANI_U32 roamId, hdd_ndp_event_handler(pAdapter, pRoamInfo, roamId, roamStatus, roamResult ); break; + case eCSR_ROAM_SAE_COMPUTE: + if (pRoamInfo) + wlan_hdd_sae_callback(pAdapter, pRoamInfo); + break; case eCSR_ROAM_STA_CHANNEL_SWITCH: { pHddCtx = WLAN_HDD_GET_CTX(pAdapter); diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c index 1b6373dec642..388a7517b109 100644 --- a/CORE/HDD/src/wlan_hdd_cfg80211.c +++ b/CORE/HDD/src/wlan_hdd_cfg80211.c @@ -16195,7 +16195,8 @@ hdd_wiphy_set_max_sched_scans(struct wiphy *wiphy, uint8_t max_scans) } #endif /* KERNEL_VERSION(4, 12, 0) */ -#ifdef WLAN_FEATURE_SAE +#if defined(WLAN_FEATURE_SAE) && \ + defined(CFG80211_EXTERNAL_AUTH_SUPPORT) /** * wlan_hdd_cfg80211_set_wiphy_sae_feature() - Indicates support of SAE feature * @wiphy: Pointer to wiphy @@ -28405,6 +28406,65 @@ static int wlan_hdd_cfg80211_flush_pmksa(struct wiphy *wiphy, } #endif +#if defined(WLAN_FEATURE_SAE) && \ + defined(CFG80211_EXTERNAL_AUTH_SUPPORT) +/** + * __wlan_hdd_cfg80211_external_auth() - Handle external auth + * @wiphy: Pointer to wireless phy + * @dev: net device + * @params: Pointer to external auth params + * + * Return: 0 on success, negative errno on failure + */ +static int +__wlan_hdd_cfg80211_external_auth(struct wiphy *wiphy, + struct net_device *dev, + struct cfg80211_external_auth_params *params) +{ + hdd_context_t *hdd_ctx = wiphy_priv(wiphy); + hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); + int ret; + + if (hdd_get_conparam() == VOS_FTM_MODE) { + hddLog(VOS_TRACE_LEVEL_ERROR, + FL("Command not allowed in FTM mode")); + return -EPERM; + } + + ret = wlan_hdd_validate_context(hdd_ctx); + if (ret) + return ret; + + hddLog(VOS_TRACE_LEVEL_DEBUG, + FL("external_auth status: %d"), params->status); + sme_handle_sae_msg(hdd_ctx->hHal, adapter->sessionId, params->status); + + return ret; +} + +/** + * wlan_hdd_cfg80211_external_auth() - Handle external auth + * @wiphy: Pointer to wireless phy + * @dev: net device + * @params: Pointer to external auth params + * + * Return: 0 on success, negative errno on failure + */ +static int +wlan_hdd_cfg80211_external_auth(struct wiphy *wiphy, + struct net_device *dev, + struct cfg80211_external_auth_params *params) +{ + int ret; + + vos_ssr_protect(__func__); + ret = __wlan_hdd_cfg80211_external_auth(wiphy, dev, params); + vos_ssr_unprotect(__func__); + + return ret; +} +#endif + #if defined(WLAN_FEATURE_VOWIFI_11R) && defined(KERNEL_SUPPORT_11R_CFG80211) static int __wlan_hdd_cfg80211_update_ft_ies(struct wiphy *wiphy, @@ -33032,4 +33092,8 @@ static struct cfg80211_ops wlan_hdd_cfg80211_ops = defined(CFG80211_ABORT_SCAN) .abort_scan = wlan_hdd_cfg80211_abort_scan, #endif +#if defined(WLAN_FEATURE_SAE) && \ + defined(CFG80211_EXTERNAL_AUTH_SUPPORT) + .external_auth = wlan_hdd_cfg80211_external_auth, +#endif }; |
