Sfoglia il codice sorgente

qcacld-3.0: Fill WPA and WAPI IE in LIM

Fill WPA and WAPI IE in join req in LIM
if profile matches with the same.

Change-Id: I4dafa57ab4a5bfa717f94138bd3b0b91700fada8
CRs-Fixed: 2861566
gaurank kathpalia 4 anni fa
parent
commit
a033b3aad7
1 ha cambiato i file con 79 aggiunte e 4 eliminazioni
  1. 79 4
      core/mac/src/pe/lim/lim_process_sme_req_messages.c

+ 79 - 4
core/mac/src/pe/lim/lim_process_sme_req_messages.c

@@ -2954,9 +2954,6 @@ lim_fill_rsn_ie(struct mac_context *mac_ctx, struct pe_session *session,
 	struct wlan_crypto_pmksa pmksa, *pmksa_peer;
 	struct bss_description *bss_desc;
 
-	if (!lim_is_rsn_profile(session))
-		return QDF_STATUS_SUCCESS;
-
 	rsn_ie = qdf_mem_malloc(DOT11F_IE_RSN_MAX_LEN + 2);
 	if (!rsn_ie)
 		return QDF_STATUS_E_NOMEM;
@@ -3025,6 +3022,78 @@ lim_fill_rsn_ie(struct mac_context *mac_ctx, struct pe_session *session,
 	return QDF_STATUS_SUCCESS;
 }
 
+static QDF_STATUS
+lim_fill_wpa_ie(struct mac_context *mac_ctx, struct pe_session *session,
+		struct cm_vdev_join_req *req)
+{
+	QDF_STATUS status;
+	uint8_t *wpa_ie;
+	uint8_t ie_len = 0;
+	uint8_t *wpa_ie_end = NULL;
+
+	wpa_ie = qdf_mem_malloc(DOT11F_IE_WPA_MAX_LEN + 2);
+	if (!wpa_ie)
+		return QDF_STATUS_E_NOMEM;
+
+	status = lim_strip_ie(mac_ctx, req->assoc_ie.ptr,
+			      (uint16_t *)&req->assoc_ie.len,
+			      DOT11F_EID_WPA, ONE_BYTE,
+			      "\x00\x50\xf2", 3, NULL, 0);
+
+	wpa_ie_end = wlan_crypto_build_wpaie(session->vdev, wpa_ie);
+	if (wpa_ie_end)
+		ie_len = wpa_ie_end - wpa_ie;
+
+	session->lim_join_req->rsnIE.length = ie_len;
+	qdf_mem_copy(session->lim_join_req->rsnIE.rsnIEdata,
+		     wpa_ie, ie_len);
+
+	qdf_mem_free(wpa_ie);
+
+	return QDF_STATUS_SUCCESS;
+}
+
+#ifdef FEATURE_WLAN_WAPI
+static QDF_STATUS
+lim_fill_wapi_ie(struct mac_context *mac_ctx, struct pe_session *session,
+		 struct cm_vdev_join_req *req)
+{
+	QDF_STATUS status;
+	uint8_t *wapi_ie;
+	uint8_t ie_len = 0;
+	uint8_t *wapi_ie_end = NULL;
+
+	wapi_ie = qdf_mem_malloc(DOT11F_IE_WAPI_MAX_LEN + 2);
+	if (!wapi_ie)
+		return QDF_STATUS_E_NOMEM;
+
+	status = lim_strip_ie(mac_ctx, req->assoc_ie.ptr,
+			      (uint16_t *)&req->assoc_ie.len,
+			      WLAN_ELEMID_WAPI, ONE_BYTE,
+			      NULL, 0, NULL, 0);
+
+	wapi_ie_end = wlan_crypto_build_wapiie(session->vdev, wapi_ie);
+	if (wapi_ie_end)
+		ie_len = wapi_ie_end - wapi_ie;
+
+	session->lim_join_req->rsnIE.length = ie_len;
+	qdf_mem_copy(session->lim_join_req->rsnIE.rsnIEdata,
+		     wapi_ie, ie_len);
+
+	qdf_mem_free(wapi_ie);
+
+	return QDF_STATUS_SUCCESS;
+}
+#else
+static inline QDF_STATUS
+lim_fill_wapi_ie(struct mac_context *mac_ctx, struct pe_session *session,
+		 struct cm_vdev_join_req *req)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#endif
+
+
 static void lim_fill_crypto_params(struct mac_context *mac_ctx,
 				   struct pe_session *session,
 				   struct cm_vdev_join_req *req)
@@ -3106,7 +3175,13 @@ static void lim_fill_crypto_params(struct mac_context *mac_ctx,
 					    req->assoc_ie.len))
 		session->isOSENConnection = true;
 
-	lim_fill_rsn_ie(mac_ctx, session, req);
+	if (lim_is_rsn_profile(session))
+		lim_fill_rsn_ie(mac_ctx, session, req);
+	else if (lim_is_wpa_profile(session))
+		lim_fill_wpa_ie(mac_ctx, session, req);
+	else if (lim_is_wapi_profile(session))
+		lim_fill_wapi_ie(mac_ctx, session, req);
+
 	lim_update_fils_config(mac_ctx, session, req);
 	mlme_priv = wlan_vdev_mlme_get_ext_hdl(session->vdev);
 	if (!mlme_priv)