Remove dependency on sta_info.h from eapol_sm.c

Instead of fetching WPS IE from struct sta_info, pass this as a
parameter to eapol_auth_alloc().
This commit is contained in:
Jouni Malinen 2009-11-29 19:40:47 +02:00
parent ee58e87195
commit d79b779204
4 changed files with 12 additions and 11 deletions

View File

@ -18,7 +18,6 @@
#include "eapol_sm.h" #include "eapol_sm.h"
#include "eloop.h" #include "eloop.h"
#include "common/eapol_common.h" #include "common/eapol_common.h"
#include "sta_info.h"
#include "eap_server/eap.h" #include "eap_server/eap.h"
#include "state_machine.h" #include "state_machine.h"
#include "eap_common/eap_common.h" #include "eap_common/eap_common.h"
@ -759,7 +758,7 @@ SM_STEP(CTRL_DIR)
struct eapol_state_machine * struct eapol_state_machine *
eapol_auth_alloc(struct eapol_authenticator *eapol, const u8 *addr, eapol_auth_alloc(struct eapol_authenticator *eapol, const u8 *addr,
int flags, struct sta_info *sta) int flags, const struct wpabuf *assoc_wps_ie, void *sta_ctx)
{ {
struct eapol_state_machine *sm; struct eapol_state_machine *sm;
struct hostapd_data *hapd; /* TODO: to be removed */ struct hostapd_data *hapd; /* TODO: to be removed */
@ -781,7 +780,7 @@ eapol_auth_alloc(struct eapol_authenticator *eapol, const u8 *addr,
sm->hapd = hapd; sm->hapd = hapd;
sm->eapol = eapol; sm->eapol = eapol;
sm->sta = sta; sm->sta = sta_ctx;
/* Set default values for state machine constants */ /* Set default values for state machine constants */
sm->auth_pae_state = AUTH_PAE_INITIALIZE; sm->auth_pae_state = AUTH_PAE_INITIALIZE;
@ -827,7 +826,7 @@ eapol_auth_alloc(struct eapol_authenticator *eapol, const u8 *addr,
eap_conf.eap_sim_aka_result_ind = eapol->conf.eap_sim_aka_result_ind; eap_conf.eap_sim_aka_result_ind = eapol->conf.eap_sim_aka_result_ind;
eap_conf.tnc = eapol->conf.tnc; eap_conf.tnc = eapol->conf.tnc;
eap_conf.wps = eapol->conf.wps; eap_conf.wps = eapol->conf.wps;
eap_conf.assoc_wps_ie = sta->wps_ie; eap_conf.assoc_wps_ie = assoc_wps_ie;
eap_conf.peer_addr = addr; eap_conf.peer_addr = addr;
sm->eap = eap_server_sm_init(sm, &eapol_cb, &eap_conf); sm->eap = eap_server_sm_init(sm, &eapol_cb, &eap_conf);
if (sm->eap == NULL) { if (sm->eap == NULL) {

View File

@ -239,10 +239,11 @@ struct eapol_state_machine {
struct eapol_authenticator *eapol; struct eapol_authenticator *eapol;
/* Somewhat nasty pointers to global hostapd and STA data to avoid void *sta; /* station context pointer to use in callbacks */
* passing these to every function */
/* Somewhat nasty pointer to global hostapd data to avoid
* passing this to every function */
struct hostapd_data *hapd; struct hostapd_data *hapd;
struct sta_info *sta;
}; };
@ -251,7 +252,7 @@ struct eapol_authenticator * eapol_auth_init(struct eapol_auth_config *conf,
void eapol_auth_deinit(struct eapol_authenticator *eapol); void eapol_auth_deinit(struct eapol_authenticator *eapol);
struct eapol_state_machine * struct eapol_state_machine *
eapol_auth_alloc(struct eapol_authenticator *eapol, const u8 *addr, eapol_auth_alloc(struct eapol_authenticator *eapol, const u8 *addr,
int flags, struct sta_info *sta); int flags, const struct wpabuf *assoc_wps_ie, void *sta_ctx);
void eapol_auth_free(struct eapol_state_machine *sm); void eapol_auth_free(struct eapol_state_machine *sm);
void eapol_auth_step(struct eapol_state_machine *sm); void eapol_auth_step(struct eapol_state_machine *sm);
void eapol_auth_dump_state(FILE *f, const char *prefix, void eapol_auth_dump_state(FILE *f, const char *prefix,

View File

@ -657,7 +657,8 @@ ieee802_1x_alloc_eapol_sm(struct hostapd_data *hapd, struct sta_info *sta)
if (wpa_auth_sta_get_pmksa(sta->wpa_sm)) if (wpa_auth_sta_get_pmksa(sta->wpa_sm))
flags |= EAPOL_SM_FROM_PMKSA_CACHE; flags |= EAPOL_SM_FROM_PMKSA_CACHE;
} }
return eapol_auth_alloc(hapd->eapol_auth, sta->addr, flags, sta); return eapol_auth_alloc(hapd->eapol_auth, sta->addr, flags,
sta->wps_ie, sta);
} }

View File

@ -145,7 +145,7 @@ static void pmksa_cache_from_eapol_data(struct rsn_pmksa_cache_entry *entry,
radius_copy_class(&entry->radius_class, &eapol->radius_class); radius_copy_class(&entry->radius_class, &eapol->radius_class);
entry->eap_type_authsrv = eapol->eap_type_authsrv; entry->eap_type_authsrv = eapol->eap_type_authsrv;
entry->vlan_id = eapol->sta->vlan_id; entry->vlan_id = ((struct sta_info *) eapol->sta)->vlan_id;
} }
@ -175,7 +175,7 @@ void pmksa_cache_to_eapol_data(struct rsn_pmksa_cache_entry *entry,
} }
eapol->eap_type_authsrv = entry->eap_type_authsrv; eapol->eap_type_authsrv = entry->eap_type_authsrv;
eapol->sta->vlan_id = entry->vlan_id; ((struct sta_info *) eapol->sta)->vlan_id = entry->vlan_id;
} }