mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 13:02:44 +01:00
ie: add ie_parse_oci
This is a very minimal parser, more or less to put the type and length checks into a single location.
This commit is contained in:
parent
224721e7f0
commit
7fed9f758f
20
src/ie.c
20
src/ie.c
@ -2552,3 +2552,23 @@ int ie_parse_owe_transition(const void *data, size_t len,
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ie_parse_oci(const void *data, size_t len, const uint8_t **oci)
|
||||
{
|
||||
struct ie_tlv_iter iter;
|
||||
|
||||
ie_tlv_iter_init(&iter, data, len);
|
||||
|
||||
if (!ie_tlv_iter_next(&iter))
|
||||
return -EMSGSIZE;
|
||||
|
||||
if (ie_tlv_iter_get_length(&iter) != 3)
|
||||
return -EMSGSIZE;
|
||||
|
||||
if (ie_tlv_iter_get_tag(&iter) != IE_TYPE_OCI)
|
||||
return -EPROTOTYPE;
|
||||
|
||||
*oci = ie_tlv_iter_get_data(&iter);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user