]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Add EAPOL authenticator event callback
authorJouni Malinen <j@w1.fi>
Sun, 29 Nov 2009 17:31:50 +0000 (19:31 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 29 Nov 2009 17:31:50 +0000 (19:31 +0200)
This avoids direct calls to WPA authenticator from eapol_sm.c.

hostapd/eapol_sm.c
hostapd/eapol_sm.h
hostapd/ieee802_1x.c

index a6e6c18bd10faec7b1a072f69bcf697416e7af57..32dd6049e7e88c4fbbc9cef53570bfeebb80ae4f 100644 (file)
@@ -18,7 +18,6 @@
 #include "eapol_sm.h"
 #include "eloop.h"
 #include "common/eapol_common.h"
-#include "wpa.h"
 #include "sta_info.h"
 #include "eap_server/eap.h"
 #include "state_machine.h"
@@ -611,7 +610,8 @@ SM_STATE(REAUTH_TIMER, REAUTHENTICATE)
        SM_ENTRY_MA(REAUTH_TIMER, REAUTHENTICATE, reauth_timer);
 
        sm->reAuthenticate = TRUE;
-       wpa_auth_sm_event(sm->sta->wpa_sm, WPA_REAUTH_EAPOL);
+       sm->eapol->cb.eapol_event(sm->hapd, sm->sta,
+                                 EAPOL_AUTH_REAUTHENTICATE);
 }
 
 
@@ -935,7 +935,8 @@ restart:
        }
 
        if (eapol_sm_sta_entry_alive(eapol, addr))
-               wpa_auth_sm_notify(sm->sta->wpa_sm);
+               sm->eapol->cb.eapol_event(sm->hapd, sm->sta,
+                                         EAPOL_AUTH_SM_CHANGE);
 }
 
 
index 14b5fe648dec2b98642d0432b9b7a1bf5d6e6e56..2832d6ec50876485952e65529c1d53f87de4602f 100644 (file)
@@ -63,6 +63,11 @@ typedef enum {
        EAPOL_LOGGER_DEBUG, EAPOL_LOGGER_INFO, EAPOL_LOGGER_WARNING
 } eapol_logger_level;
 
+enum eapol_event {
+       EAPOL_AUTH_SM_CHANGE,
+       EAPOL_AUTH_REAUTHENTICATE
+};
+
 struct eapol_auth_cb {
        void (*eapol_send)(void *ctx, void *sta_ctx, u8 type, const u8 *data,
                           size_t datalen);
@@ -77,6 +82,7 @@ struct eapol_auth_cb {
        void (*set_port_authorized)(void *ctx, void *sta_ctx, int authorized);
        void (*abort_auth)(void *ctx, void *sta_ctx);
        void (*tx_key)(void *ctx, void *sta_ctx);
+       void (*eapol_event)(void *ctx, void *sta_ctx, enum eapol_event type);
 };
 
 /**
index aa4965fd10a16f94741d0548b87b7003d40a3b44..8a7b5cc399223871d0ce516fde56f2e87371864b 100644 (file)
@@ -1642,6 +1642,22 @@ static void _ieee802_1x_tx_key(void *ctx, void *sta_ctx)
 }
 
 
+static void ieee802_1x_eapol_event(void *ctx, void *sta_ctx,
+                                  enum eapol_event type)
+{
+       /* struct hostapd_data *hapd = ctx; */
+       struct sta_info *sta = sta_ctx;
+       switch (type) {
+       case EAPOL_AUTH_SM_CHANGE:
+               wpa_auth_sm_notify(sta->wpa_sm);
+               break;
+       case EAPOL_AUTH_REAUTHENTICATE:
+               wpa_auth_sm_event(sta->wpa_sm, WPA_REAUTH_EAPOL);
+               break;
+       }
+}
+
+
 int ieee802_1x_init(struct hostapd_data *hapd)
 {
        int i;
@@ -1679,6 +1695,7 @@ int ieee802_1x_init(struct hostapd_data *hapd)
        cb.set_port_authorized = ieee802_1x_set_port_authorized;
        cb.abort_auth = _ieee802_1x_abort_auth;
        cb.tx_key = _ieee802_1x_tx_key;
+       cb.eapol_event = ieee802_1x_eapol_event;
 
        hapd->eapol_auth = eapol_auth_init(&conf, &cb);
        if (hapd->eapol_auth == NULL)