3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-10-04 02:18:49 +02:00

eapol: provide feedback from eapol_start, refactor

This commit is contained in:
Tim Kourt 2017-10-27 14:39:53 -07:00 committed by Denis Kenzior
parent 569be488d0
commit 3f4b5a98f5
2 changed files with 19 additions and 17 deletions

View File

@ -1814,22 +1814,8 @@ void eapol_register(struct eapol_sm *sm)
eapol_rx_packet, sm); eapol_rx_packet, sm);
} }
void eapol_start(struct eapol_sm *sm) bool eapol_start(struct eapol_sm *sm)
{ {
if (sm->require_handshake)
sm->timeout = l_timeout_create(2, eapol_timeout, sm, NULL);
sm->started = true;
if (sm->use_eapol_start) {
/*
* We start a short timeout, if EAP packets are not received
* from AP, then we send the EAPoL-Start
*/
sm->eapol_start_timeout =
l_timeout_create(1, send_eapol_start, sm, NULL);
}
if (sm->handshake->settings_8021x) { if (sm->handshake->settings_8021x) {
sm->eap = eap_new(eapol_eap_msg_cb, eapol_eap_complete_cb, sm); sm->eap = eap_new(eapol_eap_msg_cb, eapol_eap_complete_cb, sm);
@ -1848,6 +1834,20 @@ void eapol_start(struct eapol_sm *sm)
eap_set_event_func(sm->eap, eapol_eap_event_cb); eap_set_event_func(sm->eap, eapol_eap_event_cb);
} }
sm->started = true;
if (sm->require_handshake)
sm->timeout = l_timeout_create(2, eapol_timeout, sm, NULL);
if (sm->use_eapol_start) {
/*
* We start a short timeout, if EAP packets are not received
* from AP, then we send the EAPoL-Start
*/
sm->eapol_start_timeout =
l_timeout_create(1, send_eapol_start, sm, NULL);
}
/* Process any frames received early due to scheduling */ /* Process any frames received early due to scheduling */
if (sm->early_frame) { if (sm->early_frame) {
eapol_rx_packet(ETH_P_PAE, sm->handshake->aa, eapol_rx_packet(ETH_P_PAE, sm->handshake->aa,
@ -1856,11 +1856,13 @@ void eapol_start(struct eapol_sm *sm)
sm->early_frame = NULL; sm->early_frame = NULL;
} }
return; return true;
eap_error: eap_error:
l_error("Error initializing EAP for ifindex %i", l_error("Error initializing EAP for ifindex %i",
(int) sm->handshake->ifindex); (int) sm->handshake->ifindex);
return false;
} }
struct eapol_frame_watch { struct eapol_frame_watch {

View File

@ -197,7 +197,7 @@ void eapol_sm_set_user_data(struct eapol_sm *sm, void *user_data);
void eapol_sm_set_event_func(struct eapol_sm *sm, eapol_sm_event_func_t func); 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_register(struct eapol_sm *sm);
void eapol_start(struct eapol_sm *sm); bool eapol_start(struct eapol_sm *sm);
uint32_t eapol_frame_watch_add(uint32_t ifindex, uint32_t eapol_frame_watch_add(uint32_t ifindex,
eapol_frame_watch_func_t handler, eapol_frame_watch_func_t handler,