eiwd

no dbus iwd with iwctl functionality
git clone https://git.daat.foo/repos/eiwd.git
Log | Files | Refs | Submodules | README | LICENSE

commit 5d3b37e2e4f58b725c10a71b785e388e24fbcc40
parent 2e0fed3d771790e70ff3dce894059c6f1118f486
Author: James Prestwood <james.prestwood@linux.intel.com>
Date:   Fri,  7 Jun 2019 13:58:44 -0700

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.

Diffstat:
Msrc/ie.c | 18++++++++++++++++++
Msrc/ie.h | 10++++++++++
2 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/src/ie.c b/src/ie.c @@ -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) diff --git a/src/ie.h b/src/ie.h @@ -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);