network: add boolean for hs20 support

Since NAI realms, Roaming Consortium and HESSID are defined in 802.11,
they are not a guarentee that the network is Hotspot 2.0. The indication
element in addition to these IE's gives a better idea of Hotspot 2.0
support. Now, when a BSS is added this is_hs20 boolean will get set to
true if the HS20 IE was found in the BSS.

Now, if is_hs20 is set AND one of NAI realms, roaming consortium, or
HESSID is set we know this is a hotspot 2.0 network.
This commit is contained in:
James Prestwood 2019-07-19 11:18:52 -07:00 committed by Denis Kenzior
parent 46b85c00c1
commit 55491f5c02
1 changed files with 6 additions and 1 deletions

View File

@ -67,6 +67,7 @@ struct network {
uint8_t *rc_ie;
bool update_psk:1; /* Whether PSK should be written to storage */
bool ask_passphrase:1; /* Whether we should force-ask agent */
bool is_hs20:1;
int rank;
};
@ -82,7 +83,8 @@ static bool network_settings_load(struct network *network)
* provisioning file containing the HESSID we know this is a Hotspot
* network.
*/
if (network->nai_realms || !util_mem_is_zero(network->hessid, 6)) {
if (network->is_hs20 && (network->nai_realms || network->rc_ie ||
!util_mem_is_zero(network->hessid, 6))) {
network->settings = l_settings_new();
if (!l_settings_load_from_file(network->settings,
@ -713,6 +715,9 @@ bool network_bss_add(struct network *network, struct scan_bss *bss)
if (bss->rc_ie && !network->rc_ie)
network->rc_ie = l_memdup(bss->rc_ie, bss->rc_ie[1] + 2);
if (bss->hs20_ie)
network->is_hs20 = true;
return true;
}