mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-02-16 23:40:43 +01:00
ie: Add parse utility for network cost vendor IE
This commit is contained in:
parent
c545674918
commit
c93966d5a1
20
src/ie.c
20
src/ie.c
@ -2472,3 +2472,23 @@ void ie_build_fils_ip_addr_response(
|
|||||||
done:
|
done:
|
||||||
*len = to - (len + 1);
|
*len = to - (len + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Parse Network Cost IE according to:
|
||||||
|
* https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-nct/88f0cdf4-cdf2-4455-b849-4abf1e5c11ac
|
||||||
|
*/
|
||||||
|
int ie_parse_network_cost(const void *data, size_t len,
|
||||||
|
uint16_t *level, uint16_t *flags)
|
||||||
|
{
|
||||||
|
const uint8_t *ie = data;
|
||||||
|
|
||||||
|
if (len < 10 || ie[0] != IE_TYPE_VENDOR_SPECIFIC || ie[1] != 8)
|
||||||
|
return -ENOMSG;
|
||||||
|
|
||||||
|
if (memcmp(ie + 2, microsoft_oui, 3) || ie[5] != 0x11)
|
||||||
|
return -ENOMSG;
|
||||||
|
|
||||||
|
*level = l_get_le16(ie + 6);
|
||||||
|
*flags = l_get_le16(ie + 8);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
3
src/ie.h
3
src/ie.h
@ -626,3 +626,6 @@ int ie_parse_fils_ip_addr_response(struct ie_tlv_iter *iter,
|
|||||||
void ie_build_fils_ip_addr_response(
|
void ie_build_fils_ip_addr_response(
|
||||||
const struct ie_fils_ip_addr_response_info *info,
|
const struct ie_fils_ip_addr_response_info *info,
|
||||||
uint8_t *to);
|
uint8_t *to);
|
||||||
|
|
||||||
|
int ie_parse_network_cost(const void *data, size_t len,
|
||||||
|
uint16_t *flags, uint16_t *level);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user