Pārlūkot izejas kodu

qcacld-3.0: Fix STA state handling in case of WEP

qcacld-2.0 to qcacld-3.0 propagation

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
Govind Singh 9 gadi atpakaļ
vecāks
revīzija
edc5cda7af
2 mainītis faili ar 102 papildinājumiem un 47 dzēšanām
  1. 4 0
      core/hdd/inc/wlan_hdd_assoc.h
  2. 98 47
      core/hdd/src/wlan_hdd_assoc.c

+ 4 - 0
core/hdd/inc/wlan_hdd_assoc.h

@@ -106,6 +106,8 @@ typedef enum {
  * @uIsAuthenticated: Remembers authenticated state
  * @dot11Mode: dot11Mode
  * @proxyARPService: proxy arp service
+ * @ptk_installed: ptk installed state
+ * @gtk_installed: gtk installed state
  */
 typedef struct connection_info_s {
 	eConnectionState connState;
@@ -122,6 +124,8 @@ typedef struct connection_info_s {
 	uint8_t uIsAuthenticated;
 	uint32_t dot11Mode;
 	uint8_t proxyARPService;
+	bool ptk_installed;
+	bool gtk_installed;
 } connection_info_t;
 
 /* Forward declarations */

+ 98 - 47
core/hdd/src/wlan_hdd_assoc.c

@@ -1442,6 +1442,64 @@ 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_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 = hdd_change_peer_state(adapter,
+			hddstactx->conn_info.staId[0],
+			ol_txrx_peer_state_auth,
+			hdd_is_roam_sync_in_progress(roaminfo));
+	hdd_conn_set_authenticated(adapter, true);
+	if ((WLAN_HDD_INFRA_STATION == adapter->device_mode) ||
+		(WLAN_HDD_P2P_CLIENT == adapter->device_mode)) {
+		sme_ps_enable_auto_ps_timer(
+			WLAN_HDD_GET_HAL_CTX(adapter),
+			adapter->sessionId,
+			hddstactx->hdd_ReassocScenario);
+	}
+
+	return ret;
+}
+
 /**
  * hdd_roam_set_key_complete_handler() - Update the security parameters
  * @pAdapter: pointer to adapter
@@ -1503,59 +1561,52 @@ static CDF_STATUS hdd_roam_set_key_complete_handler(hdd_adapter_t *pAdapter,
 		} else {
 			/*
 			 * TODO: Considering getting a state machine in
-			 * HDD later. This routine is invoked twice.
-			 * 1)set PTK 2)set GTK.
-			 * The following if statement will be true when
-			 * setting GTK. At this time we don't handle the state
-			 * in detail. Related CR: 174048 - TL not in
-			 * authenticated state
+			 * HDD later.This routine is invoked twice.
+			 * 1)set PTK 2)set GTK.The following if
+			 * statement will be TRUE when setting GTK.
+			 * At this time we don't handle the state in detail.
+			 * Related CR: 174048 - TL not in authenticated state
+			*/
+			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.
 			 */
-			cdf_status =
-				hdd_change_peer_state(pAdapter, pHddStaCtx->conn_info.staId[0],
-						ol_txrx_peer_state_auth,
-#ifdef WLAN_FEATURE_ROAM_OFFLOAD
-						pRoamInfo->roamSynchInProgress
-#else
-						false
-#endif
-						);
-			hdd_conn_set_authenticated(pAdapter, true);
-			if ((eCSR_ROAM_RESULT_AUTHENTICATED == roamResult) &&
-			    (pRoamInfo != NULL) && !pRoamInfo->fAuthRequired) {
-				hddLog(LOG3,
-					"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.
-				 */
+			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)
+					cdf_status =
+					    hdd_change_sta_state_authenticated(pAdapter,
+						pRoamInfo);
+			} else if (pHddStaCtx->conn_info.ptk_installed) {
 				cdf_status =
-					hdd_change_peer_state(pAdapter,
-						pHddStaCtx->conn_info.staId[0],
-						ol_txrx_peer_state_auth,
-#ifdef WLAN_FEATURE_ROAM_OFFLOAD
-						pRoamInfo->roamSynchInProgress
-#else
-						false
-#endif
-						);
+				    hdd_change_sta_state_authenticated(pAdapter,
+					pRoamInfo);
+			}
 
-				hdd_conn_set_authenticated(pAdapter, true);
-				if ((WLAN_HDD_INFRA_STATION ==
-					pAdapter->device_mode) ||
-					(WLAN_HDD_P2P_CLIENT ==
-					 pAdapter->device_mode)) {
-					sme_ps_enable_auto_ps_timer
-					(WLAN_HDD_GET_HAL_CTX(pAdapter),
-					 pAdapter->sessionId,
-					 pHddStaCtx->hdd_ReassocScenario);
-				}
+			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;
+						HDD_ROAM_STATE_NONE;
 		}
 	} else {
 		/*