Selaa lähdekoodia

qcacld-3.0: Append vendor specific IEs received to assoc request

wpa_supplicant/framework sends different vendor specific IEs in
connect request. Currently driver is parsing the IEs and appending
specific IEs to the assoc request frame. But all vendor specific
IEs are supposed to be sent in the assoc request. Extract all vendor
specific IEs and append at the end of the frame.
MBO IEs are expected to be present at the end of the frame.
So append rest of the vendor IEs just before MBO IE.

This is a followup change for the change
Ia6423bb43b2ac294541c2485f5ed45d14af6553d to ensure the
"appending vendor IEs to assoc request feature is still intact".

Change-Id: Id788153ceb30c67f7ca9de9f3feea2d610cb21cb
CRs-Fixed: 2851362
Srinivas Dasari 4 vuotta sitten
vanhempi
sitoutus
a03e7735bf

+ 1 - 0
components/mlme/dispatcher/inc/wlan_mlme_public_struct.h

@@ -79,6 +79,7 @@
 #define CFG_MAX_TX_POWER_5_LEN      256
 #define CFG_POWER_USAGE_MAX_LEN      4
 #define CFG_MAX_STR_LEN       256
+#define MAX_VENDOR_IES_LEN 1532
 
 #define CFG_MAX_PMK_LEN       64
 

+ 35 - 3
core/mac/src/pe/lim/lim_send_management_frames.c

@@ -2036,7 +2036,7 @@ lim_send_assoc_req_mgmt_frame(struct mac_context *mac_ctx,
 	uint8_t qos_enabled, wme_enabled, wsm_enabled;
 	void *packet;
 	QDF_STATUS qdf_status;
-	uint16_t add_ie_len;
+	uint16_t add_ie_len, current_len = 0, vendor_ie_len = 0;
 	uint8_t *add_ie = NULL, *mscs_ext_ie = NULL;
 	const uint8_t *wps_ie = NULL;
 	uint8_t power_caps = false;
@@ -2053,7 +2053,7 @@ lim_send_assoc_req_mgmt_frame(struct mac_context *mac_ctx,
 	uint32_t bcn_ie_len = 0;
 	uint32_t aes_block_size_len = 0;
 	enum rateid min_rid = RATEID_DEFAULT;
-	uint8_t *mbo_ie = NULL, *adaptive_11r_ie = NULL;
+	uint8_t *mbo_ie = NULL, *adaptive_11r_ie = NULL, *vendor_ies = NULL;
 	uint8_t mbo_ie_len = 0, adaptive_11r_ie_len = 0, rsnx_ie_len = 0;
 	uint8_t mscs_ext_ie_len = 0;
 	bool bss_mfp_capable;
@@ -2462,6 +2462,32 @@ lim_send_assoc_req_mgmt_frame(struct mac_context *mac_ctx,
 		}
 	}
 
+	/*
+	 * Strip rest of the vendor IEs and append to the assoc request frame.
+	 * Append the IEs just before MBO IEs as MBO IEs have to be at the
+	 * end of the frame.
+	 */
+	if (wlan_get_ie_ptr_from_eid(WLAN_ELEMID_VENDOR, add_ie, add_ie_len)) {
+		vendor_ies = qdf_mem_malloc(MAX_VENDOR_IES_LEN + 2);
+		if (vendor_ies) {
+			current_len = add_ie_len;
+			qdf_status = lim_strip_ie(mac_ctx, add_ie, &add_ie_len,
+						  WLAN_ELEMID_VENDOR, ONE_BYTE,
+						  NULL,
+						  0,
+						  vendor_ies,
+						  MAX_VENDOR_IES_LEN);
+			if (QDF_IS_STATUS_ERROR(qdf_status)) {
+				pe_err("Failed to strip Vendor IEs");
+				goto end;
+			}
+
+			vendor_ie_len = current_len - add_ie_len;
+			pe_debug("Stripped vendor IEs of size: %u",
+				 current_len);
+		}
+	}
+
 	qdf_status = lim_fill_adaptive_11r_ie(pe_session, &adaptive_11r_ie,
 					      &adaptive_11r_ie_len);
 	if (QDF_IS_STATUS_ERROR(qdf_status)) {
@@ -2496,7 +2522,7 @@ lim_send_assoc_req_mgmt_frame(struct mac_context *mac_ctx,
 
 	bytes = payload + sizeof(tSirMacMgmtHdr) + aes_block_size_len +
 		rsnx_ie_len + mbo_ie_len + adaptive_11r_ie_len +
-		mscs_ext_ie_len;
+		mscs_ext_ie_len + vendor_ie_len;
 
 	qdf_status = cds_packet_alloc((uint16_t) bytes, (void **)&frame,
 				(void **)&packet);
@@ -2548,6 +2574,11 @@ lim_send_assoc_req_mgmt_frame(struct mac_context *mac_ctx,
 		payload = payload + mscs_ext_ie_len;
 	}
 
+	/* Copy the vendor IEs to the end of the frame */
+	qdf_mem_copy(frame + sizeof(tSirMacMgmtHdr) + payload,
+		     vendor_ies, vendor_ie_len);
+	payload = payload + vendor_ie_len;
+
 	/* Copy the MBO IE to the end of the frame */
 	qdf_mem_copy(frame + sizeof(tSirMacMgmtHdr) + payload,
 		     mbo_ie, mbo_ie_len);
@@ -2635,6 +2666,7 @@ lim_send_assoc_req_mgmt_frame(struct mac_context *mac_ctx,
 
 end:
 	qdf_mem_free(rsnx_ie);
+	qdf_mem_free(vendor_ies);
 	qdf_mem_free(mbo_ie);
 	qdf_mem_free(mscs_ext_ie);