3
0
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:
James Prestwood 2021-10-19 11:19:03 -07:00 committed by Denis Kenzior
parent 224721e7f0
commit 7fed9f758f
2 changed files with 22 additions and 0 deletions

View File

@ -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;
}

View File

@ -645,3 +645,5 @@ int ie_parse_network_cost(const void *data, size_t len,
int ie_parse_owe_transition(const void *data, size_t len,
struct ie_owe_transition_info *info);
int ie_parse_oci(const void *data, size_t len, const uint8_t **oci);