diff options
| author | Srinivas Dasari <dasaris@codeaurora.org> | 2021-01-23 01:11:38 +0530 |
|---|---|---|
| committer | Balaji Pothunoori <bpothuno@codeaurora.org> | 2021-04-05 19:39:12 +0530 |
| commit | c19e3e2207689da7a6ea18e523d796bdc44aafdf (patch) | |
| tree | 2d2ff4d44618cd84810a67acefa6d14319433ba2 | |
| parent | 2668ab7b67e4d434e299a07ca11ad351ec313f8b (diff) | |
qcacld-3.0: lim_strip_ie to extract multiple IEs of given type
Currently lim_strip_ie strips the matched IEs from given buffer
but return only last matched IE. All the previous IEs matched to
the given type are lost. Fix this to strip and extract all IEs
matched to given type.
This is to address the case when multiple vendor specific IEs are
given from userspace. Current implementation returns only
last vendor specific IE. This is to fix the same
Change-Id: I64ca5d2e679b8457dc2cbaf7b4b12dc0a840260d
CRs-Fixed: 2499592
| -rw-r--r-- | core/mac/src/pe/lim/lim_utils.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/core/mac/src/pe/lim/lim_utils.c b/core/mac/src/pe/lim/lim_utils.c index 253c87bbfced..23b9df7f258a 100644 --- a/core/mac/src/pe/lim/lim_utils.c +++ b/core/mac/src/pe/lim/lim_utils.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2011-2019, 2021 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -6550,7 +6550,7 @@ tSirRetStatus lim_strip_ie(tpAniSirGlobal mac_ctx, int left = *addn_ielen; uint8_t *ptr = addn_ie; uint8_t elem_id; - uint16_t elem_len; + uint16_t elem_len, ie_len, extracted_ie_len = 0; if (NULL == addn_ie) { pe_err("NULL addn_ie pointer"); @@ -6563,6 +6563,10 @@ tSirRetStatus lim_strip_ie(tpAniSirGlobal mac_ctx, return eSIR_MEM_ALLOC_FAILED; } + if (extracted_ie) + qdf_mem_set(extracted_ie, eid_max_len + size_of_len_field + 1, + 0); + while (left >= 2) { elem_id = ptr[0]; left -= 1; @@ -6593,12 +6597,13 @@ tSirRetStatus lim_strip_ie(tpAniSirGlobal mac_ctx, * take oui IE and store in provided buffer. */ if (NULL != extracted_ie) { - qdf_mem_set(extracted_ie, - eid_max_len + size_of_len_field + 1, - 0); - if (elem_len <= eid_max_len) - qdf_mem_copy(extracted_ie, &ptr[0], - elem_len + size_of_len_field + 1); + ie_len = elem_len + size_of_len_field + 1; + if (ie_len <= eid_max_len - extracted_ie_len) { + qdf_mem_copy( + extracted_ie + extracted_ie_len, + &ptr[0], ie_len); + extracted_ie_len += ie_len; + } } } left -= elem_len; |
