Prechádzať zdrojové kódy

qcacld-3.0: Fill mgmt_encryption_type in case of RSNE override

In case of RSNE override, the mgmt_encryption_type is not set
and thus AP is not considered as PMF capable by LIM.

TO fix this update mgmt_encryption_type if AP is RSN capable and
profile is RSN capable.

Change-Id: I3350d33ca605c82726156f4f00a8a497dc07d3a8
CRs-Fixed: 2368692
Abhishek Singh 6 rokov pred
rodič
commit
3360227b8c
1 zmenil súbory, kde vykonal 74 pridanie a 0 odobranie
  1. 74 0
      core/sme/src/csr/csr_util.c

+ 74 - 0
core/sme/src/csr/csr_util.c

@@ -4792,6 +4792,78 @@ uint8_t csr_retrieve_wpa_ie(struct mac_context *mac, uint8_t session_id,
 	return cbWpaIe;
 }
 
+#ifdef WLAN_FEATURE_11W
+/**
+ * csr_get_mc_mgmt_cipher(): Get mcast management cipher from profile rsn
+ * @mac: mac ctx
+ * @profile: connect profile
+ * @bss: ap scan entry
+ * @ap_ie: AP IE's
+ *
+ * Return: none
+ */
+static void csr_get_mc_mgmt_cipher(struct mac_context *mac,
+				   struct csr_roam_profile *profile,
+				   tSirBssDescription *bss,
+				   tDot11fBeaconIEs *ap_ie)
+{
+	int ret;
+	tDot11fIERSN rsn_ie = {0};
+	uint8_t n_mgmt_cipher = 1;
+	struct rsn_caps rsn_caps;
+	tDot11fBeaconIEs *local_ap_ie = ap_ie;
+	uint8_t grp_mgmt_arr[CSR_RSN_MAX_MULTICAST_CYPHERS][CSR_RSN_OUI_SIZE];
+
+	if (!profile->MFPEnabled)
+		return;
+
+	if (!local_ap_ie &&
+	    (!QDF_IS_STATUS_SUCCESS(csr_get_parsed_bss_description_ies
+				    (mac, bss, &local_ap_ie))))
+		return;
+
+	qdf_mem_copy(&rsn_caps, local_ap_ie->RSN.RSN_Cap, sizeof(rsn_caps));
+
+	if (!ap_ie && local_ap_ie)
+		/* locally allocated */
+		qdf_mem_free(local_ap_ie);
+
+	/* if AP is not PMF capable return */
+	if (!rsn_caps.MFPCapable)
+		return;
+
+	ret = dot11f_unpack_ie_rsn(mac, profile->pRSNReqIE + 2,
+				   profile->nRSNReqIELength -2,
+				   &rsn_ie, false);
+	if (DOT11F_FAILED(ret))
+		return;
+
+	qdf_mem_copy(&rsn_caps, rsn_ie.RSN_Cap, sizeof(rsn_caps));
+
+	/* if self cap is not PMF capable return */
+	if (!rsn_caps.MFPCapable)
+		return;
+
+	qdf_mem_copy(grp_mgmt_arr, rsn_ie.gp_mgmt_cipher_suite,
+		     CSR_RSN_OUI_SIZE);
+	if (csr_is_group_mgmt_gmac_128(mac, grp_mgmt_arr, n_mgmt_cipher, NULL))
+		profile->mgmt_encryption_type = eSIR_ED_AES_GMAC_128;
+	else if (csr_is_group_mgmt_gmac_256(mac, grp_mgmt_arr,
+		 n_mgmt_cipher, NULL))
+		profile->mgmt_encryption_type = eSIR_ED_AES_GMAC_256;
+	else
+		/* Default is CMAC */
+		profile->mgmt_encryption_type = eSIR_ED_AES_128_CMAC;
+}
+#else
+static inline
+void csr_get_mc_mgmt_cipher(struct mac_context *mac,
+			    struct csr_roam_profile *profile,
+			    tSirBssDescription *bss,
+			    tDot11fBeaconIEs *ap_ie)
+{
+}
+#endif
 /* If a RSNIE exists in the profile, just use it. Or else construct
  * one from the BSS Caller allocated memory for pWpaIe and guarrantee
  * it can contain a max length WPA IE
@@ -4815,6 +4887,8 @@ uint8_t csr_retrieve_rsn_ie(struct mac_context *mac, uint32_t sessionId,
 				cbRsnIe = (uint8_t) pProfile->nRSNReqIELength;
 				qdf_mem_copy(pRsnIe, pProfile->pRSNReqIE,
 					     cbRsnIe);
+				csr_get_mc_mgmt_cipher(mac, pProfile,
+						       pSirBssDesc, pIes);
 			} else {
 				sme_warn("Invalid RSN IE length: %d",
 					 pProfile->nRSNReqIELength);