From ac2be14ac29aadc7b83fa86cc9ff37feb7c2b5f1 Mon Sep 17 00:00:00 2001 From: Abhishek Singh Date: Thu, 3 Dec 2015 16:16:25 +0530 Subject: [PATCH] qcacld-3.0: Update the status code in Re/assoc rsp for failure qcacld-2.0 to qcacld-3.0 propagation If deauth is received just after Assoc rsp from AP in addSTA response Re/assoc confirm is sent with status failure. But protStatusCode in assoc confirm is not updated and thus the pRoamInfo->reasonCode may have garbage value. In case of Wep connection failure reason code, pRoamInfo->reasonCode, is sent to the supplicant in connect result. Now if pRoamInfo->reasonCode is 0 supplicant receives connection success though connection have actually failed. To avoid this update protStatusCode, before sending Re/assoc failure. Also properly derive if connection is WEP from roamProfile before clearing it. CRs-Fixed: 926572 Change-Id: I5ae0832d37746be16696f521bddd5b67307b1ee4 --- core/hdd/src/wlan_hdd_assoc.c | 38 ++++++++++++------- .../src/pe/lim/lim_process_mlm_rsp_messages.c | 4 ++ 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/core/hdd/src/wlan_hdd_assoc.c b/core/hdd/src/wlan_hdd_assoc.c index e65ecd644d11..0c87577ea7fd 100644 --- a/core/hdd/src/wlan_hdd_assoc.c +++ b/core/hdd/src/wlan_hdd_assoc.c @@ -2053,7 +2053,7 @@ defined(FEATURE_WLAN_LFR) hddLog(LOG1, FL("sending connect indication to nl80211:for bssid " MAC_ADDRESS_STR - " reason:%d and Status:%d"), + " result:%d and Status:%d"), MAC_ADDR_ARRAY (pRoamInfo->bssid.bytes), roamResult, roamStatus); @@ -2185,12 +2185,12 @@ defined(FEATURE_WLAN_LFR) WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); if (pRoamInfo) pr_info("wlan: connection failed with " MAC_ADDRESS_STR - " reason:%d and Status:%d\n", + " result:%d and Status:%d\n", MAC_ADDR_ARRAY(pRoamInfo->bssid.bytes), roamResult, roamStatus); else pr_info("wlan: connection failed with " MAC_ADDRESS_STR - " reason:%d and Status:%d\n", + " result:%d and Status:%d\n", MAC_ADDR_ARRAY(pWextState->req_bssId.bytes), roamResult, roamStatus); @@ -2204,19 +2204,18 @@ defined(FEATURE_WLAN_LFR) hddLog(LOGE, FL("send connect failure to nl80211: for bssid " MAC_ADDRESS_STR - " reason:%d and Status:%d "), + " result:%d and Status:%d reasoncode %d"), MAC_ADDR_ARRAY(pRoamInfo->bssid.bytes), - roamResult, roamStatus); + roamResult, roamStatus, + pRoamInfo->reasonCode); else hddLog(LOGE, FL("connect failed: for bssid " MAC_ADDRESS_STR - " reason:%d and Status:%d "), + " result:%d and Status:%d "), MAC_ADDR_ARRAY(pWextState->req_bssId.bytes), roamResult, roamStatus); - hdd_clear_roam_profile_ie(pAdapter); - /* inform association failure event to nl80211 */ if (eCSR_ROAM_RESULT_ASSOC_FAIL_CON_CHANNEL == roamResult) { @@ -2237,12 +2236,22 @@ defined(FEATURE_WLAN_LFR) eCsrAuthType authType = pWextState->roamProfile.AuthType. authType[0]; + eCsrEncryptionType encryption_type = + pWextState->roamProfile. + EncryptionType.encryptionType[0]; bool isWep = + (((authType == + eCSR_AUTH_TYPE_OPEN_SYSTEM) || (authType == - eCSR_AUTH_TYPE_OPEN_SYSTEM) - || (authType == - eCSR_AUTH_TYPE_SHARED_KEY); - + eCSR_AUTH_TYPE_SHARED_KEY)) && + ((encryption_type == + eCSR_ENCRYPT_TYPE_WEP40) || + (encryption_type == + eCSR_ENCRYPT_TYPE_WEP104) || + (encryption_type == + eCSR_ENCRYPT_TYPE_WEP40_STATICKEY) || + (encryption_type == + eCSR_ENCRYPT_TYPE_WEP104_STATICKEY))); /* * In case of OPEN-WEP or SHARED-WEP * authentication, send exact protocol @@ -2253,7 +2262,9 @@ defined(FEATURE_WLAN_LFR) cfg80211_connect_result(dev, pRoamInfo->bssid.bytes, NULL, 0, NULL, 0, - isWep ? pRoamInfo->reasonCode : + (isWep && + pRoamInfo->reasonCode) ? + pRoamInfo->reasonCode : WLAN_STATUS_UNSPECIFIED_FAILURE, GFP_KERNEL); } else @@ -2263,6 +2274,7 @@ defined(FEATURE_WLAN_LFR) WLAN_STATUS_UNSPECIFIED_FAILURE, GFP_KERNEL); } + hdd_clear_roam_profile_ie(pAdapter); } if (pRoamInfo) { diff --git a/core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c b/core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c index 41282b7fab64..0fe37fe6da02 100644 --- a/core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c +++ b/core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c @@ -1722,6 +1722,8 @@ void lim_process_sta_mlm_add_sta_rsp(tpAniSirGlobal mac_ctx, */ mlm_assoc_cnf.resultCode = eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA; + mlm_assoc_cnf.protStatusCode = + eSIR_MAC_UNSPEC_FAILURE_STATUS; session_entry->staId = add_sta_params->staIdx; goto end; } @@ -1805,6 +1807,7 @@ void lim_process_sta_mlm_add_sta_rsp(tpAniSirGlobal mac_ctx, else mlm_assoc_cnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED; + mlm_assoc_cnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; } end: if (NULL != msg->bodyptr) { @@ -3044,6 +3047,7 @@ lim_process_sta_mlm_add_bss_rsp(tpAniSirGlobal mac_ctx, } else { lim_log(mac_ctx, LOGP, FL("SessionId:%d ADD_BSS failed!"), session_entry->peSessionId); + mlm_assoc_cnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; /* Return Assoc confirm to SME with failure */ if (eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE == session_entry->limMlmState)