scan: update vendor specific IE parsing to handle WFA

The vendor specific IE was being parsed only to check if the AP supported
WPA, which used a Microsoft OUI. Hotspot/OSEN uses neither WPA or RSN
(although its nearly identical to RSN) so the we also need to check for
this Wifi-Alliance OUI and set bss->osen (new) if found.
This commit is contained in:
James Prestwood 2019-06-10 15:46:58 -07:00 committed by Denis Kenzior
parent d3baec4eee
commit c62ca4e185
2 changed files with 25 additions and 4 deletions

View File

@ -731,6 +731,20 @@ static bool start_next_scan_request(struct scan_context *sc)
return false;
}
static bool scan_parse_vendor_specific(struct scan_bss *bss, const void *data,
uint16_t len)
{
if (!bss->wpa && is_ie_wpa_ie(data, len)) {
bss->wpa = l_memdup(data - 2, len + 2);
return true;
} else if (!bss->osen && is_ie_wfa_ie(data, len, IE_WFA_OI_OSEN))
bss->osen = l_memdup(data - 2, len + 2);
else
return false;
return false;
}
static bool scan_parse_bss_information_elements(struct scan_bss *bss,
const void *data, uint16_t len)
{
@ -778,10 +792,8 @@ static bool scan_parse_bss_information_elements(struct scan_bss *bss,
break;
case IE_TYPE_VENDOR_SPECIFIC:
/* Interested only in WPA IE from Vendor data */
if (!bss->wpa && is_ie_wpa_ie(iter.data, iter.len))
bss->wpa = l_memdup(iter.data - 2,
iter.len + 2);
/* Interested only in WPA/WFA IE from Vendor data */
scan_parse_vendor_specific(bss, iter.data, iter.len);
break;
case IE_TYPE_MOBILITY_DOMAIN:
if (!bss->mde_present && iter.len == 3) {
@ -1069,6 +1081,14 @@ int scan_bss_get_rsn_info(const struct scan_bss *bss, struct ie_rsn_info *info)
res, strerror(-res));
return res;
}
} else if (bss->osen) {
int res = ie_parse_osen_from_data(bss->osen, bss->osen[1] + 2,
info);
if (res < 0) {
l_debug("Cannot parse OSEN IE (%d, %s)",
res, strerror(-res));
return res;
}
} else
return -ENOENT;

View File

@ -48,6 +48,7 @@ struct scan_bss {
uint16_t capability;
uint8_t *rsne;
uint8_t *wpa;
uint8_t *osen;
uint8_t *wsc; /* Concatenated WSC IEs */
ssize_t wsc_size; /* Size of Concatenated WSC IEs */
uint8_t mde[3];