diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index d1291489e49a..9ef26f7ab495 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -681,34 +681,41 @@ struct hdd_mon_set_ch_info { eCsrPhyMode phy_mode; }; +/** + * struct hdd_station_ctx -- STA-specific information + * @WextState: wireless extensions state + * @wpa_versions: bitmap of supported WPA versions + * @conn_info: current connection information + * @roam_info: current roaming information + * @ft_carrier_on: is carrier on + * @ibss_sta_generation: current ibss generation. Incremented whenever + * ibss New peer joins and departs the network + * @ibss_enc_key_installed: is the ibss wep/wpa-none encryptions key + * installed? + * @ibss_enc_key: current ibss wep/wpa-none encryption key (if + * @ibss_enc_key_installed is %true) + * @ibss_peer_info: information about the ibss peer + * @hdd_ReassocScenario: is station in the middle of reassociation? + * @staDebugState: STA context debug variable + * @broadcast_staid: STA ID assigned for broadcast frames + * @ch_info: monitor mode channel information + * @ndp_ctx: NAN data path context + * @ap_supports_immediate_power_save: Does the current AP allow our STA + * to immediately go into power save? + */ struct hdd_station_ctx { - /* Handle to the Wireless Extension State */ struct hdd_wext_state WextState; - - /* Connection information*/ + enum nl80211_wpa_versions wpa_versions; struct hdd_connection_info conn_info; - struct hdd_roaming_info roam_info; - int ft_carrier_on; - - /* Increment whenever ibss New peer joins and departs the network */ int ibss_sta_generation; - - /* Indication of wep/wpa-none keys installation */ bool ibss_enc_key_installed; - - /* Save the wep/wpa-none keys */ tCsrRoamSetKey ibss_enc_key; tSirPeerInfoRspParams ibss_peer_info; - bool hdd_ReassocScenario; - - /* STA ctx debug variables */ int staDebugState; - uint8_t broadcast_staid; - struct hdd_mon_set_ch_info ch_info; #if defined(WLAN_FEATURE_NAN_DATAPATH) && !defined(WLAN_FEATURE_NAN_CONVERGENCE) struct nan_datapath_ctx ndp_ctx; diff --git a/core/hdd/inc/wlan_hdd_wext.h b/core/hdd/inc/wlan_hdd_wext.h index 6aa9f7f68224..481b6796e9bf 100644 --- a/core/hdd/inc/wlan_hdd_wext.h +++ b/core/hdd/inc/wlan_hdd_wext.h @@ -210,9 +210,6 @@ struct hdd_wext_state { /** BSSID to which connect request is received */ struct qdf_mac_addr req_bssId; - /** wpa version WPA/WPA2/None*/ - int32_t wpaVersion; - /**WPA or RSN IE*/ uint8_t WPARSNIE[MAX_WPA_RSN_IE_LEN]; diff --git a/core/hdd/src/wlan_hdd_assoc.c b/core/hdd/src/wlan_hdd_assoc.c index 1983675b101b..27a8401da0f2 100644 --- a/core/hdd/src/wlan_hdd_assoc.c +++ b/core/hdd/src/wlan_hdd_assoc.c @@ -5156,11 +5156,11 @@ int hdd_set_csr_auth_type(struct hdd_adapter *adapter, case eCSR_AUTH_TYPE_CCKM_WPA: case eCSR_AUTH_TYPE_CCKM_RSN: #endif - if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_DISABLED) { + if (!sta_ctx->wpa_versions) { pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM; - } else if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_WPA) { + } else if (sta_ctx->wpa_versions & NL80211_WPA_VERSION_1) { #ifdef FEATURE_WLAN_ESE if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_WPA) && @@ -5190,7 +5190,7 @@ int hdd_set_csr_auth_type(struct hdd_adapter *adapter, eCSR_AUTH_TYPE_WPA_NONE; } } - if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_WPA2) { + if (sta_ctx->wpa_versions & NL80211_WPA_VERSION_2) { #ifdef FEATURE_WLAN_ESE if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_RSN) && ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) @@ -5292,6 +5292,7 @@ static int __iw_set_essid(struct net_device *dev, struct hdd_wext_state *pWextState; struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); struct hdd_context *hdd_ctx; + struct hdd_station_ctx *sta_ctx; uint32_t roamId; tCsrRoamProfile *pRoamProfile; eCsrAuthType RSNAuthType; @@ -5318,6 +5319,7 @@ static int __iw_set_essid(struct net_device *dev, return -EINVAL; } + sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(adapter); if (pWextState->mTKIPCounterMeasures == TKIP_COUNTER_MEASURE_STARTED) { @@ -5358,8 +5360,7 @@ static int __iw_set_essid(struct net_device *dev, sizeof(pWextState->roamProfile.SSIDs.SSIDList->SSID.ssId)); qdf_mem_copy((void *)(pWextState->roamProfile.SSIDs.SSIDList->SSID. ssId), extra, wrqu->essid.length); - if (IW_AUTH_WPA_VERSION_WPA == pWextState->wpaVersion - || IW_AUTH_WPA_VERSION_WPA2 == pWextState->wpaVersion) { + if (sta_ctx->wpa_versions) { /* set gen ie */ hdd_set_genie_to_csr(adapter, &RSNAuthType); @@ -5576,6 +5577,18 @@ int iw_get_essid(struct net_device *dev, return ret; } +static enum nl80211_wpa_versions iw2nl_wpa_version(int iw_value) +{ + enum nl80211_wpa_versions nl_value = 0; + + if (iw_value & IW_AUTH_WPA_VERSION_WPA) + nl_value |= NL80211_WPA_VERSION_1; + if (iw_value & IW_AUTH_WPA_VERSION_WPA2) + nl_value |= NL80211_WPA_VERSION_2; + + return nl_value; +} + /** * __iw_set_auth() - * This function sets the auth type received from the wpa_supplicant @@ -5613,7 +5626,7 @@ static int __iw_set_auth(struct net_device *dev, struct iw_request_info *info, switch (wrqu->param.flags & IW_AUTH_INDEX) { case IW_AUTH_WPA_VERSION: - pWextState->wpaVersion = wrqu->param.value; + sta_ctx->wpa_versions = iw2nl_wpa_version(wrqu->param.value); break; case IW_AUTH_CIPHER_PAIRWISE: diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 5f55d71657f1..aaa357c59785 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -15478,8 +15478,7 @@ static int wlan_hdd_cfg80211_connect_start(struct hdd_adapter *adapter, pRoamProfile->SSIDs.SSIDList->SSID.ssId, operatingChannel); - if ((IW_AUTH_WPA_VERSION_WPA == pWextState->wpaVersion) || - (IW_AUTH_WPA_VERSION_WPA2 == pWextState->wpaVersion)) { + if (hdd_sta_ctx->wpa_versions) { hdd_set_genie_to_csr(adapter, &RSNAuthType); hdd_set_csr_auth_type(adapter, RSNAuthType); } @@ -16497,20 +16496,13 @@ static int wlan_hdd_cfg80211_set_privacy(struct hdd_adapter *adapter, int status = 0; struct hdd_wext_state *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(adapter); + struct hdd_station_ctx *sta_ctx; ENTER(); - /*set wpa version */ - pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; - - if (req->crypto.wpa_versions) { - if (NL80211_WPA_VERSION_1 == req->crypto.wpa_versions) - pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA; - else if (NL80211_WPA_VERSION_2 == req->crypto.wpa_versions) - pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2; - } - - hdd_debug("set wpa version to %d", pWextState->wpaVersion); + sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); + sta_ctx->wpa_versions = req->crypto.wpa_versions; + hdd_debug("set wpa version to %d", sta_ctx->wpa_versions); /*set authentication type */ status = wlan_hdd_cfg80211_set_auth_type(adapter, req->auth_type); @@ -17322,14 +17314,14 @@ static int wlan_hdd_cfg80211_set_privacy_ibss(struct hdd_adapter *adapter, ENTER(); - pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; + sta_ctx->wpa_versions = 0; qdf_mem_zero(&sta_ctx->ibss_enc_key, sizeof(tCsrRoamSetKey)); sta_ctx->ibss_enc_key_installed = 0; if (params->ie_len && (NULL != params->ie)) { if (wlan_get_ie_ptr_from_eid(WLAN_EID_RSN, params->ie, params->ie_len)) { - pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2; + sta_ctx->wpa_versions = NL80211_WPA_VERSION_2; encryptionType = eCSR_ENCRYPT_TYPE_AES; } else if (hdd_is_wpaie_present(params->ie, params->ie_len)) { tDot11fIEWPA dot11WPAIE; @@ -17340,8 +17332,7 @@ static int wlan_hdd_cfg80211_set_privacy_ibss(struct hdd_adapter *adapter, ie = wlan_get_ie_ptr_from_eid(DOT11F_EID_WPA, params->ie, params->ie_len); if (NULL != ie) { - pWextState->wpaVersion = - IW_AUTH_WPA_VERSION_WPA; + sta_ctx->wpa_versions = NL80211_WPA_VERSION_1; /* Unpack the WPA IE * Skip past the EID byte and length byte * and four byte WiFi OUI diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c index 726b2cca9cd5..8744924d5031 100644 --- a/core/hdd/src/wlan_hdd_wext.c +++ b/core/hdd/src/wlan_hdd_wext.c @@ -6816,7 +6816,7 @@ static int __iw_set_encode(struct net_device *dev, struct iw_request_info *info, CSR_MAX_NUM_KEY); } sta_ctx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; - pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; + sta_ctx->wpa_versions = 0; pWextState->roamProfile.EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE; pWextState->roamProfile.mcEncryptionType.encryptionType[0] = @@ -14575,7 +14575,7 @@ static int hdd_set_wext(struct hdd_adapter *adapter) pwextBuf->roamProfile.AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM; pwextBuf->roamProfile.phyMode = eCSR_DOT11_MODE_AUTO; - pwextBuf->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; + sta_ctx->wpa_versions = 0; /*Set the default scan mode */ adapter->scan_info.scan_mode = eSIR_ACTIVE_SCAN;