3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-22 06:19:34 +01:00

network: fix OWE transition BSS selection

The selection loop was choosing an initial candidate purely for
use of the "fallback_to_blacklist" flag. But we have a similar
case with OWE transitional networks where we avoid the legacy
open network in preference for OWE:

/* Don't want to connect to the Open BSS if possible */
if (!bss->rsne)
	continue;

If no OWE network gets selected we may iterate all BSS's and end
the loop, which then returns NULL.

To fix this move the blacklist check earlier and still ignore any
BSS's in the blacklist. Also add a new flag in the selection loop
indicating an open network was skipped. If we then exhaust all
other BSS's we can return this candidate.
This commit is contained in:
James Prestwood 2024-10-23 11:29:11 -07:00 committed by Denis Kenzior
parent 31787e3788
commit a6edf6f31e

View File

@ -1281,6 +1281,7 @@ struct scan_bss *network_bss_select(struct network *network,
struct l_queue *bss_list = network->bss_list; struct l_queue *bss_list = network->bss_list;
const struct l_queue_entry *bss_entry; const struct l_queue_entry *bss_entry;
struct scan_bss *candidate = NULL; struct scan_bss *candidate = NULL;
bool skipped_open = false;
for (bss_entry = l_queue_get_entries(bss_list); bss_entry; for (bss_entry = l_queue_get_entries(bss_list); bss_entry;
bss_entry = bss_entry->next) { bss_entry = bss_entry->next) {
@ -1300,22 +1301,26 @@ struct scan_bss *network_bss_select(struct network *network,
if (!candidate) if (!candidate)
candidate = bss; candidate = bss;
/* check if temporarily blacklisted */
if (l_queue_find(network->blacklist, match_bss, bss))
continue;
if (blacklist_contains_bss(bss->addr))
continue;
/* OWE Transition BSS */ /* OWE Transition BSS */
if (bss->owe_trans) { if (bss->owe_trans) {
/* Don't want to connect to the Open BSS if possible */ /* Don't want to connect to the Open BSS if possible */
if (!bss->rsne) if (!bss->rsne) {
skipped_open = true;
continue; continue;
}
/* Candidate is not OWE, set this as new candidate */ /* Candidate is not OWE, set this as new candidate */
if (!(candidate->owe_trans && candidate->rsne)) if (!(candidate->owe_trans && candidate->rsne))
candidate = bss; candidate = bss;
} }
/* check if temporarily blacklisted */
if (l_queue_find(network->blacklist, match_bss, bss))
continue;
if (!blacklist_contains_bss(bss->addr))
return bss; return bss;
} }
@ -1323,7 +1328,7 @@ struct scan_bss *network_bss_select(struct network *network,
* No BSS was found, but if we are falling back to blacklisted BSS's we * No BSS was found, but if we are falling back to blacklisted BSS's we
* can just use the first connectable candidate found above. * can just use the first connectable candidate found above.
*/ */
if (fallback_to_blacklist) if (fallback_to_blacklist || skipped_open)
return candidate; return candidate;
return NULL; return NULL;