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.
This commit is contained in:
Jouni Malinen 2010-07-06 12:58:15 -07:00 committed by Jouni Malinen
parent 3239706303
commit 9301f6515e

View file

@ -226,6 +226,10 @@ static void * eap_wsc_init(struct eap_sm *sm)
cfg.pin, cfg.pin_len, 0); 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; return data;
} }
@ -381,6 +385,7 @@ static struct wpabuf * eap_wsc_process(struct eap_sm *sm, void *priv,
u16 message_length = 0; u16 message_length = 0;
enum wps_process_res res; enum wps_process_res res;
struct wpabuf tmpbuf; struct wpabuf tmpbuf;
struct wpabuf *r;
pos = eap_hdr_validate(EAP_VENDOR_WFA, EAP_VENDOR_TYPE_WSC, reqData, pos = eap_hdr_validate(EAP_VENDOR_WFA, EAP_VENDOR_TYPE_WSC, reqData,
&len); &len);
@ -506,7 +511,13 @@ send_msg:
} }
eap_wsc_state(data, MESG); 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;
} }