Initialize EAPOL authenticator flags during allocation
Store both preauthentication and WPA use status with EAPOL flags.
This commit is contained in:
parent
fa04fa1005
commit
5ed1c08fcd
3 changed files with 19 additions and 11 deletions
|
@ -664,7 +664,7 @@ SM_STEP(AUTH_KEY_TX)
|
|||
switch (sm->auth_key_tx_state) {
|
||||
case AUTH_KEY_TX_NO_KEY_TRANSMIT:
|
||||
if (sm->keyTxEnabled && sm->eap_if->eapKeyAvailable &&
|
||||
sm->keyRun && !wpa_auth_sta_wpa_version(sm->sta->wpa_sm))
|
||||
sm->keyRun && !(sm->flags & EAPOL_SM_USES_WPA))
|
||||
SM_ENTER(AUTH_KEY_TX, KEY_TRANSMIT);
|
||||
break;
|
||||
case AUTH_KEY_TX_KEY_TRANSMIT:
|
||||
|
@ -758,7 +758,7 @@ SM_STEP(CTRL_DIR)
|
|||
|
||||
struct eapol_state_machine *
|
||||
eapol_auth_alloc(struct eapol_authenticator *eapol, const u8 *addr,
|
||||
int preauth, struct sta_info *sta)
|
||||
int flags, struct sta_info *sta)
|
||||
{
|
||||
struct eapol_state_machine *sm;
|
||||
struct hostapd_data *hapd; /* TODO: to be removed */
|
||||
|
@ -776,8 +776,7 @@ eapol_auth_alloc(struct eapol_authenticator *eapol, const u8 *addr,
|
|||
}
|
||||
sm->radius_identifier = -1;
|
||||
os_memcpy(sm->addr, addr, ETH_ALEN);
|
||||
if (preauth)
|
||||
sm->flags |= EAPOL_SM_PREAUTH;
|
||||
sm->flags = flags;
|
||||
|
||||
sm->hapd = hapd;
|
||||
sm->eapol = eapol;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* hostapd / IEEE 802.1X-2004 Authenticator - EAPOL state machine
|
||||
* Copyright (c) 2002-2007, Jouni Malinen <j@w1.fi>
|
||||
* IEEE 802.1X-2004 Authenticator - EAPOL state machine
|
||||
* Copyright (c) 2002-2009, Jouni Malinen <j@w1.fi>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
|
@ -202,6 +202,7 @@ struct eapol_state_machine {
|
|||
u8 addr[ETH_ALEN]; /* Supplicant address */
|
||||
#define EAPOL_SM_PREAUTH BIT(0)
|
||||
#define EAPOL_SM_WAIT_START BIT(1)
|
||||
#define EAPOL_SM_USES_WPA BIT(2)
|
||||
int flags; /* EAPOL_SM_* */
|
||||
|
||||
/* EAPOL/AAA <-> EAP full authenticator interface */
|
||||
|
@ -243,7 +244,7 @@ struct eapol_authenticator * eapol_auth_init(struct eapol_auth_config *conf,
|
|||
void eapol_auth_deinit(struct eapol_authenticator *eapol);
|
||||
struct eapol_state_machine *
|
||||
eapol_auth_alloc(struct eapol_authenticator *eapol, const u8 *addr,
|
||||
int preauth, struct sta_info *sta);
|
||||
int flags, struct sta_info *sta);
|
||||
void eapol_auth_free(struct eapol_state_machine *sm);
|
||||
void eapol_auth_step(struct eapol_state_machine *sm);
|
||||
void eapol_auth_initialize(struct eapol_state_machine *sm);
|
||||
|
|
|
@ -719,9 +719,13 @@ void ieee802_1x_receive(struct hostapd_data *hapd, const u8 *sa, const u8 *buf,
|
|||
return;
|
||||
|
||||
if (!sta->eapol_sm) {
|
||||
int flags = 0;
|
||||
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,
|
||||
sta->flags & WLAN_STA_PREAUTH,
|
||||
sta);
|
||||
flags, sta);
|
||||
if (!sta->eapol_sm)
|
||||
return;
|
||||
|
||||
|
@ -836,11 +840,15 @@ void ieee802_1x_new_station(struct hostapd_data *hapd, struct sta_info *sta)
|
|||
return;
|
||||
|
||||
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_LEVEL_DEBUG, "start authentication");
|
||||
sta->eapol_sm = eapol_auth_alloc(hapd->eapol_auth, sta->addr,
|
||||
sta->flags & WLAN_STA_PREAUTH,
|
||||
sta);
|
||||
flags, sta);
|
||||
if (sta->eapol_sm == NULL) {
|
||||
hostapd_logger(hapd, sta->addr,
|
||||
HOSTAPD_MODULE_IEEE8021X,
|
||||
|
|
Loading…
Reference in a new issue