From 4e9ed2d686dc4145f72ce1ad4e21f8f87aa60aa6 Mon Sep 17 00:00:00 2001 From: Andrew Zaborowski Date: Sat, 15 Apr 2017 13:58:47 +0200 Subject: [PATCH] eapol: Add eapol_start_preauthentication Add a wrapper for eapol_start that sets the sm->preauth flag and sends the EAPOL-Start frame immediately to skip the timeout since we know that the supplicant has to initiate the authentication. --- src/eapol.c | 16 ++++++++++++++++ src/eapol.h | 1 + 2 files changed, 17 insertions(+) diff --git a/src/eapol.c b/src/eapol.c index e11a90e2..e4698e32 100644 --- a/src/eapol.c +++ b/src/eapol.c @@ -728,6 +728,7 @@ struct eapol_sm { bool have_replay:1; bool started:1; bool use_eapol_start:1; + bool preauth:1; struct eap_state *eap; struct eapol_buffer *early_frame; }; @@ -1677,6 +1678,21 @@ eap_error: (int) sm->handshake->ifindex); } +void eapol_start_preauthentication(struct eapol_sm *sm) +{ + /* + * The only difference here is that we send the EAPOL-Start immeditely + * instead of in a timeout, and we set sm->preauth so that pae_write + * uses the preauthentication protocol id. + */ + + sm->use_eapol_start = false; + sm->preauth = true; + + eapol_start(sm); + send_eapol_start(NULL, sm); +} + bool eapol_init() { state_machines = l_queue_new(); diff --git a/src/eapol.h b/src/eapol.h index 3afb0813..651aadc6 100644 --- a/src/eapol.h +++ b/src/eapol.h @@ -182,6 +182,7 @@ void eapol_sm_set_event_func(struct eapol_sm *sm, eapol_sm_event_func_t func); void eapol_register(struct eapol_sm *sm); void eapol_start(struct eapol_sm *sm); +void eapol_start_preauthentication(struct eapol_sm *sm); void eapol_pae_open(); void eapol_pae_close();