scan: station: add HS20 indication element to (Re)Association

The HS20 indication element should always be included during
(Re)Association per the spec. This removes the need for a
dedicated boolean, and now the hs20_ie can be used instead.
This commit is contained in:
James Prestwood 2019-07-16 09:15:36 -07:00 committed by Denis Kenzior
parent 4948bfac20
commit 3c27528523
3 changed files with 16 additions and 9 deletions

View File

@ -742,7 +742,7 @@ static bool scan_parse_vendor_specific(struct scan_bss *bss, const void *data,
else if (!bss->osen && is_ie_wfa_ie(data, len, IE_WFA_OI_OSEN))
bss->osen = l_memdup(data - 2, len + 2);
else if (is_ie_wfa_ie(data, len, IE_WFA_OI_HS20_INDICATION))
bss->hs20_capable = true;
bss->hs20_ie = l_memdup(data - 2, len + 2);
else
return false;

View File

@ -66,6 +66,7 @@ struct scan_bss {
uint64_t time_stamp;
uint8_t hessid[6];
uint8_t *rc_ie; /* Roaming consortium IE */
uint8_t *hs20_ie;
bool mde_present : 1;
bool cc_present : 1;
bool cap_rm_neighbor_report : 1;
@ -73,7 +74,6 @@ struct scan_bss {
bool ht_capable : 1;
bool vht_capable : 1;
bool anqp_capable : 1;
bool hs20_capable : 1;
};
struct scan_parameters {

View File

@ -458,7 +458,7 @@ static bool station_start_anqp(struct station *station, struct network *network,
struct anqp_entry *entry;
bool anqp_disabled = true;
if (!bss->hs20_capable)
if (!bss->hs20_ie)
return false;
/* Network already has ANQP data/HESSID */
@ -2181,7 +2181,8 @@ int __station_connect_network(struct station *station, struct network *network,
const uint8_t *rc = NULL;
size_t rc_len = 0;
uint8_t rc_buf[32];
struct iovec iov;
struct iovec iov[2];
int iov_elems = 0;
struct handshake_state *hs;
int r;
@ -2189,7 +2190,12 @@ int __station_connect_network(struct station *station, struct network *network,
if (!hs)
return -ENOTSUP;
if (bss->hs20_capable) {
if (bss->hs20_ie) {
/* Include HS20 Indication with (Re)Association */
iov[iov_elems].iov_base = bss->hs20_ie;
iov[iov_elems].iov_len = bss->hs20_ie[1] + 2;
iov_elems++;
/*
* If a matching roaming consortium OI is found for the network
* this single RC value will be set in the handshake and used
@ -2199,13 +2205,14 @@ int __station_connect_network(struct station *station, struct network *network,
if (rc) {
ie_build_roaming_consortium(rc, rc_len, rc_buf);
iov.iov_base = rc_buf;
iov.iov_len = rc_buf[1] + 2;
iov[iov_elems].iov_base = rc_buf;
iov[iov_elems].iov_len = rc_buf[1] + 2;
iov_elems++;
}
}
r = netdev_connect(station->netdev, bss, hs, rc ? &iov : NULL,
rc ? 1 : 0, station_netdev_event,
r = netdev_connect(station->netdev, bss, hs, iov_elems ? iov : NULL,
iov_elems, station_netdev_event,
station_connect_cb, station);
if (r < 0) {
handshake_state_free(hs);