mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-02-16 15:20:42 +01:00
network: update hotspots on knownnetwork changes
This commit is contained in:
parent
610ef41578
commit
ed08bc35a3
@ -438,7 +438,13 @@ const struct network_info *network_get_info(const struct network *network)
|
|||||||
|
|
||||||
void network_set_info(struct network *network, struct network_info *info)
|
void network_set_info(struct network *network, struct network_info *info)
|
||||||
{
|
{
|
||||||
network->info = info;
|
if (info) {
|
||||||
|
network->info = info;
|
||||||
|
network->info->seen_count++;
|
||||||
|
} else {
|
||||||
|
network->info->seen_count--;
|
||||||
|
network->info = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
l_dbus_property_changed(dbus_get_bus(), network_get_path(network),
|
l_dbus_property_changed(dbus_get_bus(), network_get_path(network),
|
||||||
IWD_NETWORK_INTERFACE, "KnownNetwork");
|
IWD_NETWORK_INTERFACE, "KnownNetwork");
|
||||||
@ -555,28 +561,36 @@ void network_connect_failed(struct network *network)
|
|||||||
l_queue_clear(network->blacklist, NULL);
|
l_queue_clear(network->blacklist, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool hotspot_info_matches(struct network *network,
|
||||||
|
const struct network_info *info)
|
||||||
|
{
|
||||||
|
struct scan_bss *bss;
|
||||||
|
|
||||||
|
if (!network->is_hs20 || !info->is_hotspot)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
bss = network_bss_select(network, true);
|
||||||
|
|
||||||
|
if (network_info_match_hessid(info, bss->hessid))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (network_info_match_roaming_consortium(info, bss->rc_ie,
|
||||||
|
bss->rc_ie[1] + 2))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static bool match_hotspot_network(const struct network_info *info,
|
static bool match_hotspot_network(const struct network_info *info,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
struct network *network = user_data;
|
struct network *network = user_data;
|
||||||
struct scan_bss *bss;
|
|
||||||
|
|
||||||
if (!info->is_hotspot)
|
if (!hotspot_info_matches(network, info))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bss = network_bss_select(network, false);
|
network_set_info(network, (struct network_info *) info);
|
||||||
|
|
||||||
if (network_info_match_roaming_consortium(info, bss->rc_ie,
|
|
||||||
bss->rc_ie[1] + 2))
|
|
||||||
goto found;
|
|
||||||
|
|
||||||
if (network_info_match_hessid(info, bss->hessid))
|
|
||||||
goto found;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
|
|
||||||
found:
|
|
||||||
network->info = (struct network_info *)info;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1319,34 +1333,57 @@ void network_rank_update(struct network *network, bool connected)
|
|||||||
network->rank = best_bss->rank;
|
network->rank = best_bss->rank;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void network_unset_hotspot(struct network *network, void *user_data)
|
||||||
|
{
|
||||||
|
struct network_info *info = user_data;
|
||||||
|
|
||||||
|
if (!hotspot_info_matches(network, info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
network_set_info(network, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
static void emit_known_network_changed(struct station *station, void *user_data)
|
static void emit_known_network_changed(struct station *station, void *user_data)
|
||||||
{
|
{
|
||||||
struct network_info *info = user_data;
|
struct network_info *info = user_data;
|
||||||
struct network *network;
|
struct network *network;
|
||||||
|
|
||||||
network = station_network_find(station, info->ssid, info->type);
|
if (!info->is_hotspot) {
|
||||||
if (!network)
|
network = station_network_find(station, info->ssid, info->type);
|
||||||
return;
|
if (!network)
|
||||||
|
return;
|
||||||
|
|
||||||
info->seen_count--;
|
network_set_info(network, NULL);
|
||||||
network->info = NULL;
|
return;
|
||||||
l_dbus_property_changed(dbus_get_bus(), network_get_path(network),
|
}
|
||||||
IWD_NETWORK_INTERFACE, "KnownNetwork");
|
|
||||||
|
/* This is a new hotspot network */
|
||||||
|
station_network_foreach(station, network_unset_hotspot, info);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void network_update_hotspot(struct network *network, void *user_data)
|
||||||
|
{
|
||||||
|
struct network_info *info = user_data;
|
||||||
|
|
||||||
|
match_hotspot_network(info, network);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void match_known_network(struct station *station, void *user_data)
|
static void match_known_network(struct station *station, void *user_data)
|
||||||
{
|
{
|
||||||
struct network_info *info = user_data;
|
struct network_info *info = user_data;
|
||||||
struct network *network = station_network_find(station,
|
struct network *network;
|
||||||
info->ssid, info->type);
|
|
||||||
|
|
||||||
if (!network)
|
if (!info->is_hotspot) {
|
||||||
|
network = station_network_find(station, info->ssid, info->type);
|
||||||
|
if (!network)
|
||||||
|
return;
|
||||||
|
|
||||||
|
network_set_info(network, info);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
network->info = info;
|
/* This is a new hotspot network */
|
||||||
network->info->seen_count++;
|
station_network_foreach(station, network_update_hotspot, info);
|
||||||
l_dbus_property_changed(dbus_get_bus(), network_get_path(network),
|
|
||||||
IWD_NETWORK_INTERFACE, "KnownNetwork");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void disconnect_no_longer_known(struct station *station, void *user_data)
|
static void disconnect_no_longer_known(struct station *station, void *user_data)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user