common: Split ieee8021_parse_elems()

As a preparation to parse management frames that include ML elements
with per station profiles, split the function to a helper function that
would not memset() the elements structure.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
This commit is contained in:
Ilan Peer 2023-02-16 01:08:27 +02:00 committed by Jouni Malinen
parent df6561ec06
commit 0b2fc42686

View file

@ -408,23 +408,13 @@ static int ieee802_11_parse_extension(const u8 *pos, size_t elen,
}
/**
* ieee802_11_parse_elems - Parse information elements in management frames
* @start: Pointer to the start of IEs
* @len: Length of IE buffer in octets
* @elems: Data structure for parsed elements
* @show_errors: Whether to show parsing errors in debug log
* Returns: Parsing result
*/
ParseRes ieee802_11_parse_elems(const u8 *start, size_t len,
struct ieee802_11_elems *elems,
int show_errors)
static ParseRes __ieee802_11_parse_elems(const u8 *start, size_t len,
struct ieee802_11_elems *elems,
int show_errors)
{
const struct element *elem;
int unknown = 0;
os_memset(elems, 0, sizeof(*elems));
if (!start)
return ParseOK;
@ -676,6 +666,24 @@ done:
}
/**
* ieee802_11_parse_elems - Parse information elements in management frames
* @start: Pointer to the start of IEs
* @len: Length of IE buffer in octets
* @elems: Data structure for parsed elements
* @show_errors: Whether to show parsing errors in debug log
* Returns: Parsing result
*/
ParseRes ieee802_11_parse_elems(const u8 *start, size_t len,
struct ieee802_11_elems *elems,
int show_errors)
{
os_memset(elems, 0, sizeof(*elems));
return __ieee802_11_parse_elems(start, len, elems, show_errors);
}
int ieee802_11_ie_count(const u8 *ies, size_t ies_len)
{
const struct element *elem;