mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-21 20:12:37 +01:00
network: Disconnect from known network in Forget()
Note that the autoconnect_list may still contain the network. Currently only the top entry from the list is ever used and only on new_scan_results(), i.e. at the same time the list is being created. If at some point it becomes part of actual device state it needs to also be reset when a network is being forgotten.
This commit is contained in:
parent
a2771d22f4
commit
fe6485147c
@ -115,11 +115,6 @@ static struct l_dbus_message *forget_network(struct l_dbus *dbus,
|
|||||||
if (!security_from_str(strtype, &security))
|
if (!security_from_str(strtype, &security))
|
||||||
return dbus_error_invalid_args(message);
|
return dbus_error_invalid_args(message);
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: Disconnect from the network if currently connected or
|
|
||||||
* connecting.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!network_info_forget_known(ssid, security))
|
if (!network_info_forget_known(ssid, security))
|
||||||
return dbus_error_failed(message);
|
return dbus_error_failed(message);
|
||||||
|
|
||||||
|
@ -778,6 +778,17 @@ bool network_info_add_known(const char *ssid, enum security security)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void network_info_check_device(struct device *device, void *user_data)
|
||||||
|
{
|
||||||
|
struct network_info *info = user_data;
|
||||||
|
struct network *network;
|
||||||
|
|
||||||
|
network = device_get_connected_network(device);
|
||||||
|
|
||||||
|
if (network && network->info == info)
|
||||||
|
device_disconnect(device);
|
||||||
|
}
|
||||||
|
|
||||||
bool network_info_forget_known(const char *ssid, enum security security)
|
bool network_info_forget_known(const char *ssid, enum security security)
|
||||||
{
|
{
|
||||||
struct network_info *network, search;
|
struct network_info *network, search;
|
||||||
@ -789,15 +800,20 @@ bool network_info_forget_known(const char *ssid, enum security security)
|
|||||||
if (!network)
|
if (!network)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (network->seen_count) {
|
if (!network->seen_count) {
|
||||||
memset(&network->connected_time, 0, sizeof(struct timespec));
|
|
||||||
|
|
||||||
network->is_known = false;
|
|
||||||
|
|
||||||
l_queue_push_tail(networks, network);
|
|
||||||
} else
|
|
||||||
network_info_free(network);
|
network_info_free(network);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(&network->connected_time, 0, sizeof(struct timespec));
|
||||||
|
|
||||||
|
network->is_known = false;
|
||||||
|
|
||||||
|
l_queue_push_tail(networks, network);
|
||||||
|
|
||||||
|
__iwd_device_foreach(network_info_check_device, network);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user