Blacklist BSS on first failure if only a single network is enabled

The special case of requiring blacklisting count to be 2 or higher
is only needed when more than a single network is currently enabled.
As such, we should not do that when only a single network is enabled.
This make the station more likely to follow network side load
balancing attempts where the current AP may disassociate us with
an assumption that we would move to another AP.
This commit is contained in:
Jouni Malinen 2010-11-26 11:23:50 +02:00 committed by Jouni Malinen
parent 34dbfc0cb3
commit 5471c3434e
2 changed files with 21 additions and 5 deletions

View file

@ -470,9 +470,24 @@ static struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
" wps" : ""); " wps" : "");
e = wpa_blacklist_get(wpa_s, bss->bssid); e = wpa_blacklist_get(wpa_s, bss->bssid);
if (e && e->count > 1) { if (e) {
wpa_printf(MSG_DEBUG, " skip - blacklisted"); int limit = 1;
return 0; if (wpa_supplicant_enabled_networks(wpa_s->conf) == 1) {
/*
* When only a single network is enabled, we can
* trigger blacklisting on the first failure. This
* should not be done with multiple enabled networks to
* avoid getting forced to move into a worse ESS on
* single error if there are no other BSSes of the
* current ESS.
*/
limit = 0;
}
if (e->count > limit) {
wpa_printf(MSG_DEBUG, " skip - blacklisted "
"(count=%d limit=%d)", e->count, limit);
return 0;
}
} }
if (ssid_len == 0) { if (ssid_len == 0) {

View file

@ -79,12 +79,13 @@ static int wpas_wps_in_use(struct wpa_config *conf,
int wpa_supplicant_enabled_networks(struct wpa_config *conf) int wpa_supplicant_enabled_networks(struct wpa_config *conf)
{ {
struct wpa_ssid *ssid = conf->ssid; struct wpa_ssid *ssid = conf->ssid;
int count = 0;
while (ssid) { while (ssid) {
if (!ssid->disabled) if (!ssid->disabled)
return 1; count++;
ssid = ssid->next; ssid = ssid->next;
} }
return 0; return count;
} }