aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/dpp_supplicant.c
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2017-11-22 22:42:20 (GMT)
committerJouni Malinen <j@w1.fi>2017-11-22 22:42:20 (GMT)
commit921f5acd17240ba05639628732d86f5eaeabf3e7 (patch)
tree0f4097aaf1a319c54bbb388b66dfa63b41f303c9 /wpa_supplicant/dpp_supplicant.c
parent248264c6221a6954309c310e6393cd4775bf805c (diff)
downloadhostap-921f5acd17240ba05639628732d86f5eaeabf3e7.zip
hostap-921f5acd17240ba05639628732d86f5eaeabf3e7.tar.gz
hostap-921f5acd17240ba05639628732d86f5eaeabf3e7.tar.bz2
DPP: Take response wait time into account for init retries
Previously, the Authentication Request frame was retried after 2+10 = 12 seconds since the wait for the response was not accounted for. Substract that wait from the 10 second wait time to start the retries more quickly based on the 10 second timer described in the tech spec. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Diffstat (limited to 'wpa_supplicant/dpp_supplicant.c')
-rw-r--r--wpa_supplicant/dpp_supplicant.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/wpa_supplicant/dpp_supplicant.c b/wpa_supplicant/dpp_supplicant.c
index 40506da..f8a450d 100644
--- a/wpa_supplicant/dpp_supplicant.c
+++ b/wpa_supplicant/dpp_supplicant.c
@@ -657,7 +657,8 @@ static int wpas_dpp_auth_init_next(struct wpa_supplicant *wpa_s)
{
struct dpp_authentication *auth = wpa_s->dpp_auth;
const u8 *dst;
- unsigned int wait_time, freq, max_tries;
+ unsigned int wait_time, freq, max_tries, used;
+ struct os_reltime now, diff;
if (!auth)
return -1;
@@ -684,6 +685,15 @@ static int wpas_dpp_auth_init_next(struct wpa_supplicant *wpa_s)
wait_time = wpa_s->dpp_init_retry_time;
else
wait_time = 10000;
+ os_get_reltime(&now);
+ os_reltime_sub(&now, &wpa_s->dpp_last_init, &diff);
+ used = diff.sec * 1000 + diff.usec / 1000;
+ if (used > wait_time)
+ wait_time = 0;
+ else
+ wait_time -= used;
+ wpa_printf(MSG_DEBUG, "DPP: Next init attempt in %u ms",
+ wait_time);
eloop_register_timeout(wait_time / 1000,
(wait_time % 1000) * 1000,
wpas_dpp_init_timeout, wpa_s,