WPS: Fix failure path to allow WSC_NACK and EAP-Failure to be exchanged

Commit c7a67a7719 forced disconnection
when wpas_clear_wps() is called. Call this function from a registered
timeout when processing a failure event in order to allow the WPS
handshake to be completed with WSC_NACK and EAP-Failure.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2013-08-23 17:43:01 +03:00 committed by Jouni Malinen
parent 3351a3847c
commit 2e145e91e7

View file

@ -567,6 +567,14 @@ static void wpa_supplicant_wps_event_m2d(struct wpa_supplicant *wpa_s,
}
static void wpas_wps_clear_timeout(void *eloop_ctx, void *timeout_ctx)
{
struct wpa_supplicant *wpa_s = eloop_ctx;
wpa_printf(MSG_DEBUG, "WPS: Clear WPS network from timeout");
wpas_clear_wps(wpa_s);
}
static void wpa_supplicant_wps_event_fail(struct wpa_supplicant *wpa_s,
struct wps_event_fail *fail)
{
@ -591,7 +599,14 @@ static void wpa_supplicant_wps_event_fail(struct wpa_supplicant *wpa_s,
"msg=%d config_error=%d",
fail->msg, fail->config_error);
}
wpas_clear_wps(wpa_s);
/*
* Need to allow WPS processing to complete, e.g., by sending WSC_NACK.
*/
wpa_printf(MSG_DEBUG, "WPS: Register timeout to clear WPS network");
eloop_cancel_timeout(wpas_wps_clear_timeout, wpa_s, NULL);
eloop_register_timeout(0, 100000, wpas_wps_clear_timeout, wpa_s, NULL);
wpas_notify_wps_event_fail(wpa_s, fail);
#ifdef CONFIG_P2P
wpas_p2p_wps_failed(wpa_s, fail);
@ -1385,6 +1400,7 @@ int wpas_wps_init(struct wpa_supplicant *wpa_s)
void wpas_wps_deinit(struct wpa_supplicant *wpa_s)
{
eloop_cancel_timeout(wpas_wps_timeout, wpa_s, NULL);
eloop_cancel_timeout(wpas_wps_clear_timeout, wpa_s, NULL);
eloop_cancel_timeout(wpas_wps_reenable_networks_cb, wpa_s, NULL);
wpas_wps_clear_ap_info(wpa_s);