3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 13:02:44 +01:00

station: Check return of network_bss_select

network_bss_select can return NULL if no suitable BSSes are found, or if
all of them are blacklisted.  Make sure to skip the network if this
happens.
This commit is contained in:
Denis Kenzior 2021-05-19 09:56:59 -05:00
parent 877d910a44
commit 66b73262df

View File

@ -177,17 +177,19 @@ static void station_autoconnect_next(struct station *station)
const char *ssid = network_get_ssid(network);
struct scan_bss *bss = network_bss_select(network, false);
l_debug("Considering autoconnecting to BSS '%s' with SSID: %s,"
" freq: %u, rank: %u, strength: %i",
util_address_to_string(bss->addr), ssid,
l_debug("autoconnect: Trying SSID: %s", ssid);
if (!bss) {
l_debug("autoconnect: No suitable BSSes found");
continue;
}
l_debug("autoconnect: '%s' freq: %u, rank: %u, strength: %i",
util_address_to_string(bss->addr),
bss->frequency, bss->rank,
bss->signal_strength);
if (blacklist_contains_bss(bss->addr))
continue;
r = network_autoconnect(network, bss);
if (!r) {
station_enter_state(station, STATION_STATE_CONNECTING);
@ -200,7 +202,8 @@ static void station_autoconnect_next(struct station *station)
return;
} else
l_debug("Failed to autoconnect to %s (%d)", ssid, r);
l_debug("autoconnect: network_autoconnect: %s (%d)",
strerror(-r), r);
}
}