From 9301f6515e971a24cb99fc21a272147f3ee1bc9e Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Tue, 6 Jul 2010 12:58:15 -0700 Subject: [PATCH] WPS: Reduce client timeout with EAP-WSC to avoid long wait This works around issues with EAP-Failure getting lost for some reason. Instead of waiting up to 60 seconds on a timeout, 30 second timeout is now used and whenever the provisioning step has been completed (either successfully or unsuccessfully), this timeout is reduced to 2 seconds. --- src/eap_peer/eap_wsc.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/eap_peer/eap_wsc.c b/src/eap_peer/eap_wsc.c index 9a0354e10..8317f728f 100644 --- a/src/eap_peer/eap_wsc.c +++ b/src/eap_peer/eap_wsc.c @@ -226,6 +226,10 @@ static void * eap_wsc_init(struct eap_sm *sm) cfg.pin, cfg.pin_len, 0); } + /* Use reduced client timeout for WPS to avoid long wait */ + if (sm->ClientTimeout > 30) + sm->ClientTimeout = 30; + return data; } @@ -381,6 +385,7 @@ static struct wpabuf * eap_wsc_process(struct eap_sm *sm, void *priv, u16 message_length = 0; enum wps_process_res res; struct wpabuf tmpbuf; + struct wpabuf *r; pos = eap_hdr_validate(EAP_VENDOR_WFA, EAP_VENDOR_TYPE_WSC, reqData, &len); @@ -506,7 +511,13 @@ send_msg: } eap_wsc_state(data, MESG); - return eap_wsc_build_msg(data, ret, id); + r = eap_wsc_build_msg(data, ret, id); + if (data->state == FAIL && ret->methodState == METHOD_DONE) { + /* Use reduced client timeout for WPS to avoid long wait */ + if (sm->ClientTimeout > 2) + sm->ClientTimeout = 2; + } + return r; }