From: David Spinadel <david.spinadel@xxxxxxxxx> In some cases, after a sudden AP disappearing and reconnection to another AP in the same ESS, if another scan ocures, wpa_supplicant might try to roam to the old AP (if it was better ranked than the new one) because it is still saved in BSS list and the blacklist entry was cleared in previous reconnect. This attempt is going to fail because the AP is not present anymore and it'll cause long disconnections. Remove an AP that is probably out of range from BSS list to avoid such disconnections. Signed-off-by: David Spinadel <david.spinadel@xxxxxxxxx> --- wpa_supplicant/bss.c | 4 ++-- wpa_supplicant/bss.h | 2 ++ wpa_supplicant/events.c | 12 ++++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/wpa_supplicant/bss.c b/wpa_supplicant/bss.c index 3687a2e..3a8778d 100644 --- a/wpa_supplicant/bss.c +++ b/wpa_supplicant/bss.c @@ -214,8 +214,8 @@ static void wpa_bss_update_pending_connect(struct wpa_supplicant *wpa_s, } -static void wpa_bss_remove(struct wpa_supplicant *wpa_s, struct wpa_bss *bss, - const char *reason) +void wpa_bss_remove(struct wpa_supplicant *wpa_s, struct wpa_bss *bss, + const char *reason) { if (wpa_s->last_scan_res) { unsigned int i; diff --git a/wpa_supplicant/bss.h b/wpa_supplicant/bss.h index f7f72f3..84e8fb0 100644 --- a/wpa_supplicant/bss.h +++ b/wpa_supplicant/bss.h @@ -113,6 +113,8 @@ void wpa_bss_update_start(struct wpa_supplicant *wpa_s); void wpa_bss_update_scan_res(struct wpa_supplicant *wpa_s, struct wpa_scan_res *res, struct os_reltime *fetch_time); +void wpa_bss_remove(struct wpa_supplicant *wpa_s, struct wpa_bss *bss, + const char *reason); void wpa_bss_update_end(struct wpa_supplicant *wpa_s, struct scan_info *info, int new_scan); int wpa_bss_init(struct wpa_supplicant *wpa_s); diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 1bb646d..63fba4d 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -2530,6 +2530,7 @@ static void wpa_supplicant_event_disassoc_finish(struct wpa_supplicant *wpa_s, struct wpa_bss *fast_reconnect = NULL; struct wpa_ssid *fast_reconnect_ssid = NULL; struct wpa_ssid *last_ssid; + struct wpa_bss *curr = NULL; authenticating = wpa_s->wpa_state == WPA_AUTHENTICATING; os_memcpy(prev_pending_bssid, wpa_s->pending_bssid, ETH_ALEN); @@ -2545,6 +2546,14 @@ static void wpa_supplicant_event_disassoc_finish(struct wpa_supplicant *wpa_s, return; } + if (!wpa_s->disconnected && wpa_s->wpa_state >= WPA_AUTHENTICATING && + reason_code == WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY && + locally_generated) + /* Remove the inactive AP (which is probably out of range) from + * BSS list after marking disassoc. + */ + curr = wpa_s->current_bss; + if (could_be_psk_mismatch(wpa_s, reason_code, locally_generated)) { wpa_msg(wpa_s, MSG_INFO, "WPA: 4-Way Handshake failed - " "pre-shared key may be incorrect"); @@ -2617,6 +2626,9 @@ static void wpa_supplicant_event_disassoc_finish(struct wpa_supplicant *wpa_s, last_ssid = wpa_s->current_ssid; wpa_supplicant_mark_disassoc(wpa_s); + if (curr) + wpa_bss_remove(wpa_s, curr, "Connection to AP lost"); + if (authenticating && (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME)) { sme_disassoc_while_authenticating(wpa_s, prev_pending_bssid); wpa_s->current_ssid = last_ssid; -- 1.9.1 _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap