3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-29 22:19:23 +01:00

ie: add is_ie_wfa_ie

This checks if an IE tagged as vendor specific is a WiFi-Alliance
OUI. This is similar to how is_ie_wpa_ie works.
This commit is contained in:
James Prestwood 2019-06-07 13:58:44 -07:00 committed by Denis Kenzior
parent 2e0fed3d77
commit 5d3b37e2e4
2 changed files with 28 additions and 0 deletions

View File

@ -1136,6 +1136,24 @@ static bool ie_parse_wpa_pairwise_cipher(const uint8_t *data,
return true;
}
bool is_ie_wfa_ie(const uint8_t *data, uint8_t len, uint8_t oi_type)
{
if (!data)
return false;
if (oi_type == IE_WFA_OI_OSEN && len < 22)
return false;
else if (oi_type == IE_WFA_OI_HS20_INDICATION && len < 7)
return false;
else if (len < 4) /* OI not handled, but at least check length */
return false;
if (!memcmp(data, wifi_alliance_oui, 3) && data[3] == oi_type)
return true;
return false;
}
bool is_ie_wpa_ie(const uint8_t *data, uint8_t len)
{
if (!data || len < 6)

View File

@ -234,6 +234,15 @@ enum ie_type {
IE_TYPE_OWE_DH_PARAM = 256 + 32,
};
/*
* WiFi Alliance Hotspot 2.0 Specification - Section 3.1 Elements Definitions
*/
enum ie_vendor_wfa_oi_type {
IE_WFA_OI_HS20_INDICATION = 0x10,
IE_WFA_OI_OSEN = 0x12,
IE_WFA_OI_ROAMING_SELECTION = 0x1d,
};
enum ie_advertisement_id {
IE_ADVERTISEMENT_ANQP = 0,
IE_ADVERTISEMENT_MIH_SERVICE = 1,
@ -426,6 +435,7 @@ bool ie_build_rsne(const struct ie_rsn_info *info, uint8_t *to);
int ie_parse_wpa(struct ie_tlv_iter *iter, struct ie_rsn_info *out_info);
int ie_parse_wpa_from_data(const uint8_t *data, size_t len,
struct ie_rsn_info *info);
bool is_ie_wfa_ie(const uint8_t *data, uint8_t len, uint8_t oi_type);
bool is_ie_wpa_ie(const uint8_t *data, uint8_t len);
bool ie_build_wpa(const struct ie_rsn_info *info, uint8_t *to);