aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2005-06-25 16:39:15 (GMT)
committerJouni Malinen <j@w1.fi>2005-06-25 16:39:15 (GMT)
commit6cf605cda77b21fbcd880b36ff5c8dec4adc1a83 (patch)
treec228fa70c2b86bb430ef2eaae1a6d81d1ab701a3
parent8082351af69925928353802696dd78f13c486712 (diff)
downloadhostap-history-6cf605cda77b21fbcd880b36ff5c8dec4adc1a83.zip
hostap-history-6cf605cda77b21fbcd880b36ff5c8dec4adc1a83.tar.gz
hostap-history-6cf605cda77b21fbcd880b36ff5c8dec4adc1a83.tar.bz2
Added a new EAPOL state machine context pointer (eapol_send_ctx) to be
used with eapol_send() callback. This allows preauth.c to use struct wpa_sm pointer as the eapol_send() context without breaking other calls that were using the generic EAPOL callback ctx.
-rw-r--r--wpa_supplicant/eapol_sm.c12
-rw-r--r--wpa_supplicant/eapol_sm.h2
-rw-r--r--wpa_supplicant/eapol_test.c1
-rw-r--r--wpa_supplicant/preauth.c4
-rw-r--r--wpa_supplicant/wpa_supplicant.c1
5 files changed, 11 insertions, 9 deletions
diff --git a/wpa_supplicant/eapol_sm.c b/wpa_supplicant/eapol_sm.c
index 7651716..cee0943 100644
--- a/wpa_supplicant/eapol_sm.c
+++ b/wpa_supplicant/eapol_sm.c
@@ -542,8 +542,8 @@ SM_STEP(SUPP_BE)
static void eapol_sm_txLogoff(struct eapol_sm *sm)
{
wpa_printf(MSG_DEBUG, "EAPOL: txLogoff");
- sm->ctx->eapol_send(sm->ctx->ctx, IEEE802_1X_TYPE_EAPOL_LOGOFF,
- (u8 *) "", 0);
+ sm->ctx->eapol_send(sm->ctx->eapol_send_ctx,
+ IEEE802_1X_TYPE_EAPOL_LOGOFF, (u8 *) "", 0);
sm->dot1xSuppEapolLogoffFramesTx++;
sm->dot1xSuppEapolFramesTx++;
}
@@ -552,8 +552,8 @@ static void eapol_sm_txLogoff(struct eapol_sm *sm)
static void eapol_sm_txStart(struct eapol_sm *sm)
{
wpa_printf(MSG_DEBUG, "EAPOL: txStart");
- sm->ctx->eapol_send(sm->ctx->ctx, IEEE802_1X_TYPE_EAPOL_START,
- (u8 *) "", 0);
+ sm->ctx->eapol_send(sm->ctx->eapol_send_ctx,
+ IEEE802_1X_TYPE_EAPOL_START, (u8 *) "", 0);
sm->dot1xSuppEapolStartFramesTx++;
sm->dot1xSuppEapolFramesTx++;
}
@@ -754,8 +754,8 @@ static void eapol_sm_txSuppRsp(struct eapol_sm *sm)
}
/* Send EAP-Packet from the EAP layer to the Authenticator */
- sm->ctx->eapol_send(sm->ctx->ctx, IEEE802_1X_TYPE_EAP_PACKET,
- resp, resp_len);
+ sm->ctx->eapol_send(sm->ctx->eapol_send_ctx,
+ IEEE802_1X_TYPE_EAP_PACKET, resp, resp_len);
/* eapRespData is not used anymore, so free it here */
free(resp);
diff --git a/wpa_supplicant/eapol_sm.h b/wpa_supplicant/eapol_sm.h
index e0fcea0..4608b29 100644
--- a/wpa_supplicant/eapol_sm.h
+++ b/wpa_supplicant/eapol_sm.h
@@ -37,7 +37,7 @@ struct eapol_ctx {
int preauth; /* This EAPOL state machine is used for IEEE 802.11i/RSN
* pre-authentication */
void (*cb)(struct eapol_sm *eapol, int success, void *ctx);
- void *cb_ctx, *msg_ctx, *scard_ctx;
+ void *cb_ctx, *msg_ctx, *scard_ctx, *eapol_send_ctx;
void (*eapol_done_cb)(void *ctx);
int (*eapol_send)(void *ctx, int type, u8 *buf, size_t len);
int (*set_wep_key)(void *ctx, int unicast, int keyidx,
diff --git a/wpa_supplicant/eapol_test.c b/wpa_supplicant/eapol_test.c
index 735979a..3152cbc 100644
--- a/wpa_supplicant/eapol_test.c
+++ b/wpa_supplicant/eapol_test.c
@@ -452,6 +452,7 @@ static int test_eapol(struct eapol_test_data *e, struct wpa_supplicant *wpa_s,
ctx->scard_ctx = wpa_s->scard;
ctx->cb = eapol_sm_cb;
ctx->cb_ctx = e;
+ ctx->eapol_send_ctx = wpa_s;
ctx->preauth = 0;
ctx->eapol_done_cb = eapol_test_eapol_done_cb;
ctx->eapol_send = eapol_test_eapol_send;
diff --git a/wpa_supplicant/preauth.c b/wpa_supplicant/preauth.c
index 578c9ff..70ee795 100644
--- a/wpa_supplicant/preauth.c
+++ b/wpa_supplicant/preauth.c
@@ -549,8 +549,7 @@ static void rsn_preauth_timeout(void *eloop_ctx, void *timeout_ctx)
static int rsn_preauth_eapol_send(void *ctx, int type, u8 *buf, size_t len)
{
- struct wpa_supplicant *wpa_s = ctx;
- struct wpa_sm *sm = wpa_s->wpa;
+ struct wpa_sm *sm = ctx;
u8 *msg;
size_t msglen;
int res;
@@ -620,6 +619,7 @@ int rsn_preauth_init(struct wpa_sm *sm, const u8 *dst, struct wpa_ssid *config)
ctx->cb_ctx = sm;
ctx->scard_ctx = sm->scard_ctx;
ctx->eapol_send = rsn_preauth_eapol_send;
+ ctx->eapol_send_ctx = sm;
sm->preauth_eapol = eapol_sm_init(ctx);
if (sm->preauth_eapol == NULL) {
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 95151a0..7054d0b 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -1703,6 +1703,7 @@ static int wpa_supplicant_init2(struct wpa_supplicant *wpa_s,
memset(ctx, 0, sizeof(*ctx));
ctx->ctx = wpa_s;
ctx->msg_ctx = wpa_s;
+ ctx->eapol_send_ctx = wpa_s;
ctx->preauth = 0;
ctx->eapol_done_cb = wpa_supplicant_notify_eapol_done;
ctx->eapol_send = wpa_eapol_send;