summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGovind Singh <govinds@qti.qualcomm.com>2015-08-26 11:19:54 +0530
committerAnjaneedevi Kapparapu <akappa@codeaurora.org>2015-10-05 15:00:35 +0530
commit51c59033cf9af8a71baff2d8dc076d2bd031c14d (patch)
tree790022bc1d93d1c294d7b8727e57047b526513f6
parentde869be25a354558fe68d3e4db029cde45ec6df4 (diff)
qcacld-2.0: Fix STA state handling in case of WEP
Handle STA State in hdd_RoamSetKeyCompleteHandler for WEP case. In WEP case Key are set in following order. 1)Group key 2)Unicast Key In WEP case STA was moved to AUTHENTICATED prior to setting the unicast key and it was resulting in sending few un-encrypted packet. Now STA state will be moved to AUTHENTICATED after we set the unicast and group key in WEP case. Change-Id: I7471bc76b10be31c4a2dbb52286c7f808fa27306 CRs-Fixed: 906555
-rw-r--r--CORE/CLD_TXRX/TLSHIM/tl_shim.c7
-rw-r--r--CORE/HDD/inc/wlan_hdd_assoc.h6
-rw-r--r--CORE/HDD/src/wlan_hdd_assoc.c145
3 files changed, 108 insertions, 50 deletions
diff --git a/CORE/CLD_TXRX/TLSHIM/tl_shim.c b/CORE/CLD_TXRX/TLSHIM/tl_shim.c
index 98e911b66249..214d46a3d771 100644
--- a/CORE/CLD_TXRX/TLSHIM/tl_shim.c
+++ b/CORE/CLD_TXRX/TLSHIM/tl_shim.c
@@ -43,7 +43,7 @@
#include "vos_utils.h"
#include "wdi_out.h"
-#define TLSHIM_PEER_AUTHORIZE_WAIT 10
+#define TLSHIM_PEER_AUTHORIZE_WAIT 50
#define ENTER() VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO, "Enter:%s", __func__)
@@ -1635,8 +1635,11 @@ VOS_STATUS WLANTL_ChangeSTAState(void *vos_ctx, u_int8_t sta_id,
* set fix it cleanly later.
*/
/* wait for event from firmware to set the event */
- vos_wait_single_event(&tl_shim->peer_authorized_events[peer->vdev->vdev_id],
+ err = vos_wait_single_event(&tl_shim->peer_authorized_events[peer->vdev->vdev_id],
TLSHIM_PEER_AUTHORIZE_WAIT);
+ if (err != VOS_STATUS_SUCCESS)
+ TLSHIM_LOGE("%s:timeout for peer_authorized_event",
+ __func__);
wdi_in_vdev_unpause(peer->vdev,
OL_TXQ_PAUSE_REASON_PEER_UNAUTHORIZED);
#endif
diff --git a/CORE/HDD/inc/wlan_hdd_assoc.h b/CORE/HDD/inc/wlan_hdd_assoc.h
index d0cf936973f0..7a965e9cd2f8 100644
--- a/CORE/HDD/inc/wlan_hdd_assoc.h
+++ b/CORE/HDD/inc/wlan_hdd_assoc.h
@@ -115,6 +115,12 @@ typedef struct connection_info_s
/** NSS and RateFlags used for this connection */
uint8_t nss;
uint32_t rate_flags;
+
+ /* ptk installed state */
+ bool ptk_installed;
+
+ /* gtk installed state */
+ bool gtk_installed;
}connection_info_t;
/*Forward declaration of Adapter*/
diff --git a/CORE/HDD/src/wlan_hdd_assoc.c b/CORE/HDD/src/wlan_hdd_assoc.c
index e12648c8a7ff..92ce59e145e8 100644
--- a/CORE/HDD/src/wlan_hdd_assoc.c
+++ b/CORE/HDD/src/wlan_hdd_assoc.c
@@ -1420,6 +1420,66 @@ done:
kfree(rspRsnIe);
}
+/**
+ * hdd_is_roam_sync_in_progress()- Check if roam offloaded
+ *
+ * Return: roam sync status if roaming offloaded else false
+ */
+#ifdef WLAN_FEATURE_ROAM_OFFLOAD
+static inline bool hdd_is_roam_sync_in_progress(tCsrRoamInfo *roaminfo)
+{
+ return roaminfo->roamSynchInProgress;
+}
+#else
+static inline bool hdd_is_roam_sync_in_progress(tCsrRoamInfo *roaminfo)
+{
+ return false;
+}
+#endif
+
+
+/**
+ * hdd_change_sta_state_authenticated()-
+ * This function changes STA state to authenticated
+ * @adapter: pointer to the adapter structure.
+ * @roaminfo: pointer to the RoamInfo structure.
+ *
+ * This is called from hdd_RoamSetKeyCompleteHandler
+ * in context to eCSR_ROAM_SET_KEY_COMPLETE event from fw.
+ *
+ * Return: 0 on success and errno on failure
+ */
+static int hdd_change_sta_state_authenticated(hdd_adapter_t *adapter,
+ tCsrRoamInfo *roaminfo)
+{
+ int ret;
+ hdd_context_t *hddctx = WLAN_HDD_GET_CTX(adapter);
+ hdd_station_ctx_t *hddstactx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
+
+ hddLog(LOG1,
+ "Changing TL state to AUTHENTICATED for StaId= %d",
+ hddstactx->conn_info.staId[0]);
+
+ /* Connections that do not need Upper layer authentication,
+ * transition TL to 'Authenticated' state after the keys are set
+ */
+ ret = WLANTL_ChangeSTAState(hddctx->pvosContext,
+ hddstactx->conn_info.staId[0],
+ WLANTL_STA_AUTHENTICATED,
+ hdd_is_roam_sync_in_progress(roaminfo));
+ hdd_connSetAuthenticated(adapter, VOS_TRUE);
+ if (hddctx->cfg_ini->enablePowersaveOffload &&
+ ((WLAN_HDD_INFRA_STATION == adapter->device_mode) ||
+ (WLAN_HDD_P2P_CLIENT == adapter->device_mode))) {
+ sme_PsOffloadEnableDeferredPowerSave(
+ WLAN_HDD_GET_HAL_CTX(adapter),
+ adapter->sessionId,
+ hddstactx->hdd_ReassocScenario);
+ }
+
+ return ret;
+}
+
void hdd_PerformRoamSetKeyComplete(hdd_adapter_t *pAdapter)
{
eHalStatus halStatus = eHAL_STATUS_SUCCESS;
@@ -2412,8 +2472,10 @@ static eHalStatus hdd_RoamSetKeyCompleteHandler( hdd_adapter_t *pAdapter, tCsrRo
// not require upper layer authentication) we can put TL directly into 'authenticated'
// state.
VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
- "Set Key completion roamStatus =%d roamResult=%d " MAC_ADDRESS_STR,
- roamStatus, roamResult, MAC_ADDR_ARRAY(pRoamInfo->peerMac));
+ "Set Key completion roamStatus=%d roamResult=%d encryptionType=%d "
+ MAC_ADDRESS_STR, roamStatus, roamResult,
+ pHddStaCtx->conn_info.ucEncryptionType,
+ MAC_ADDR_ARRAY(pRoamInfo->peerMac));
fConnected = hdd_connGetConnectedCipherAlgo( pHddStaCtx, &connectedCipherAlgo );
if( fConnected )
@@ -2455,52 +2517,39 @@ static eHalStatus hdd_RoamSetKeyCompleteHandler( hdd_adapter_t *pAdapter, tCsrRo
* At this time we don't handle the state in detail.
* Related CR: 174048 - TL not in authenticated state
*/
- vosStatus = WLANTL_ChangeSTAState(pHddCtx->pvosContext,
- pHddStaCtx->conn_info.staId[0],
- WLANTL_STA_AUTHENTICATED,
-#ifdef WLAN_FEATURE_ROAM_OFFLOAD
- pRoamInfo->roamSynchInProgress
-#else
- VOS_FALSE
-#endif
- );
- hdd_connSetAuthenticated(pAdapter, VOS_TRUE);
- if ( ( eCSR_ROAM_RESULT_AUTHENTICATED == roamResult ) &&
- (pRoamInfo != NULL) && !pRoamInfo->fAuthRequired )
- {
- VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, "Key set "
- "for StaId= %d. Changing TL state to AUTHENTICATED",
- pHddStaCtx->conn_info.staId[ 0 ] );
-
- // Connections that do not need Upper layer authentication,
- // transition TL to 'Authenticated' state after the keys are set.
- vosStatus = WLANTL_ChangeSTAState(pHddCtx->pvosContext,
- pHddStaCtx->conn_info.staId[0],
- WLANTL_STA_AUTHENTICATED,
-#ifdef WLAN_FEATURE_ROAM_OFFLOAD
- pRoamInfo->roamSynchInProgress
-#else
- VOS_FALSE
-#endif
- );
-
- hdd_connSetAuthenticated(pAdapter, VOS_TRUE);
-
- if (pHddCtx->cfg_ini->enablePowersaveOffload &&
- ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) ||
- (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)))
- {
- sme_PsOffloadEnableDeferredPowerSave(
- WLAN_HDD_GET_HAL_CTX(pAdapter),
- pAdapter->sessionId,
- pHddStaCtx->hdd_ReassocScenario);
- }
- }
- else
- {
- vosStatus = WLANTL_STAPtkInstalled( pHddCtx->pvosContext,
- pHddStaCtx->conn_info.staId[ 0 ]);
- }
+ if (eCSR_ROAM_RESULT_AUTHENTICATED == roamResult)
+ pHddStaCtx->conn_info.gtk_installed = true;
+ else
+ pHddStaCtx->conn_info.ptk_installed = true;
+
+ /* In WPA case move STA to authenticated when ptk is installed.
+ * Earlier in WEP case STA was moved to AUTHENTICATED prior to
+ * setting the unicast key and it was resulting in sending
+ * few un-encrypted packet. Now in WEP case STA state will
+ * be moved to AUTHENTICATED after we set the unicast
+ * and broadcast key.
+ */
+ if ((pHddStaCtx->conn_info.ucEncryptionType ==
+ eCSR_ENCRYPT_TYPE_WEP40) ||
+ (pHddStaCtx->conn_info.ucEncryptionType ==
+ eCSR_ENCRYPT_TYPE_WEP104) ||
+ (pHddStaCtx->conn_info.ucEncryptionType ==
+ eCSR_ENCRYPT_TYPE_WEP40_STATICKEY) ||
+ (pHddStaCtx->conn_info.ucEncryptionType ==
+ eCSR_ENCRYPT_TYPE_WEP104_STATICKEY)) {
+ if (pHddStaCtx->conn_info.gtk_installed &&
+ pHddStaCtx->conn_info.ptk_installed)
+ vosStatus = hdd_change_sta_state_authenticated(pAdapter,
+ pRoamInfo);
+ } else if (pHddStaCtx->conn_info.ptk_installed)
+ vosStatus = hdd_change_sta_state_authenticated(pAdapter,
+ pRoamInfo);
+
+ if (pHddStaCtx->conn_info.gtk_installed &&
+ pHddStaCtx->conn_info.ptk_installed) {
+ pHddStaCtx->conn_info.gtk_installed = false;
+ pHddStaCtx->conn_info.ptk_installed = false;
+ }
pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE;
}