From: Shaul Triebitz <shaul.triebitz@xxxxxxxxx> In ap_scan=2 mode, wpa_supplicant_assoc_try does not check whether the SSID is temp disabled before trying to associate and may result in an infinite connect/disconnect loop. If the association succeeds while the SSID is temp disabled, wpa_s will request to deauthenticate and that in turn will cause the SSID to be temp disabled again. Fix that by postponing the association until the SSID is no longer temp disabled. Signed-off-by: Shaul Triebitz <shaul.triebitz@xxxxxxxxx> --- wpa_supplicant/events.c | 3 +-- wpa_supplicant/scan.c | 16 +++++++++++++--- wpa_supplicant/wpa_supplicant_i.h | 1 + 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 4ef8e28..f81a7c5 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -54,8 +54,7 @@ static int wpas_select_network_from_last_scan(struct wpa_supplicant *wpa_s, #endif /* CONFIG_NO_SCAN_PROCESSING */ -static int wpas_temp_disabled(struct wpa_supplicant *wpa_s, - struct wpa_ssid *ssid) +int wpas_temp_disabled(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid) { struct os_reltime now; diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c index 413abf6..a4b26fd 100644 --- a/wpa_supplicant/scan.c +++ b/wpa_supplicant/scan.c @@ -117,9 +117,19 @@ int wpa_supplicant_enabled_networks(struct wpa_supplicant *wpa_s) static void wpa_supplicant_assoc_try(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid) { + int min_temp_disabled = 0; + while (ssid) { - if (!wpas_network_disabled(wpa_s, ssid)) - break; + if (!wpas_network_disabled(wpa_s, ssid)) { + int temp_disabled = wpas_temp_disabled(wpa_s, ssid); + + if (!temp_disabled) + break; + + if (!min_temp_disabled || + temp_disabled < min_temp_disabled) + min_temp_disabled = temp_disabled; + } ssid = ssid->next; } @@ -128,7 +138,7 @@ static void wpa_supplicant_assoc_try(struct wpa_supplicant *wpa_s, wpa_dbg(wpa_s, MSG_DEBUG, "wpa_supplicant_assoc_try: Reached " "end of scan list - go back to beginning"); wpa_s->prev_scan_ssid = WILDCARD_SSID_SCAN; - wpa_supplicant_req_scan(wpa_s, 0, 0); + wpa_supplicant_req_scan(wpa_s, min_temp_disabled, 0); return; } if (ssid->next) { diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index 50d65ab..280c7e6 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -1404,4 +1404,5 @@ int wpas_ctrl_iface_get_pref_freq_list_override(struct wpa_supplicant *wpa_s, unsigned int *num, unsigned int *freq_list); +int wpas_temp_disabled(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid); #endif /* WPA_SUPPLICANT_I_H */ -- 1.9.1 _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap