mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 13:02:44 +01:00
network: copy station_has_erp_identity
This API is internal to station, but acts only on the network object so it is being moved into network.c and exposed.
This commit is contained in:
parent
1fe5070666
commit
936542fa79
@ -52,6 +52,7 @@
|
||||
#include "src/network.h"
|
||||
#include "src/blacklist.h"
|
||||
#include "src/util.h"
|
||||
#include "src/erp.h"
|
||||
|
||||
static uint32_t known_networks_watch;
|
||||
static uint32_t anqp_watch;
|
||||
@ -720,6 +721,46 @@ static bool match_bss(const void *a, const void *b)
|
||||
return a == b;
|
||||
}
|
||||
|
||||
bool network_has_erp_identity(struct network *network)
|
||||
{
|
||||
struct erp_cache_entry *cache;
|
||||
struct l_settings *settings;
|
||||
char *check_id;
|
||||
const char *identity;
|
||||
bool ret;
|
||||
|
||||
settings = network_get_settings(network);
|
||||
if (!settings)
|
||||
return false;
|
||||
|
||||
check_id = l_settings_get_string(settings, "Security", "EAP-Identity");
|
||||
if (!check_id)
|
||||
return false;
|
||||
|
||||
cache = erp_cache_get(network_get_ssid(network));
|
||||
if (!cache) {
|
||||
l_free(check_id);
|
||||
return false;
|
||||
}
|
||||
|
||||
identity = erp_cache_entry_get_identity(cache);
|
||||
|
||||
ret = strcmp(check_id, identity) == 0;
|
||||
|
||||
l_free(check_id);
|
||||
erp_cache_put(cache);
|
||||
|
||||
/*
|
||||
* The settings file must have change out from under us. In this
|
||||
* case we want to remove the ERP entry because it is no longer
|
||||
* valid.
|
||||
*/
|
||||
if (!ret)
|
||||
erp_cache_remove(identity);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct scan_bss *network_bss_select(struct network *network,
|
||||
bool fallback_to_blacklist)
|
||||
{
|
||||
|
@ -79,3 +79,5 @@ void network_blacklist_add(struct network *network, struct scan_bss *bss);
|
||||
|
||||
const struct iovec *network_get_extra_ies(struct network *network,
|
||||
size_t *num_elems);
|
||||
|
||||
bool network_has_erp_identity(struct network *network);
|
||||
|
Loading…
Reference in New Issue
Block a user