mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 21:22:37 +01:00
network: remove hotspot specific settings loading
The hotspot module now uses network_info ops 'open'
This commit is contained in:
parent
8242b7e9f3
commit
7313d3bad7
@ -387,98 +387,6 @@ static void hs20_dir_watch_destroy(void *user_data)
|
||||
hs20_dir_watch = NULL;
|
||||
}
|
||||
|
||||
static bool match_hessid(const void *a, const void *b)
|
||||
{
|
||||
const struct hs20_config *config = a;
|
||||
const uint8_t *hessid = b;
|
||||
|
||||
if (!memcmp(config->hessid, hessid, 6))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool match_nai_realm(const void *a, const void *b)
|
||||
{
|
||||
const struct hs20_config *config = a;
|
||||
char **realms = (char **)b;
|
||||
|
||||
while (*realms) {
|
||||
if (l_strv_contains(config->nai_realms, *realms))
|
||||
return true;
|
||||
|
||||
realms++;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool match_rc(const void *a, const void *b)
|
||||
{
|
||||
const struct hs20_config *config = a;
|
||||
const uint8_t *rc_ie = b;
|
||||
const uint8_t *rc1, *rc2, *rc3;
|
||||
size_t rc1_len, rc2_len, rc3_len;
|
||||
|
||||
if (ie_parse_roaming_consortium_from_data(rc_ie, rc_ie[1] + 2, NULL,
|
||||
&rc1, &rc1_len, &rc2, &rc2_len,
|
||||
&rc3, &rc3_len) < 0)
|
||||
return false;
|
||||
|
||||
/* rc1 is guarenteed to be set if the above returns success */
|
||||
if (rc1_len == config->rc_len && !memcmp(rc1, config->rc, rc1_len))
|
||||
return true;
|
||||
|
||||
if (rc2 && rc2_len == config->rc_len &&
|
||||
!memcmp(rc2, config->rc, rc2_len))
|
||||
return true;
|
||||
|
||||
if (rc3 && rc1_len == config->rc_len &&
|
||||
!memcmp(rc3, config->rc, rc3_len))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
const char *hs20_find_settings_file(struct network *network)
|
||||
{
|
||||
struct hs20_config *config;
|
||||
const uint8_t *hessid = network_get_hessid(network);
|
||||
char **nai_realms = network_get_nai_realms(network);
|
||||
const uint8_t *rc_ie = network_get_roaming_consortium(network);
|
||||
|
||||
if (!hessid || util_mem_is_zero(hessid, 6)) {
|
||||
l_debug("Network has no HESSID, trying NAI realms");
|
||||
goto try_nai_realms;
|
||||
}
|
||||
|
||||
config = l_queue_find(hs20_settings, match_hessid, hessid);
|
||||
if (config)
|
||||
return config->filename;
|
||||
|
||||
try_nai_realms:
|
||||
if (!nai_realms) {
|
||||
l_debug("Network has no NAI Realms, trying roaming consortium");
|
||||
goto try_roaming_consortium;
|
||||
}
|
||||
|
||||
config = l_queue_find(hs20_settings, match_nai_realm, nai_realms);
|
||||
if (config)
|
||||
return config->filename;
|
||||
|
||||
try_roaming_consortium:
|
||||
if (!rc_ie) {
|
||||
l_debug("Network has no roaming consortium IE");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
config = l_queue_find(hs20_settings, match_rc, rc_ie);
|
||||
if (config)
|
||||
return config->filename;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const uint8_t *hs20_get_roaming_consortium(struct network *network,
|
||||
size_t *len)
|
||||
{
|
||||
|
@ -22,7 +22,5 @@
|
||||
|
||||
struct network;
|
||||
|
||||
const char *hs20_find_settings_file(struct network *network);
|
||||
|
||||
const uint8_t *hs20_get_roaming_consortium(struct network *network,
|
||||
size_t *len);
|
||||
|
@ -80,21 +80,7 @@ static bool network_settings_load(struct network *network)
|
||||
if (network->settings)
|
||||
return true;
|
||||
|
||||
/*
|
||||
* If this network contains NAI realm info OR we have a Hotspot
|
||||
* provisioning file containing the HESSID we know this is a Hotspot
|
||||
* network.
|
||||
*/
|
||||
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,
|
||||
hs20_find_settings_file(network))) {
|
||||
l_settings_free(network->settings);
|
||||
network->settings = NULL;
|
||||
}
|
||||
} else if (network->info)
|
||||
if (network->info)
|
||||
network->settings = network_info_open_settings(network->info);
|
||||
|
||||
return network->settings != NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user