mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-01-11 10:12:42 +01:00
network: return boolean from network_rankmod
Since the rankmod value only makes sense for autoconnectable networks, change network_rankmod to return an indication of whether the rankmod is valid as a boolean instead of as a double, as discussed before.
This commit is contained in:
parent
e07b24e5d8
commit
dae897854b
@ -207,7 +207,7 @@ static const double rankmod_table[] = {
|
|||||||
0.2913406263, 0.2899228820, 0.2885345572, 0.2871745887,
|
0.2913406263, 0.2899228820, 0.2885345572, 0.2871745887,
|
||||||
};
|
};
|
||||||
|
|
||||||
double network_rankmod(uint32_t type, const char *ssid)
|
bool network_rankmod(const struct network *network, double *rankmod)
|
||||||
{
|
{
|
||||||
const struct l_queue_entry *entry;
|
const struct l_queue_entry *entry;
|
||||||
int n;
|
int n;
|
||||||
@ -217,10 +217,10 @@ double network_rankmod(uint32_t type, const char *ssid)
|
|||||||
entry = entry->next, n += 1) {
|
entry = entry->next, n += 1) {
|
||||||
const struct network_info *info = entry->data;
|
const struct network_info *info = entry->data;
|
||||||
|
|
||||||
if (info->type != type)
|
if (info->type != network->security)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (strcmp(info->ssid, ssid))
|
if (strcmp(info->ssid, network->ssid))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
nmax = L_ARRAY_SIZE(rankmod_table);
|
nmax = L_ARRAY_SIZE(rankmod_table);
|
||||||
@ -228,10 +228,11 @@ double network_rankmod(uint32_t type, const char *ssid)
|
|||||||
if (n >= nmax)
|
if (n >= nmax)
|
||||||
n = nmax - 1;
|
n = nmax - 1;
|
||||||
|
|
||||||
return rankmod_table[n];
|
*rankmod = rankmod_table[n];
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0.0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct network *network_create(struct device *device,
|
struct network *network_create(struct device *device,
|
||||||
|
@ -28,7 +28,7 @@ struct network;
|
|||||||
bool network_seen(struct network *network);
|
bool network_seen(struct network *network);
|
||||||
bool network_connected(struct network *network);
|
bool network_connected(struct network *network);
|
||||||
void network_disconnected(struct network *network);
|
void network_disconnected(struct network *network);
|
||||||
double network_rankmod(uint32_t type, const char *ssid);
|
bool network_rankmod(const struct network *network, double *rankmod);
|
||||||
|
|
||||||
struct network *network_create(struct device *device,
|
struct network *network_create(struct device *device,
|
||||||
uint8_t *ssid, uint8_t ssid_len,
|
uint8_t *ssid, uint8_t ssid_len,
|
||||||
|
@ -1267,8 +1267,8 @@ static void process_bss(struct device *device, struct scan_bss *bss)
|
|||||||
|
|
||||||
network_bss_add(network, bss);
|
network_bss_add(network, bss);
|
||||||
|
|
||||||
rankmod = network_rankmod(security, network_get_ssid(network));
|
/* See if network is autoconnectable (is a known network) */
|
||||||
if (rankmod == 0.0)
|
if (!network_rankmod(network, &rankmod))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
entry = l_new(struct autoconnect_entry, 1);
|
entry = l_new(struct autoconnect_entry, 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user