From 55491f5c02959abea1ffc81f37a3561bf4d4e089 Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Fri, 19 Jul 2019 11:18:52 -0700 Subject: [PATCH] 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. --- src/network.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/network.c b/src/network.c index 5e46bb71..1e4a997c 100644 --- a/src/network.c +++ b/src/network.c @@ -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; }