From 02a0a23939b779e8e19c57b5bc8d8964ffd26ed9 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 10 Feb 2019 13:41:10 +0200 Subject: [PATCH] RSN: Do not start preauthentication timer without candidates There is no need to schedule the postponed RSN preauthentication start if there are no candidates. Avoid wasting eloop resources for this. This is most useful for fuzz testing of the 4-way handshake implementation to avoid getting stuck waiting for this unnecessary one second time when using eloop to coordinate the Authenticator and Supplicant state machines. Signed-off-by: Jouni Malinen --- src/rsn_supp/wpa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/rsn_supp/wpa.c b/src/rsn_supp/wpa.c index 18f8c7158..6b27539e7 100644 --- a/src/rsn_supp/wpa.c +++ b/src/rsn_supp/wpa.c @@ -715,7 +715,9 @@ static void wpa_supplicant_key_neg_complete(struct wpa_sm *sm, * likelihood of the first preauth EAPOL-Start frame getting to * the target AP. */ - eloop_register_timeout(1, 0, wpa_sm_start_preauth, sm, NULL); + if (!dl_list_empty(&sm->pmksa_candidates)) + eloop_register_timeout(1, 0, wpa_sm_start_preauth, + sm, NULL); } if (sm->cur_pmksa && sm->cur_pmksa->opportunistic) {