mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-01-03 10:32:33 +01:00
network: use WPA version and privacy for ranking
These ranking factors were moved out of scan.c and into network.c as they are more relevant for network ranking than BSS ranking.
This commit is contained in:
parent
3fde169001
commit
0be5beffc8
@ -1452,6 +1452,10 @@ int network_rank_compare(const void *a, const void *b, void *user)
|
||||
|
||||
void network_rank_update(struct network *network, bool connected)
|
||||
{
|
||||
static const double RANK_RSNE_FACTOR = 1.2;
|
||||
static const double RANK_WPA_FACTOR = 1.0;
|
||||
static const double RANK_OPEN_FACTOR = 0.5;
|
||||
static const double RANK_NO_PRIVACY_FACTOR = 0.5;
|
||||
/*
|
||||
* Theoretically there may be difference between the BSS selection
|
||||
* here and in network_bss_select but those should be rare cases.
|
||||
@ -1491,6 +1495,21 @@ void network_rank_update(struct network *network, bool connected)
|
||||
network->rank = rankmod_table[n] * best_bss->rank + USHRT_MAX;
|
||||
} else
|
||||
network->rank = best_bss->rank;
|
||||
|
||||
/*
|
||||
* Prefer RSNE first, WPA second. Open networks are much less
|
||||
* desirable.
|
||||
*/
|
||||
if (best_bss->rsne)
|
||||
network->rank *= RANK_RSNE_FACTOR;
|
||||
else if (best_bss->wpa)
|
||||
network->rank *= RANK_WPA_FACTOR;
|
||||
else
|
||||
network->rank *= RANK_OPEN_FACTOR;
|
||||
|
||||
/* We prefer networks with CAP PRIVACY */
|
||||
if (!(best_bss->capability & IE_BSS_CAP_PRIVACY))
|
||||
network->rank *= RANK_NO_PRIVACY_FACTOR;
|
||||
}
|
||||
|
||||
static void network_unset_hotspot(struct network *network, void *user_data)
|
||||
|
Loading…
Reference in New Issue
Block a user