Convert EAPOL authenticator dump into easier to parse format
Use name=value entries one per each line and rename the state entries to have unique names. Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
ca3b71c14f
commit
96ea74b866
3 changed files with 170 additions and 102 deletions
|
@ -20,13 +20,17 @@
|
||||||
#include "ap/ap_drv_ops.h"
|
#include "ap/ap_drv_ops.h"
|
||||||
|
|
||||||
|
|
||||||
static void ieee802_1x_dump_state(FILE *f, const char *prefix,
|
static void ieee802_1x_dump_state(FILE *f, struct sta_info *sta)
|
||||||
struct sta_info *sta)
|
|
||||||
{
|
{
|
||||||
struct eapol_state_machine *sm = sta->eapol_sm;
|
struct eapol_state_machine *sm = sta->eapol_sm;
|
||||||
|
char buf[4096];
|
||||||
|
int res;
|
||||||
|
|
||||||
if (sm == NULL)
|
if (sm == NULL)
|
||||||
return;
|
return;
|
||||||
eapol_auth_dump_state(f, prefix, sm);
|
res = eapol_auth_dump_state(sm, buf, sizeof(buf));
|
||||||
|
if (res > 0)
|
||||||
|
fprintf(f, "%s", buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,7 +63,7 @@ static void hostapd_dump_state(struct hostapd_data *hapd)
|
||||||
|
|
||||||
for (sta = hapd->sta_list; sta != NULL; sta = sta->next) {
|
for (sta = hapd->sta_list; sta != NULL; sta = sta->next) {
|
||||||
fprintf(f, "\nSTA=" MACSTR "\n", MAC2STR(sta->addr));
|
fprintf(f, "\nSTA=" MACSTR "\n", MAC2STR(sta->addr));
|
||||||
ieee802_1x_dump_state(f, " ", sta);
|
ieee802_1x_dump_state(f, sta);
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* IEEE 802.1X-2004 Authenticator - State dump
|
* IEEE 802.1X-2004 Authenticator - State dump
|
||||||
* Copyright (c) 2002-2009, Jouni Malinen <j@w1.fi>
|
* Copyright (c) 2002-2013, Jouni Malinen <j@w1.fi>
|
||||||
*
|
*
|
||||||
* This software may be distributed under the terms of the BSD license.
|
* This software may be distributed under the terms of the BSD license.
|
||||||
* See README for more details.
|
* See README for more details.
|
||||||
|
@ -118,108 +118,172 @@ static inline const char * ctrl_dir_state_txt(int s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void eapol_auth_dump_state(FILE *f, const char *prefix,
|
int eapol_auth_dump_state(struct eapol_state_machine *sm, char *buf,
|
||||||
struct eapol_state_machine *sm)
|
size_t buflen)
|
||||||
{
|
{
|
||||||
fprintf(f, "%sEAPOL state machine:\n", prefix);
|
char *pos, *end;
|
||||||
fprintf(f, "%s aWhile=%d quietWhile=%d reAuthWhen=%d\n", prefix,
|
int ret;
|
||||||
sm->aWhile, sm->quietWhile, sm->reAuthWhen);
|
|
||||||
|
pos = buf;
|
||||||
|
end = pos + buflen;
|
||||||
|
|
||||||
|
ret = os_snprintf(pos, end - pos, "aWhile=%d\nquietWhile=%d\n"
|
||||||
|
"reAuthWhen=%d\n",
|
||||||
|
sm->aWhile, sm->quietWhile, sm->reAuthWhen);
|
||||||
|
if (ret < 0 || ret >= end - pos)
|
||||||
|
return pos - buf;
|
||||||
|
pos += ret;
|
||||||
|
|
||||||
#define _SB(b) ((b) ? "TRUE" : "FALSE")
|
#define _SB(b) ((b) ? "TRUE" : "FALSE")
|
||||||
fprintf(f,
|
ret = os_snprintf(pos, end - pos,
|
||||||
"%s authAbort=%s authFail=%s authPortStatus=%s authStart=%s\n"
|
"authAbort=%s\n"
|
||||||
"%s authTimeout=%s authSuccess=%s eapFail=%s eapolEap=%s\n"
|
"authFail=%s\n"
|
||||||
"%s eapSuccess=%s eapTimeout=%s initialize=%s "
|
"authPortStatus=%s\n"
|
||||||
"keyAvailable=%s\n"
|
"authStart=%s\n"
|
||||||
"%s keyDone=%s keyRun=%s keyTxEnabled=%s portControl=%s\n"
|
"authTimeout=%s\n"
|
||||||
"%s portEnabled=%s portValid=%s reAuthenticate=%s\n",
|
"authSuccess=%s\n"
|
||||||
prefix, _SB(sm->authAbort), _SB(sm->authFail),
|
"eapFail=%s\n"
|
||||||
port_state_txt(sm->authPortStatus), _SB(sm->authStart),
|
"eapolEap=%s\n"
|
||||||
prefix, _SB(sm->authTimeout), _SB(sm->authSuccess),
|
"eapSuccess=%s\n"
|
||||||
_SB(sm->eap_if->eapFail), _SB(sm->eapolEap),
|
"eapTimeout=%s\n"
|
||||||
prefix, _SB(sm->eap_if->eapSuccess),
|
"initialize=%s\n"
|
||||||
_SB(sm->eap_if->eapTimeout),
|
"keyAvailable=%s\n"
|
||||||
_SB(sm->initialize), _SB(sm->eap_if->eapKeyAvailable),
|
"keyDone=%s\n"
|
||||||
prefix, _SB(sm->keyDone), _SB(sm->keyRun),
|
"keyRun=%s\n"
|
||||||
_SB(sm->keyTxEnabled), port_type_txt(sm->portControl),
|
"keyTxEnabled=%s\n"
|
||||||
prefix, _SB(sm->eap_if->portEnabled), _SB(sm->portValid),
|
"portControl=%s\n"
|
||||||
_SB(sm->reAuthenticate));
|
"portEnabled=%s\n"
|
||||||
|
"portValid=%s\n"
|
||||||
|
"reAuthenticate=%s\n",
|
||||||
|
_SB(sm->authAbort),
|
||||||
|
_SB(sm->authFail),
|
||||||
|
port_state_txt(sm->authPortStatus),
|
||||||
|
_SB(sm->authStart),
|
||||||
|
_SB(sm->authTimeout),
|
||||||
|
_SB(sm->authSuccess),
|
||||||
|
_SB(sm->eap_if->eapFail),
|
||||||
|
_SB(sm->eapolEap),
|
||||||
|
_SB(sm->eap_if->eapSuccess),
|
||||||
|
_SB(sm->eap_if->eapTimeout),
|
||||||
|
_SB(sm->initialize),
|
||||||
|
_SB(sm->eap_if->eapKeyAvailable),
|
||||||
|
_SB(sm->keyDone), _SB(sm->keyRun),
|
||||||
|
_SB(sm->keyTxEnabled),
|
||||||
|
port_type_txt(sm->portControl),
|
||||||
|
_SB(sm->eap_if->portEnabled),
|
||||||
|
_SB(sm->portValid),
|
||||||
|
_SB(sm->reAuthenticate));
|
||||||
|
if (ret < 0 || ret >= end - pos)
|
||||||
|
return pos - buf;
|
||||||
|
pos += ret;
|
||||||
|
|
||||||
fprintf(f, "%s Authenticator PAE:\n"
|
ret = os_snprintf(pos, end - pos,
|
||||||
"%s state=%s\n"
|
"auth_pae_state=%s\n"
|
||||||
"%s eapolLogoff=%s eapolStart=%s eapRestart=%s\n"
|
"eapolLogoff=%s\n"
|
||||||
"%s portMode=%s reAuthCount=%d\n"
|
"eapolStart=%s\n"
|
||||||
"%s quietPeriod=%d reAuthMax=%d\n"
|
"eapRestart=%s\n"
|
||||||
"%s authEntersConnecting=%d\n"
|
"portMode=%s\n"
|
||||||
"%s authEapLogoffsWhileConnecting=%d\n"
|
"reAuthCount=%d\n"
|
||||||
"%s authEntersAuthenticating=%d\n"
|
"quietPeriod=%d\n"
|
||||||
"%s authAuthSuccessesWhileAuthenticating=%d\n"
|
"reAuthMax=%d\n"
|
||||||
"%s authAuthTimeoutsWhileAuthenticating=%d\n"
|
"authEntersConnecting=%d\n"
|
||||||
"%s authAuthFailWhileAuthenticating=%d\n"
|
"authEapLogoffsWhileConnecting=%d\n"
|
||||||
"%s authAuthEapStartsWhileAuthenticating=%d\n"
|
"authEntersAuthenticating=%d\n"
|
||||||
"%s authAuthEapLogoffWhileAuthenticating=%d\n"
|
"authAuthSuccessesWhileAuthenticating=%d\n"
|
||||||
"%s authAuthReauthsWhileAuthenticated=%d\n"
|
"authAuthTimeoutsWhileAuthenticating=%d\n"
|
||||||
"%s authAuthEapStartsWhileAuthenticated=%d\n"
|
"authAuthFailWhileAuthenticating=%d\n"
|
||||||
"%s authAuthEapLogoffWhileAuthenticated=%d\n",
|
"authAuthEapStartsWhileAuthenticating=%d\n"
|
||||||
prefix, prefix, auth_pae_state_txt(sm->auth_pae_state), prefix,
|
"authAuthEapLogoffWhileAuthenticating=%d\n"
|
||||||
_SB(sm->eapolLogoff), _SB(sm->eapolStart),
|
"authAuthReauthsWhileAuthenticated=%d\n"
|
||||||
_SB(sm->eap_if->eapRestart),
|
"authAuthEapStartsWhileAuthenticated=%d\n"
|
||||||
prefix, port_type_txt(sm->portMode), sm->reAuthCount,
|
"authAuthEapLogoffWhileAuthenticated=%d\n",
|
||||||
prefix, sm->quietPeriod, sm->reAuthMax,
|
auth_pae_state_txt(sm->auth_pae_state),
|
||||||
prefix, sm->authEntersConnecting,
|
_SB(sm->eapolLogoff),
|
||||||
prefix, sm->authEapLogoffsWhileConnecting,
|
_SB(sm->eapolStart),
|
||||||
prefix, sm->authEntersAuthenticating,
|
_SB(sm->eap_if->eapRestart),
|
||||||
prefix, sm->authAuthSuccessesWhileAuthenticating,
|
port_type_txt(sm->portMode),
|
||||||
prefix, sm->authAuthTimeoutsWhileAuthenticating,
|
sm->reAuthCount,
|
||||||
prefix, sm->authAuthFailWhileAuthenticating,
|
sm->quietPeriod, sm->reAuthMax,
|
||||||
prefix, sm->authAuthEapStartsWhileAuthenticating,
|
sm->authEntersConnecting,
|
||||||
prefix, sm->authAuthEapLogoffWhileAuthenticating,
|
sm->authEapLogoffsWhileConnecting,
|
||||||
prefix, sm->authAuthReauthsWhileAuthenticated,
|
sm->authEntersAuthenticating,
|
||||||
prefix, sm->authAuthEapStartsWhileAuthenticated,
|
sm->authAuthSuccessesWhileAuthenticating,
|
||||||
prefix, sm->authAuthEapLogoffWhileAuthenticated);
|
sm->authAuthTimeoutsWhileAuthenticating,
|
||||||
|
sm->authAuthFailWhileAuthenticating,
|
||||||
|
sm->authAuthEapStartsWhileAuthenticating,
|
||||||
|
sm->authAuthEapLogoffWhileAuthenticating,
|
||||||
|
sm->authAuthReauthsWhileAuthenticated,
|
||||||
|
sm->authAuthEapStartsWhileAuthenticated,
|
||||||
|
sm->authAuthEapLogoffWhileAuthenticated);
|
||||||
|
if (ret < 0 || ret >= end - pos)
|
||||||
|
return pos - buf;
|
||||||
|
pos += ret;
|
||||||
|
|
||||||
fprintf(f, "%s Backend Authentication:\n"
|
ret = os_snprintf(pos, end - pos,
|
||||||
"%s state=%s\n"
|
"be_auth_state=%s\n"
|
||||||
"%s eapNoReq=%s eapReq=%s eapResp=%s\n"
|
"eapNoReq=%s\n"
|
||||||
"%s serverTimeout=%d\n"
|
"eapReq=%s\n"
|
||||||
"%s backendResponses=%d\n"
|
"eapResp=%s\n"
|
||||||
"%s backendAccessChallenges=%d\n"
|
"serverTimeout=%d\n"
|
||||||
"%s backendOtherRequestsToSupplicant=%d\n"
|
"backendResponses=%d\n"
|
||||||
"%s backendAuthSuccesses=%d\n"
|
"backendAccessChallenges=%d\n"
|
||||||
"%s backendAuthFails=%d\n",
|
"backendOtherRequestsToSupplicant=%d\n"
|
||||||
prefix, prefix,
|
"backendAuthSuccesses=%d\n"
|
||||||
be_auth_state_txt(sm->be_auth_state),
|
"backendAuthFails=%d\n",
|
||||||
prefix, _SB(sm->eap_if->eapNoReq), _SB(sm->eap_if->eapReq),
|
be_auth_state_txt(sm->be_auth_state),
|
||||||
_SB(sm->eap_if->eapResp),
|
_SB(sm->eap_if->eapNoReq),
|
||||||
prefix, sm->serverTimeout,
|
_SB(sm->eap_if->eapReq),
|
||||||
prefix, sm->backendResponses,
|
_SB(sm->eap_if->eapResp),
|
||||||
prefix, sm->backendAccessChallenges,
|
sm->serverTimeout,
|
||||||
prefix, sm->backendOtherRequestsToSupplicant,
|
sm->backendResponses,
|
||||||
prefix, sm->backendAuthSuccesses,
|
sm->backendAccessChallenges,
|
||||||
prefix, sm->backendAuthFails);
|
sm->backendOtherRequestsToSupplicant,
|
||||||
|
sm->backendAuthSuccesses,
|
||||||
|
sm->backendAuthFails);
|
||||||
|
if (ret < 0 || ret >= end - pos)
|
||||||
|
return pos - buf;
|
||||||
|
pos += ret;
|
||||||
|
|
||||||
fprintf(f, "%s Reauthentication Timer:\n"
|
ret = os_snprintf(pos, end - pos,
|
||||||
"%s state=%s\n"
|
"reauth_timer_state=%s\n"
|
||||||
"%s reAuthPeriod=%d reAuthEnabled=%s\n", prefix, prefix,
|
"reAuthPeriod=%d\n"
|
||||||
reauth_timer_state_txt(sm->reauth_timer_state), prefix,
|
"reAuthEnabled=%s\n",
|
||||||
sm->reAuthPeriod, _SB(sm->reAuthEnabled));
|
reauth_timer_state_txt(sm->reauth_timer_state),
|
||||||
|
sm->reAuthPeriod,
|
||||||
|
_SB(sm->reAuthEnabled));
|
||||||
|
if (ret < 0 || ret >= end - pos)
|
||||||
|
return pos - buf;
|
||||||
|
pos += ret;
|
||||||
|
|
||||||
fprintf(f, "%s Authenticator Key Transmit:\n"
|
ret = os_snprintf(pos, end - pos,
|
||||||
"%s state=%s\n", prefix, prefix,
|
"auth_key_tx_state=%s\n",
|
||||||
auth_key_tx_state_txt(sm->auth_key_tx_state));
|
auth_key_tx_state_txt(sm->auth_key_tx_state));
|
||||||
|
if (ret < 0 || ret >= end - pos)
|
||||||
|
return pos - buf;
|
||||||
|
pos += ret;
|
||||||
|
|
||||||
fprintf(f, "%s Key Receive:\n"
|
ret = os_snprintf(pos, end - pos,
|
||||||
"%s state=%s\n"
|
"key_rx_state=%s\n"
|
||||||
"%s rxKey=%s\n", prefix, prefix,
|
"rxKey=%s\n",
|
||||||
key_rx_state_txt(sm->key_rx_state), prefix, _SB(sm->rxKey));
|
key_rx_state_txt(sm->key_rx_state),
|
||||||
|
_SB(sm->rxKey));
|
||||||
|
if (ret < 0 || ret >= end - pos)
|
||||||
|
return pos - buf;
|
||||||
|
pos += ret;
|
||||||
|
|
||||||
fprintf(f, "%s Controlled Directions:\n"
|
ret = os_snprintf(pos, end - pos,
|
||||||
"%s state=%s\n"
|
"ctrl_dir_state=%s\n"
|
||||||
"%s adminControlledDirections=%s "
|
"adminControlledDirections=%s\n"
|
||||||
"operControlledDirections=%s\n"
|
"operControlledDirections=%s\n"
|
||||||
"%s operEdge=%s\n", prefix, prefix,
|
"operEdge=%s\n",
|
||||||
ctrl_dir_state_txt(sm->ctrl_dir_state),
|
ctrl_dir_state_txt(sm->ctrl_dir_state),
|
||||||
prefix, ctrl_dir_txt(sm->adminControlledDirections),
|
ctrl_dir_txt(sm->adminControlledDirections),
|
||||||
ctrl_dir_txt(sm->operControlledDirections),
|
ctrl_dir_txt(sm->operControlledDirections),
|
||||||
prefix, _SB(sm->operEdge));
|
_SB(sm->operEdge));
|
||||||
|
if (ret < 0 || ret >= end - pos)
|
||||||
|
return pos - buf;
|
||||||
|
pos += ret;
|
||||||
#undef _SB
|
#undef _SB
|
||||||
|
|
||||||
|
return pos - buf;
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,8 +83,8 @@ eapol_auth_alloc(struct eapol_authenticator *eapol, const u8 *addr,
|
||||||
const char *identity, const char *radius_cui);
|
const char *identity, const char *radius_cui);
|
||||||
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,
|
int eapol_auth_dump_state(struct eapol_state_machine *sm, char *buf,
|
||||||
struct eapol_state_machine *sm);
|
size_t buflen);
|
||||||
int eapol_auth_eap_pending_cb(struct eapol_state_machine *sm, void *ctx);
|
int eapol_auth_eap_pending_cb(struct eapol_state_machine *sm, void *ctx);
|
||||||
|
|
||||||
#endif /* EAPOL_AUTH_SM_H */
|
#endif /* EAPOL_AUTH_SM_H */
|
||||||
|
|
Loading…
Reference in a new issue