diff --git a/src/eapol.c b/src/eapol.c index dbef66f5..f2a5611f 100644 --- a/src/eapol.c +++ b/src/eapol.c @@ -2167,10 +2167,8 @@ static void eapol_eap_event_cb(unsigned int event, { struct eapol_sm *sm = user_data; - if (!sm->event_func) - return; - - sm->event_func(event, event_data, sm->user_data); + handshake_event(sm->handshake, HANDSHAKE_EVENT_EAP_NOTIFY, event, + event_data); } void eapol_sm_set_use_eapol_start(struct eapol_sm *sm, bool enabled) diff --git a/src/handshake.h b/src/handshake.h index 5cd4690c..3f5bbab0 100644 --- a/src/handshake.h +++ b/src/handshake.h @@ -50,6 +50,7 @@ enum handshake_event { HANDSHAKE_EVENT_COMPLETE, HANDSHAKE_EVENT_FAILED, HANDSHAKE_EVENT_REKEY_FAILED, + HANDSHAKE_EVENT_EAP_NOTIFY, }; typedef void (*handshake_event_func_t)(struct handshake_state *hs, diff --git a/src/station.c b/src/station.c index e88adf36..5e1d2468 100644 --- a/src/station.c +++ b/src/station.c @@ -676,6 +676,7 @@ static void station_handshake_event(struct handshake_state *hs, break; case HANDSHAKE_EVENT_COMPLETE: case HANDSHAKE_EVENT_SETTING_KEYS_FAILED: + case HANDSHAKE_EVENT_EAP_NOTIFY: /* * currently we dont care about any other events. The * netdev_connect_cb will notify us when the connection is diff --git a/src/wsc.c b/src/wsc.c index 04187f5b..fcaae36f 100644 --- a/src/wsc.c +++ b/src/wsc.c @@ -363,16 +363,7 @@ static void wsc_credential_obtained(struct wsc *wsc, static void wsc_eapol_event(uint32_t event, const void *event_data, void *user_data) { - struct wsc *wsc = user_data; - - switch (event) { - case EAP_WSC_EVENT_CREDENTIAL_OBTAINED: - wsc_credential_obtained(wsc, - (const struct wsc_credential *) event_data); - break; - default: - l_debug("Got event: %d", event); - } + l_debug("Got event: %d", event); } static void wsc_netdev_event(struct netdev *netdev, enum netdev_event event, @@ -405,6 +396,7 @@ static void wsc_handshake_event(struct handshake_state *hs, enum handshake_event event, void *user_data, ...) { + struct wsc *wsc = user_data; va_list args; va_start(args, user_data); @@ -413,6 +405,21 @@ static void wsc_handshake_event(struct handshake_state *hs, case HANDSHAKE_EVENT_FAILED: netdev_handshake_failed(hs, va_arg(args, int)); break; + case HANDSHAKE_EVENT_EAP_NOTIFY: + { + unsigned int eap_event = va_arg(args, unsigned int); + + switch (eap_event) { + case EAP_WSC_EVENT_CREDENTIAL_OBTAINED: + wsc_credential_obtained(wsc, + va_arg(args, const struct wsc_credential *)); + break; + default: + l_debug("Got event: %d", eap_event); + } + + break; + } default: break; }