Remove dependency on sta_info.h from eapol_sm.c
authorJouni Malinen <j@w1.fi>
Sun, 29 Nov 2009 17:40:47 +0000 (19:40 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 29 Nov 2009 17:40:47 +0000 (19:40 +0200)
Instead of fetching WPS IE from struct sta_info, pass this as a
parameter to eapol_auth_alloc().

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

index 1a0ca3b..440146e 100644 (file)
@@ -18,7 +18,6 @@
 #include "eapol_sm.h"
 #include "eloop.h"
 #include "common/eapol_common.h"
-#include "sta_info.h"
 #include "eap_server/eap.h"
 #include "state_machine.h"
 #include "eap_common/eap_common.h"
@@ -759,7 +758,7 @@ SM_STEP(CTRL_DIR)
 
 struct eapol_state_machine *
 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 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->eapol = eapol;
-       sm->sta = sta;
+       sm->sta = sta_ctx;
 
        /* Set default values for state machine constants */
        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.tnc = eapol->conf.tnc;
        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;
        sm->eap = eap_server_sm_init(sm, &eapol_cb, &eap_conf);
        if (sm->eap == NULL) {
index 19ee50b..9cb781d 100644 (file)
@@ -239,10 +239,11 @@ struct eapol_state_machine {
 
        struct eapol_authenticator *eapol;
 
-       /* Somewhat nasty pointers to global hostapd and STA data to avoid
-        * passing these to every function */
+       void *sta; /* station context pointer to use in callbacks */
+
+       /* Somewhat nasty pointer to global hostapd data to avoid
+        * passing this to every function */
        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);
 struct eapol_state_machine *
 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_step(struct eapol_state_machine *sm);
 void eapol_auth_dump_state(FILE *f, const char *prefix,
index 8a7b5cc..2e84d4f 100644 (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))
                        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);
 }
 
 
index b815e58..49d543d 100644 (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);
 
        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->sta->vlan_id = entry->vlan_id;
+       ((struct sta_info *) eapol->sta)->vlan_id = entry->vlan_id;
 }