mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-21 03:32:42 +01:00
network: Fix autoconnect candidate logic
Fix autoconnect trying to connect to networks never used before as found by Tim Kourt. Update the comments to be consistent with the use of the is_known field and the docs, in that a Known Network is any network that has a config file in the iwd storage, and an autoconnect candidate is a network that has been connected to before.
This commit is contained in:
parent
0eea6ad4b7
commit
7b20f57239
@ -150,8 +150,6 @@ bool network_connected(struct network *network)
|
||||
* Write an empty settings file to keep track of the
|
||||
* last connected time. This will also make iwd autoconnect
|
||||
* to this network in the future.
|
||||
* Current policy is that network becomes a Known Network
|
||||
* only on a successful connect.
|
||||
*/
|
||||
if (!network_settings_load(network))
|
||||
return false;
|
||||
@ -217,9 +215,18 @@ static const double rankmod_table[] = {
|
||||
|
||||
bool network_rankmod(const struct network *network, double *rankmod)
|
||||
{
|
||||
int n = network_find_rank_index(network->info);
|
||||
int n;
|
||||
int nmax;
|
||||
|
||||
/*
|
||||
* Current policy is that only networks successfully connected
|
||||
* to at least once are autoconnectable. Known Networks that
|
||||
* we have never connected to are not.
|
||||
*/
|
||||
if (!network->info->connected_time.tv_sec)
|
||||
return false;
|
||||
|
||||
n = network_find_rank_index(network->info);
|
||||
if (n == -1)
|
||||
return false;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user