Get PMKSA cache status as EAPOL alloc flag

No need to have a direct call from EAPOL authenticator to WPA
authenticator to figure this out for log output.
This commit is contained in:
Jouni Malinen 2009-11-29 19:21:56 +02:00
parent 5ed1c08fcd
commit c02d52b405
3 changed files with 20 additions and 15 deletions

View file

@ -297,7 +297,7 @@ SM_STATE(AUTH_PAE, AUTHENTICATED)
sm->reAuthCount = 0; sm->reAuthCount = 0;
if (sm->flags & EAPOL_SM_PREAUTH) if (sm->flags & EAPOL_SM_PREAUTH)
extra = " (pre-authentication)"; extra = " (pre-authentication)";
else if (wpa_auth_sta_get_pmksa(sm->sta->wpa_sm)) else if (sm->flags & EAPOL_SM_FROM_PMKSA_CACHE)
extra = " (PMKSA cache)"; extra = " (PMKSA cache)";
eapol_auth_vlogger(sm->eapol, sm->addr, EAPOL_LOGGER_INFO, eapol_auth_vlogger(sm->eapol, sm->addr, EAPOL_LOGGER_INFO,
"authenticated - EAP type: %d (%s)%s", "authenticated - EAP type: %d (%s)%s",

View file

@ -203,6 +203,7 @@ struct eapol_state_machine {
#define EAPOL_SM_PREAUTH BIT(0) #define EAPOL_SM_PREAUTH BIT(0)
#define EAPOL_SM_WAIT_START BIT(1) #define EAPOL_SM_WAIT_START BIT(1)
#define EAPOL_SM_USES_WPA BIT(2) #define EAPOL_SM_USES_WPA BIT(2)
#define EAPOL_SM_FROM_PMKSA_CACHE BIT(3)
int flags; /* EAPOL_SM_* */ int flags; /* EAPOL_SM_* */
/* EAPOL/AAA <-> EAP full authenticator interface */ /* EAPOL/AAA <-> EAP full authenticator interface */

View file

@ -645,6 +645,22 @@ static void handle_eap(struct hostapd_data *hapd, struct sta_info *sta,
} }
static struct eapol_state_machine *
ieee802_1x_alloc_eapol_sm(struct hostapd_data *hapd, struct sta_info *sta)
{
int flags = 0;
if (sta->flags & WLAN_STA_PREAUTH)
flags |= EAPOL_SM_PREAUTH;
if (sta->wpa_sm) {
if (wpa_auth_sta_get_pmksa(sta->wpa_sm))
flags |= EAPOL_SM_USES_WPA;
if (wpa_auth_sta_get_pmksa(sta->wpa_sm))
flags |= EAPOL_SM_FROM_PMKSA_CACHE;
}
return eapol_auth_alloc(hapd->eapol_auth, sta->addr, flags, sta);
}
/** /**
* ieee802_1x_receive - Process the EAPOL frames from the Supplicant * ieee802_1x_receive - Process the EAPOL frames from the Supplicant
* @hapd: hostapd BSS data * @hapd: hostapd BSS data
@ -719,13 +735,7 @@ void ieee802_1x_receive(struct hostapd_data *hapd, const u8 *sa, const u8 *buf,
return; return;
if (!sta->eapol_sm) { if (!sta->eapol_sm) {
int flags = 0; sta->eapol_sm = ieee802_1x_alloc_eapol_sm(hapd, sta);
if (sta->flags & WLAN_STA_PREAUTH)
flags |= EAPOL_SM_PREAUTH;
if (sta->wpa_sm)
flags |= EAPOL_SM_USES_WPA;
sta->eapol_sm = eapol_auth_alloc(hapd->eapol_auth, sta->addr,
flags, sta);
if (!sta->eapol_sm) if (!sta->eapol_sm)
return; return;
@ -840,15 +850,9 @@ void ieee802_1x_new_station(struct hostapd_data *hapd, struct sta_info *sta)
return; return;
if (sta->eapol_sm == NULL) { if (sta->eapol_sm == NULL) {
int flags = 0;
if (sta->flags & WLAN_STA_PREAUTH)
flags |= EAPOL_SM_PREAUTH;
if (sta->wpa_sm)
flags |= EAPOL_SM_USES_WPA;
hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X, hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
HOSTAPD_LEVEL_DEBUG, "start authentication"); HOSTAPD_LEVEL_DEBUG, "start authentication");
sta->eapol_sm = eapol_auth_alloc(hapd->eapol_auth, sta->addr, sta->eapol_sm = ieee802_1x_alloc_eapol_sm(hapd, sta);
flags, sta);
if (sta->eapol_sm == NULL) { if (sta->eapol_sm == NULL) {
hostapd_logger(hapd, sta->addr, hostapd_logger(hapd, sta->addr,
HOSTAPD_MODULE_IEEE8021X, HOSTAPD_MODULE_IEEE8021X,