Эх сурвалжийг харах

qcacld-3.0: Send Peer Authorized for SAP peers after Set Key Complete

The hostapd sends the add_key command followed by the change_station
command to set the peer to authorized state and open the data ports.
Since the add_key is serialized through LIM/WMA layers and might not
have been sent to the FW by the time the change_station is received,
the FW would assert due to peer moved to authorized state before keys
are set.

Send the Peer authorized command to FW and to the hostapd only after
the set_key is complete for the peer.

Change-Id: Ibd1737a41ea96770987da4070b72e756538e7508
CRs-Fixed: 2267291
Vignesh Viswanathan 7 жил өмнө
parent
commit
597d901893

+ 13 - 0
core/hdd/src/wlan_hdd_cfg80211.c

@@ -16212,6 +16212,7 @@ static int __wlan_hdd_change_station(struct wiphy *wiphy,
 	struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
 	struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
 	struct hdd_context *hdd_ctx;
 	struct hdd_context *hdd_ctx;
 	struct hdd_station_ctx *sta_ctx;
 	struct hdd_station_ctx *sta_ctx;
+	struct hdd_ap_ctx *ap_ctx;
 	struct qdf_mac_addr STAMacAddress;
 	struct qdf_mac_addr STAMacAddress;
 	int ret;
 	int ret;
 
 
@@ -16243,6 +16244,18 @@ static int __wlan_hdd_change_station(struct wiphy *wiphy,
 	if ((adapter->device_mode == QDF_SAP_MODE) ||
 	if ((adapter->device_mode == QDF_SAP_MODE) ||
 	    (adapter->device_mode == QDF_P2P_GO_MODE)) {
 	    (adapter->device_mode == QDF_P2P_GO_MODE)) {
 		if (params->sta_flags_set & BIT(NL80211_STA_FLAG_AUTHORIZED)) {
 		if (params->sta_flags_set & BIT(NL80211_STA_FLAG_AUTHORIZED)) {
+			ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter);
+			/*
+			 * For Encrypted SAP session, this will be done as
+			 * part of eSAP_STA_SET_KEY_EVENT
+			 */
+			if (ap_ctx->encryption_type !=
+			    eCSR_ENCRYPT_TYPE_NONE) {
+				hdd_debug("Encrypt type %d, not setting peer authorized now",
+					  ap_ctx->encryption_type);
+				return 0;
+			}
+
 			status =
 			status =
 				hdd_softap_change_sta_state(adapter,
 				hdd_softap_change_sta_state(adapter,
 							    &STAMacAddress,
 							    &STAMacAddress,

+ 10 - 2
core/hdd/src/wlan_hdd_hostapd.c

@@ -1587,6 +1587,7 @@ QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent,
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
 	struct hdd_chan_change_params chan_change;
 	struct hdd_chan_change_params chan_change;
 	tSap_StationAssocReassocCompleteEvent *event;
 	tSap_StationAssocReassocCompleteEvent *event;
+	tSap_StationSetKeyCompleteEvent *key_complete;
 	int ret = 0;
 	int ret = 0;
 	struct ch_params sap_ch_param = {0};
 	struct ch_params sap_ch_param = {0};
 	eCsrPhyMode phy_mode;
 	eCsrPhyMode phy_mode;
@@ -1972,9 +1973,16 @@ QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent,
 		 * forward the message to hostapd once implementation
 		 * forward the message to hostapd once implementation
 		 * is done for now just print
 		 * is done for now just print
 		 */
 		 */
+		key_complete = &pSapEvent->sapevt.sapStationSetKeyCompleteEvent;
 		hdd_debug("SET Key: configured status = %s",
 		hdd_debug("SET Key: configured status = %s",
-		       pSapEvent->sapevt.sapStationSetKeyCompleteEvent.
-		       status ? "eSAP_STATUS_FAILURE" : "eSAP_STATUS_SUCCESS");
+			  key_complete->status ?
+			  "eSAP_STATUS_FAILURE" : "eSAP_STATUS_SUCCESS");
+
+		if (QDF_IS_STATUS_SUCCESS(key_complete->status)) {
+			hdd_softap_change_sta_state(adapter,
+						    &key_complete->peerMacAddr,
+						    OL_TXRX_PEER_STATE_AUTH);
+		}
 		return QDF_STATUS_SUCCESS;
 		return QDF_STATUS_SUCCESS;
 	case eSAP_STA_MIC_FAILURE_EVENT:
 	case eSAP_STA_MIC_FAILURE_EVENT:
 	{
 	{