AP: Add wpa_msg() events for EAP server state machine
This commit is contained in:
parent
d9a27b0455
commit
bb437f282b
9 changed files with 36 additions and 0 deletions
|
@ -209,6 +209,7 @@ static struct hostapd_iface * hostapd_init(const char *config_file)
|
|||
&conf->bss[i]);
|
||||
if (hapd == NULL)
|
||||
goto fail;
|
||||
hapd->msg_ctx = hapd;
|
||||
}
|
||||
|
||||
return hapd_iface;
|
||||
|
|
|
@ -104,6 +104,7 @@ static int hostapd_setup_radius_srv(struct hostapd_data *hapd)
|
|||
srv.conf_ctx = conf;
|
||||
srv.eap_sim_db_priv = hapd->eap_sim_db_priv;
|
||||
srv.ssl_ctx = hapd->ssl_ctx;
|
||||
srv.msg_ctx = hapd->msg_ctx;
|
||||
srv.pac_opaque_encr_key = conf->pac_opaque_encr_key;
|
||||
srv.eap_fast_a_id = conf->eap_fast_a_id;
|
||||
srv.eap_fast_a_id_len = conf->eap_fast_a_id_len;
|
||||
|
|
|
@ -1612,6 +1612,7 @@ int ieee802_1x_init(struct hostapd_data *hapd)
|
|||
conf.individual_wep_key_len = hapd->conf->individual_wep_key_len;
|
||||
conf.eap_server = hapd->conf->eap_server;
|
||||
conf.ssl_ctx = hapd->ssl_ctx;
|
||||
conf.msg_ctx = hapd->msg_ctx;
|
||||
conf.eap_sim_db_priv = hapd->eap_sim_db_priv;
|
||||
conf.eap_req_id_text = hapd->conf->eap_req_id_text;
|
||||
conf.eap_req_id_text_len = hapd->conf->eap_req_id_text_len;
|
||||
|
|
|
@ -91,6 +91,7 @@ struct eapol_callbacks {
|
|||
|
||||
struct eap_config {
|
||||
void *ssl_ctx;
|
||||
void *msg_ctx;
|
||||
void *eap_sim_db_priv;
|
||||
Boolean backend_auth;
|
||||
int eap_server;
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "common.h"
|
||||
#include "eap_i.h"
|
||||
#include "state_machine.h"
|
||||
#include "common/wpa_ctrl.h"
|
||||
|
||||
#define STATE_MACHINE_DATA struct eap_sm
|
||||
#define STATE_MACHINE_DEBUG_PREFIX "EAP"
|
||||
|
@ -167,6 +168,9 @@ SM_STATE(EAP, INITIALIZE)
|
|||
}
|
||||
sm->num_rounds = 0;
|
||||
sm->method_pending = METHOD_PENDING_NONE;
|
||||
|
||||
wpa_msg(sm->msg_ctx, MSG_INFO, WPA_EVENT_EAP_STARTED
|
||||
MACSTR, MAC2STR(sm->peer_addr));
|
||||
}
|
||||
|
||||
|
||||
|
@ -196,6 +200,9 @@ SM_STATE(EAP, PICK_UP_METHOD)
|
|||
sm->currentMethod = EAP_TYPE_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
wpa_msg(sm->msg_ctx, MSG_INFO, WPA_EVENT_EAP_PROPOSED_METHOD
|
||||
"method=%u", sm->currentMethod);
|
||||
}
|
||||
|
||||
|
||||
|
@ -350,6 +357,9 @@ SM_STATE(EAP, PROPOSE_METHOD)
|
|||
sm->methodState = METHOD_CONTINUE;
|
||||
else
|
||||
sm->methodState = METHOD_PROPOSED;
|
||||
|
||||
wpa_msg(sm->msg_ctx, MSG_INFO, WPA_EVENT_EAP_PROPOSED_METHOD
|
||||
"vendor=%u method=%u", vendor, sm->currentMethod);
|
||||
}
|
||||
|
||||
|
||||
|
@ -410,6 +420,9 @@ SM_STATE(EAP, FAILURE)
|
|||
wpabuf_free(sm->lastReqData);
|
||||
sm->lastReqData = NULL;
|
||||
sm->eap_if.eapFail = TRUE;
|
||||
|
||||
wpa_msg(sm->msg_ctx, MSG_INFO, WPA_EVENT_EAP_FAILURE
|
||||
MACSTR, MAC2STR(sm->peer_addr));
|
||||
}
|
||||
|
||||
|
||||
|
@ -424,6 +437,9 @@ SM_STATE(EAP, SUCCESS)
|
|||
if (sm->eap_if.eapKeyData)
|
||||
sm->eap_if.eapKeyAvailable = TRUE;
|
||||
sm->eap_if.eapSuccess = TRUE;
|
||||
|
||||
wpa_msg(sm->msg_ctx, MSG_INFO, WPA_EVENT_EAP_SUCCESS
|
||||
MACSTR, MAC2STR(sm->peer_addr));
|
||||
}
|
||||
|
||||
|
||||
|
@ -1210,6 +1226,7 @@ struct eap_sm * eap_server_sm_init(void *eapol_ctx,
|
|||
sm->eapol_cb = eapol_cb;
|
||||
sm->MaxRetrans = 5; /* RFC 3748: max 3-5 retransmissions suggested */
|
||||
sm->ssl_ctx = conf->ssl_ctx;
|
||||
sm->msg_ctx = conf->msg_ctx;
|
||||
sm->eap_sim_db_priv = conf->eap_sim_db_priv;
|
||||
sm->backend_auth = conf->backend_auth;
|
||||
sm->eap_server = conf->eap_server;
|
||||
|
|
|
@ -816,6 +816,7 @@ eapol_auth_alloc(struct eapol_authenticator *eapol, const u8 *addr,
|
|||
os_memset(&eap_conf, 0, sizeof(eap_conf));
|
||||
eap_conf.eap_server = eapol->conf.eap_server;
|
||||
eap_conf.ssl_ctx = eapol->conf.ssl_ctx;
|
||||
eap_conf.msg_ctx = eapol->conf.msg_ctx;
|
||||
eap_conf.eap_sim_db_priv = eapol->conf.eap_sim_db_priv;
|
||||
eap_conf.pac_opaque_encr_key = eapol->conf.pac_opaque_encr_key;
|
||||
eap_conf.eap_fast_a_id = eapol->conf.eap_fast_a_id;
|
||||
|
@ -1030,6 +1031,7 @@ static int eapol_auth_conf_clone(struct eapol_auth_config *dst,
|
|||
dst->individual_wep_key_len = src->individual_wep_key_len;
|
||||
dst->eap_server = src->eap_server;
|
||||
dst->ssl_ctx = src->ssl_ctx;
|
||||
dst->msg_ctx = src->msg_ctx;
|
||||
dst->eap_sim_db_priv = src->eap_sim_db_priv;
|
||||
os_free(dst->eap_req_id_text);
|
||||
if (src->eap_req_id_text) {
|
||||
|
|
|
@ -26,6 +26,7 @@ struct eapol_auth_config {
|
|||
int individual_wep_key_len;
|
||||
int eap_server;
|
||||
void *ssl_ctx;
|
||||
void *msg_ctx;
|
||||
void *eap_sim_db_priv;
|
||||
char *eap_req_id_text; /* a copy of this will be allocated */
|
||||
size_t eap_req_id_text_len;
|
||||
|
|
|
@ -280,6 +280,11 @@ struct radius_server_data {
|
|||
* eap_req_id_text_len - Length of eap_req_id_text buffer in octets
|
||||
*/
|
||||
size_t eap_req_id_text_len;
|
||||
|
||||
/*
|
||||
* msg_ctx - Context data for wpa_msg() calls
|
||||
*/
|
||||
void *msg_ctx;
|
||||
};
|
||||
|
||||
|
||||
|
@ -486,6 +491,7 @@ radius_server_get_new_session(struct radius_server_data *data,
|
|||
|
||||
os_memset(&eap_conf, 0, sizeof(eap_conf));
|
||||
eap_conf.ssl_ctx = data->ssl_ctx;
|
||||
eap_conf.msg_ctx = data->msg_ctx;
|
||||
eap_conf.eap_sim_db_priv = data->eap_sim_db_priv;
|
||||
eap_conf.backend_auth = TRUE;
|
||||
eap_conf.eap_server = 1;
|
||||
|
@ -1229,6 +1235,7 @@ radius_server_init(struct radius_server_conf *conf)
|
|||
data->conf_ctx = conf->conf_ctx;
|
||||
data->eap_sim_db_priv = conf->eap_sim_db_priv;
|
||||
data->ssl_ctx = conf->ssl_ctx;
|
||||
data->msg_ctx = conf->msg_ctx;
|
||||
data->ipv6 = conf->ipv6;
|
||||
if (conf->pac_opaque_encr_key) {
|
||||
data->pac_opaque_encr_key = os_malloc(16);
|
||||
|
|
|
@ -189,6 +189,11 @@ struct radius_server_conf {
|
|||
* eap_req_id_text_len - Length of eap_req_id_text buffer in octets
|
||||
*/
|
||||
size_t eap_req_id_text_len;
|
||||
|
||||
/*
|
||||
* msg_ctx - Context data for wpa_msg() calls
|
||||
*/
|
||||
void *msg_ctx;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue