EAPOL auth: Convert Boolean to C99 bool

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Jouni Malinen 2020-04-24 00:29:09 +03:00 committed by Jouni Malinen
parent 56024a233a
commit 3dc69721e8
4 changed files with 114 additions and 116 deletions

View file

@ -878,7 +878,7 @@ static void handle_eap_response(struct hostapd_data *hapd,
wpabuf_free(sm->eap_if->eapRespData); wpabuf_free(sm->eap_if->eapRespData);
sm->eap_if->eapRespData = wpabuf_alloc_copy(eap, len); sm->eap_if->eapRespData = wpabuf_alloc_copy(eap, len);
sm->eapolEap = TRUE; sm->eapolEap = true;
} }
@ -909,7 +909,7 @@ static void handle_eap_initiate(struct hostapd_data *hapd,
wpabuf_free(sm->eap_if->eapRespData); wpabuf_free(sm->eap_if->eapRespData);
sm->eap_if->eapRespData = wpabuf_alloc_copy(eap, len); sm->eap_if->eapRespData = wpabuf_alloc_copy(eap, len);
sm->eapolEap = TRUE; sm->eapolEap = true;
#endif /* CONFIG_ERP */ #endif /* CONFIG_ERP */
} }
@ -1140,7 +1140,7 @@ void ieee802_1x_receive(struct hostapd_data *hapd, const u8 *sa, const u8 *buf,
} }
#endif /* CONFIG_WPS */ #endif /* CONFIG_WPS */
sta->eapol_sm->eap_if->portEnabled = TRUE; sta->eapol_sm->eap_if->portEnabled = true;
} }
/* since we support version 1, we can ignore version field and proceed /* since we support version 1, we can ignore version field and proceed
@ -1167,7 +1167,7 @@ void ieee802_1x_receive(struct hostapd_data *hapd, const u8 *sa, const u8 *buf,
"cached PMKSA available - ignore it since STA sent EAPOL-Start"); "cached PMKSA available - ignore it since STA sent EAPOL-Start");
wpa_auth_sta_clear_pmksa(sta->wpa_sm, pmksa); wpa_auth_sta_clear_pmksa(sta->wpa_sm, pmksa);
} }
sta->eapol_sm->eapolStart = TRUE; sta->eapol_sm->eapolStart = true;
sta->eapol_sm->dot1xAuthEapolStartFramesRx++; sta->eapol_sm->dot1xAuthEapolStartFramesRx++;
eap_server_clear_identity(sta->eapol_sm->eap); eap_server_clear_identity(sta->eapol_sm->eap);
wpa_auth_sm_event(sta->wpa_sm, WPA_REAUTH_EAPOL); wpa_auth_sm_event(sta->wpa_sm, WPA_REAUTH_EAPOL);
@ -1180,7 +1180,7 @@ void ieee802_1x_receive(struct hostapd_data *hapd, const u8 *sa, const u8 *buf,
sta->acct_terminate_cause = sta->acct_terminate_cause =
RADIUS_ACCT_TERMINATE_CAUSE_USER_REQUEST; RADIUS_ACCT_TERMINATE_CAUSE_USER_REQUEST;
accounting_sta_stop(hapd, sta); accounting_sta_stop(hapd, sta);
sta->eapol_sm->eapolLogoff = TRUE; sta->eapol_sm->eapolLogoff = true;
sta->eapol_sm->dot1xAuthEapolLogoffFramesRx++; sta->eapol_sm->dot1xAuthEapolLogoffFramesRx++;
eap_server_clear_identity(sta->eapol_sm->eap); eap_server_clear_identity(sta->eapol_sm->eap);
break; break;
@ -1297,7 +1297,7 @@ void ieee802_1x_new_station(struct hostapd_data *hapd, struct sta_info *sta)
} }
#endif /* CONFIG_WPS */ #endif /* CONFIG_WPS */
sta->eapol_sm->eap_if->portEnabled = TRUE; sta->eapol_sm->eap_if->portEnabled = true;
#ifdef CONFIG_IEEE80211R_AP #ifdef CONFIG_IEEE80211R_AP
if (sta->auth_alg == WLAN_AUTH_FT) { if (sta->auth_alg == WLAN_AUTH_FT) {
@ -1306,13 +1306,13 @@ void ieee802_1x_new_station(struct hostapd_data *hapd, struct sta_info *sta)
"PMK from FT - skip IEEE 802.1X/EAP"); "PMK from FT - skip IEEE 802.1X/EAP");
/* Setup EAPOL state machines to already authenticated state /* Setup EAPOL state machines to already authenticated state
* because of existing FT information from R0KH. */ * because of existing FT information from R0KH. */
sta->eapol_sm->keyRun = TRUE; sta->eapol_sm->keyRun = true;
sta->eapol_sm->eap_if->eapKeyAvailable = TRUE; sta->eapol_sm->eap_if->eapKeyAvailable = true;
sta->eapol_sm->auth_pae_state = AUTH_PAE_AUTHENTICATING; sta->eapol_sm->auth_pae_state = AUTH_PAE_AUTHENTICATING;
sta->eapol_sm->be_auth_state = BE_AUTH_SUCCESS; sta->eapol_sm->be_auth_state = BE_AUTH_SUCCESS;
sta->eapol_sm->authSuccess = TRUE; sta->eapol_sm->authSuccess = true;
sta->eapol_sm->authFail = FALSE; sta->eapol_sm->authFail = false;
sta->eapol_sm->portValid = TRUE; sta->eapol_sm->portValid = true;
if (sta->eapol_sm->eap) if (sta->eapol_sm->eap)
eap_sm_notify_cached(sta->eapol_sm->eap); eap_sm_notify_cached(sta->eapol_sm->eap);
ap_sta_bind_vlan(hapd, sta); ap_sta_bind_vlan(hapd, sta);
@ -1329,13 +1329,13 @@ void ieee802_1x_new_station(struct hostapd_data *hapd, struct sta_info *sta)
"PMK from FILS - skip IEEE 802.1X/EAP"); "PMK from FILS - skip IEEE 802.1X/EAP");
/* Setup EAPOL state machines to already authenticated state /* Setup EAPOL state machines to already authenticated state
* because of existing FILS information. */ * because of existing FILS information. */
sta->eapol_sm->keyRun = TRUE; sta->eapol_sm->keyRun = true;
sta->eapol_sm->eap_if->eapKeyAvailable = TRUE; sta->eapol_sm->eap_if->eapKeyAvailable = true;
sta->eapol_sm->auth_pae_state = AUTH_PAE_AUTHENTICATING; sta->eapol_sm->auth_pae_state = AUTH_PAE_AUTHENTICATING;
sta->eapol_sm->be_auth_state = BE_AUTH_SUCCESS; sta->eapol_sm->be_auth_state = BE_AUTH_SUCCESS;
sta->eapol_sm->authSuccess = TRUE; sta->eapol_sm->authSuccess = true;
sta->eapol_sm->authFail = FALSE; sta->eapol_sm->authFail = false;
sta->eapol_sm->portValid = TRUE; sta->eapol_sm->portValid = true;
if (sta->eapol_sm->eap) if (sta->eapol_sm->eap)
eap_sm_notify_cached(sta->eapol_sm->eap); eap_sm_notify_cached(sta->eapol_sm->eap);
wpa_auth_set_ptk_rekey_timer(sta->wpa_sm); wpa_auth_set_ptk_rekey_timer(sta->wpa_sm);
@ -1350,12 +1350,12 @@ void ieee802_1x_new_station(struct hostapd_data *hapd, struct sta_info *sta)
"PMK from PMKSA cache - skip IEEE 802.1X/EAP"); "PMK from PMKSA cache - skip IEEE 802.1X/EAP");
/* Setup EAPOL state machines to already authenticated state /* Setup EAPOL state machines to already authenticated state
* because of existing PMKSA information in the cache. */ * because of existing PMKSA information in the cache. */
sta->eapol_sm->keyRun = TRUE; sta->eapol_sm->keyRun = true;
sta->eapol_sm->eap_if->eapKeyAvailable = TRUE; sta->eapol_sm->eap_if->eapKeyAvailable = true;
sta->eapol_sm->auth_pae_state = AUTH_PAE_AUTHENTICATING; sta->eapol_sm->auth_pae_state = AUTH_PAE_AUTHENTICATING;
sta->eapol_sm->be_auth_state = BE_AUTH_SUCCESS; sta->eapol_sm->be_auth_state = BE_AUTH_SUCCESS;
sta->eapol_sm->authSuccess = TRUE; sta->eapol_sm->authSuccess = true;
sta->eapol_sm->authFail = FALSE; sta->eapol_sm->authFail = false;
if (sta->eapol_sm->eap) if (sta->eapol_sm->eap)
eap_sm_notify_cached(sta->eapol_sm->eap); eap_sm_notify_cached(sta->eapol_sm->eap);
pmksa_cache_to_eapol_data(hapd, pmksa, sta->eapol_sm); pmksa_cache_to_eapol_data(hapd, pmksa, sta->eapol_sm);
@ -1367,7 +1367,7 @@ void ieee802_1x_new_station(struct hostapd_data *hapd, struct sta_info *sta)
* re-authentication without having to wait for the * re-authentication without having to wait for the
* Supplicant to send EAPOL-Start. * Supplicant to send EAPOL-Start.
*/ */
sta->eapol_sm->reAuthenticate = TRUE; sta->eapol_sm->reAuthenticate = true;
} }
eapol_auth_step(sta->eapol_sm); eapol_auth_step(sta->eapol_sm);
} }
@ -1415,7 +1415,7 @@ static void ieee802_1x_decapsulate_radius(struct hostapd_data *hapd,
if (!sm || !sm->last_recv_radius) { if (!sm || !sm->last_recv_radius) {
if (sm) if (sm)
sm->eap_if->aaaEapNoReq = TRUE; sm->eap_if->aaaEapNoReq = true;
return; return;
} }
@ -1429,7 +1429,7 @@ static void ieee802_1x_decapsulate_radius(struct hostapd_data *hapd,
hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X, hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
HOSTAPD_LEVEL_WARNING, HOSTAPD_LEVEL_WARNING,
"could not extract EAP-Message from RADIUS message"); "could not extract EAP-Message from RADIUS message");
sm->eap_if->aaaEapNoReq = TRUE; sm->eap_if->aaaEapNoReq = true;
return; return;
} }
@ -1438,7 +1438,7 @@ static void ieee802_1x_decapsulate_radius(struct hostapd_data *hapd,
HOSTAPD_LEVEL_WARNING, HOSTAPD_LEVEL_WARNING,
"too short EAP packet received from authentication server"); "too short EAP packet received from authentication server");
wpabuf_free(eap); wpabuf_free(eap);
sm->eap_if->aaaEapNoReq = TRUE; sm->eap_if->aaaEapNoReq = true;
return; return;
} }
@ -1473,7 +1473,7 @@ static void ieee802_1x_decapsulate_radius(struct hostapd_data *hapd,
"decapsulated EAP packet (code=%d id=%d len=%d) from RADIUS server: %s", "decapsulated EAP packet (code=%d id=%d len=%d) from RADIUS server: %s",
hdr->code, hdr->identifier, be_to_host16(hdr->length), hdr->code, hdr->identifier, be_to_host16(hdr->length),
buf); buf);
sm->eap_if->aaaEapReq = TRUE; sm->eap_if->aaaEapReq = true;
wpabuf_free(sm->eap_if->aaaEapReqData); wpabuf_free(sm->eap_if->aaaEapReqData);
sm->eap_if->aaaEapReqData = eap; sm->eap_if->aaaEapReqData = eap;
@ -1512,7 +1512,7 @@ static void ieee802_1x_get_keys(struct hostapd_data *hapd,
os_memcpy(sm->eap_if->aaaEapKeyData + keys->recv_len, os_memcpy(sm->eap_if->aaaEapKeyData + keys->recv_len,
keys->send, keys->send_len); keys->send, keys->send_len);
sm->eap_if->aaaEapKeyDataLen = len; sm->eap_if->aaaEapKeyDataLen = len;
sm->eap_if->aaaEapKeyAvailable = TRUE; sm->eap_if->aaaEapKeyAvailable = true;
} }
} else { } else {
wpa_printf(MSG_DEBUG, wpa_printf(MSG_DEBUG,
@ -1880,7 +1880,7 @@ static int ieee802_1x_update_vlan(struct radius_msg *msg,
if (vlan_desc.notempty && if (vlan_desc.notempty &&
!hostapd_vlan_valid(hapd->conf->vlan, &vlan_desc)) { !hostapd_vlan_valid(hapd->conf->vlan, &vlan_desc)) {
sta->eapol_sm->authFail = TRUE; sta->eapol_sm->authFail = true;
hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_RADIUS, hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_RADIUS,
HOSTAPD_LEVEL_INFO, HOSTAPD_LEVEL_INFO,
"Invalid VLAN %d%s received from RADIUS server", "Invalid VLAN %d%s received from RADIUS server",
@ -1893,7 +1893,7 @@ static int ieee802_1x_update_vlan(struct radius_msg *msg,
if (hapd->conf->ssid.dynamic_vlan == DYNAMIC_VLAN_REQUIRED && if (hapd->conf->ssid.dynamic_vlan == DYNAMIC_VLAN_REQUIRED &&
!vlan_desc.notempty) { !vlan_desc.notempty) {
sta->eapol_sm->authFail = TRUE; sta->eapol_sm->authFail = true;
hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X, hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
HOSTAPD_LEVEL_INFO, HOSTAPD_LEVEL_INFO,
"authentication server did not include required VLAN ID in Access-Accept"); "authentication server did not include required VLAN ID in Access-Accept");
@ -2019,7 +2019,7 @@ ieee802_1x_receive_auth(struct radius_msg *msg, struct radius_msg *req,
else else
ap_sta_no_session_timeout(hapd, sta); ap_sta_no_session_timeout(hapd, sta);
sm->eap_if->aaaSuccess = TRUE; sm->eap_if->aaaSuccess = true;
override_eapReq = 1; override_eapReq = 1;
ieee802_1x_get_keys(hapd, sta, msg, req, shared_secret, ieee802_1x_get_keys(hapd, sta, msg, req, shared_secret,
shared_secret_len); shared_secret_len);
@ -2031,7 +2031,7 @@ ieee802_1x_receive_auth(struct radius_msg *msg, struct radius_msg *req,
(int) session_timeout : -1); (int) session_timeout : -1);
break; break;
case RADIUS_CODE_ACCESS_REJECT: case RADIUS_CODE_ACCESS_REJECT:
sm->eap_if->aaaFail = TRUE; sm->eap_if->aaaFail = true;
override_eapReq = 1; override_eapReq = 1;
if (radius_msg_get_attr_int32(msg, RADIUS_ATTR_WLAN_REASON_CODE, if (radius_msg_get_attr_int32(msg, RADIUS_ATTR_WLAN_REASON_CODE,
&reason_code) == 0) { &reason_code) == 0) {
@ -2042,7 +2042,7 @@ ieee802_1x_receive_auth(struct radius_msg *msg, struct radius_msg *req,
} }
break; break;
case RADIUS_CODE_ACCESS_CHALLENGE: case RADIUS_CODE_ACCESS_CHALLENGE:
sm->eap_if->aaaEapReq = TRUE; sm->eap_if->aaaEapReq = true;
if (session_timeout_set) { if (session_timeout_set) {
/* RFC 2869, Ch. 2.3.2; RFC 3580, Ch. 3.17 */ /* RFC 2869, Ch. 2.3.2; RFC 3580, Ch. 3.17 */
sm->eap_if->aaaMethodTimeout = session_timeout; sm->eap_if->aaaMethodTimeout = session_timeout;
@ -2063,7 +2063,7 @@ ieee802_1x_receive_auth(struct radius_msg *msg, struct radius_msg *req,
ieee802_1x_decapsulate_radius(hapd, sta); ieee802_1x_decapsulate_radius(hapd, sta);
if (override_eapReq) if (override_eapReq)
sm->eap_if->aaaEapReq = FALSE; sm->eap_if->aaaEapReq = false;
#ifdef CONFIG_FILS #ifdef CONFIG_FILS
#ifdef NEED_AP_MLME #ifdef NEED_AP_MLME
@ -2109,7 +2109,7 @@ void ieee802_1x_abort_auth(struct hostapd_data *hapd, struct sta_info *sta)
wpa_dbg(hapd->msg_ctx, MSG_DEBUG, "EAP Timeout, STA " MACSTR, wpa_dbg(hapd->msg_ctx, MSG_DEBUG, "EAP Timeout, STA " MACSTR,
MAC2STR(sta->addr)); MAC2STR(sta->addr));
sm->eap_if->portEnabled = FALSE; sm->eap_if->portEnabled = false;
ap_sta_disconnect(hapd, sta, sta->addr, ap_sta_disconnect(hapd, sta, sta->addr,
WLAN_REASON_PREV_AUTH_NOT_VALID); WLAN_REASON_PREV_AUTH_NOT_VALID);
} }
@ -2148,7 +2148,7 @@ static int ieee802_1x_sta_key_available(struct hostapd_data *hapd,
struct sta_info *sta, void *ctx) struct sta_info *sta, void *ctx)
{ {
if (sta->eapol_sm) { if (sta->eapol_sm) {
sta->eapol_sm->eap_if->eapKeyAvailable = TRUE; sta->eapol_sm->eap_if->eapKeyAvailable = true;
eapol_auth_step(sta->eapol_sm); eapol_auth_step(sta->eapol_sm);
} }
return 0; return 0;
@ -2677,26 +2677,25 @@ const u8 * ieee802_1x_get_session_id(struct eapol_state_machine *sm,
void ieee802_1x_notify_port_enabled(struct eapol_state_machine *sm, void ieee802_1x_notify_port_enabled(struct eapol_state_machine *sm,
int enabled) bool enabled)
{ {
if (!sm) if (!sm)
return; return;
sm->eap_if->portEnabled = enabled ? TRUE : FALSE; sm->eap_if->portEnabled = enabled;
eapol_auth_step(sm); eapol_auth_step(sm);
} }
void ieee802_1x_notify_port_valid(struct eapol_state_machine *sm, void ieee802_1x_notify_port_valid(struct eapol_state_machine *sm, bool valid)
int valid)
{ {
if (!sm) if (!sm)
return; return;
sm->portValid = valid ? TRUE : FALSE; sm->portValid = valid;
eapol_auth_step(sm); eapol_auth_step(sm);
} }
void ieee802_1x_notify_pre_auth(struct eapol_state_machine *sm, int pre_auth) void ieee802_1x_notify_pre_auth(struct eapol_state_machine *sm, bool pre_auth)
{ {
if (!sm) if (!sm)
return; return;
@ -2707,7 +2706,7 @@ void ieee802_1x_notify_pre_auth(struct eapol_state_machine *sm, int pre_auth)
} }
static const char * bool_txt(Boolean val) static const char * bool_txt(bool val)
{ {
return val ? "TRUE" : "FALSE"; return val ? "TRUE" : "FALSE";
} }

View file

@ -42,10 +42,9 @@ const u8 * ieee802_1x_get_key(struct eapol_state_machine *sm, size_t *len);
const u8 * ieee802_1x_get_session_id(struct eapol_state_machine *sm, const u8 * ieee802_1x_get_session_id(struct eapol_state_machine *sm,
size_t *len); size_t *len);
void ieee802_1x_notify_port_enabled(struct eapol_state_machine *sm, void ieee802_1x_notify_port_enabled(struct eapol_state_machine *sm,
int enabled); bool enabled);
void ieee802_1x_notify_port_valid(struct eapol_state_machine *sm, void ieee802_1x_notify_port_valid(struct eapol_state_machine *sm, bool valid);
int valid); void ieee802_1x_notify_pre_auth(struct eapol_state_machine *sm, bool pre_auth);
void ieee802_1x_notify_pre_auth(struct eapol_state_machine *sm, int pre_auth);
int ieee802_1x_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen); int ieee802_1x_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen);
int ieee802_1x_get_mib_sta(struct hostapd_data *hapd, struct sta_info *sta, int ieee802_1x_get_mib_sta(struct hostapd_data *hapd, struct sta_info *sta,
char *buf, size_t buflen); char *buf, size_t buflen);

View file

@ -206,10 +206,10 @@ SM_STATE(AUTH_PAE, INITIALIZE)
* get here on disconnection event without advancing to the * get here on disconnection event without advancing to the
* AUTHENTICATING state to clear keyRun before the IEEE 802.11 RSN * AUTHENTICATING state to clear keyRun before the IEEE 802.11 RSN
* authenticator state machine runs and that may advance from * authenticator state machine runs and that may advance from
* AUTHENTICATION2 to INITPMK if keyRun = TRUE has been left from the * AUTHENTICATION2 to INITPMK if keyRun = true has been left from the
* last association. This can be avoided by clearing keyRun here. * last association. This can be avoided by clearing keyRun here.
*/ */
sm->keyRun = FALSE; sm->keyRun = false;
} }
@ -229,7 +229,7 @@ SM_STATE(AUTH_PAE, DISCONNECTED)
sm->authPortStatus = Unauthorized; sm->authPortStatus = Unauthorized;
setPortUnauthorized(); setPortUnauthorized();
sm->reAuthCount = 0; sm->reAuthCount = 0;
sm->eapolLogoff = FALSE; sm->eapolLogoff = false;
if (!from_initialize) { if (!from_initialize) {
sm->eapol->cb.finished(sm->eapol->conf.ctx, sm->sta, 0, sm->eapol->cb.finished(sm->eapol->conf.ctx, sm->sta, 0,
sm->flags & EAPOL_SM_PREAUTH, sm->flags & EAPOL_SM_PREAUTH,
@ -251,7 +251,7 @@ SM_STATE(AUTH_PAE, RESTART)
SM_ENTRY_MA(AUTH_PAE, RESTART, auth_pae); SM_ENTRY_MA(AUTH_PAE, RESTART, auth_pae);
sm->eap_if->eapRestart = TRUE; sm->eap_if->eapRestart = true;
} }
@ -262,7 +262,7 @@ SM_STATE(AUTH_PAE, CONNECTING)
SM_ENTRY_MA(AUTH_PAE, CONNECTING, auth_pae); SM_ENTRY_MA(AUTH_PAE, CONNECTING, auth_pae);
sm->reAuthenticate = FALSE; sm->reAuthenticate = false;
sm->reAuthCount++; sm->reAuthCount++;
} }
@ -277,7 +277,7 @@ SM_STATE(AUTH_PAE, HELD)
sm->authPortStatus = Unauthorized; sm->authPortStatus = Unauthorized;
setPortUnauthorized(); setPortUnauthorized();
sm->quietWhile = sm->quietPeriod; sm->quietWhile = sm->quietPeriod;
sm->eapolLogoff = FALSE; sm->eapolLogoff = false;
eapol_auth_vlogger(sm->eapol, sm->addr, EAPOL_LOGGER_WARNING, eapol_auth_vlogger(sm->eapol, sm->addr, EAPOL_LOGGER_WARNING,
"authentication failed - EAP type: %d (%s)", "authentication failed - EAP type: %d (%s)",
@ -324,13 +324,13 @@ SM_STATE(AUTH_PAE, AUTHENTICATING)
{ {
SM_ENTRY_MA(AUTH_PAE, AUTHENTICATING, auth_pae); SM_ENTRY_MA(AUTH_PAE, AUTHENTICATING, auth_pae);
sm->eapolStart = FALSE; sm->eapolStart = false;
sm->authSuccess = FALSE; sm->authSuccess = false;
sm->authFail = FALSE; sm->authFail = false;
sm->authTimeout = FALSE; sm->authTimeout = false;
sm->authStart = TRUE; sm->authStart = true;
sm->keyRun = FALSE; sm->keyRun = false;
sm->keyDone = FALSE; sm->keyDone = false;
} }
@ -347,9 +347,9 @@ SM_STATE(AUTH_PAE, ABORTING)
SM_ENTRY_MA(AUTH_PAE, ABORTING, auth_pae); SM_ENTRY_MA(AUTH_PAE, ABORTING, auth_pae);
sm->authAbort = TRUE; sm->authAbort = true;
sm->keyRun = FALSE; sm->keyRun = false;
sm->keyDone = FALSE; sm->keyDone = false;
} }
@ -360,7 +360,7 @@ SM_STATE(AUTH_PAE, FORCE_AUTH)
sm->authPortStatus = Authorized; sm->authPortStatus = Authorized;
setPortAuthorized(); setPortAuthorized();
sm->portMode = ForceAuthorized; sm->portMode = ForceAuthorized;
sm->eapolStart = FALSE; sm->eapolStart = false;
txCannedSuccess(); txCannedSuccess();
} }
@ -372,7 +372,7 @@ SM_STATE(AUTH_PAE, FORCE_UNAUTH)
sm->authPortStatus = Unauthorized; sm->authPortStatus = Unauthorized;
setPortUnauthorized(); setPortUnauthorized();
sm->portMode = ForceUnauthorized; sm->portMode = ForceUnauthorized;
sm->eapolStart = FALSE; sm->eapolStart = false;
txCannedFail(); txCannedFail();
} }
@ -457,8 +457,8 @@ SM_STATE(BE_AUTH, INITIALIZE)
SM_ENTRY_MA(BE_AUTH, INITIALIZE, be_auth); SM_ENTRY_MA(BE_AUTH, INITIALIZE, be_auth);
abortAuth(); abortAuth();
sm->eap_if->eapNoReq = FALSE; sm->eap_if->eapNoReq = false;
sm->authAbort = FALSE; sm->authAbort = false;
} }
@ -467,7 +467,7 @@ SM_STATE(BE_AUTH, REQUEST)
SM_ENTRY_MA(BE_AUTH, REQUEST, be_auth); SM_ENTRY_MA(BE_AUTH, REQUEST, be_auth);
txReq(); txReq();
sm->eap_if->eapReq = FALSE; sm->eap_if->eapReq = false;
sm->backendOtherRequestsToSupplicant++; sm->backendOtherRequestsToSupplicant++;
/* /*
@ -481,7 +481,7 @@ SM_STATE(BE_AUTH, REQUEST)
* EAP-Request from the main EAP method. This can be avoided by * EAP-Request from the main EAP method. This can be avoided by
* clearing eapolEap here. * clearing eapolEap here.
*/ */
sm->eapolEap = FALSE; sm->eapolEap = false;
} }
@ -489,11 +489,11 @@ SM_STATE(BE_AUTH, RESPONSE)
{ {
SM_ENTRY_MA(BE_AUTH, RESPONSE, be_auth); SM_ENTRY_MA(BE_AUTH, RESPONSE, be_auth);
sm->authTimeout = FALSE; sm->authTimeout = false;
sm->eapolEap = FALSE; sm->eapolEap = false;
sm->eap_if->eapNoReq = FALSE; sm->eap_if->eapNoReq = false;
sm->aWhile = sm->serverTimeout; sm->aWhile = sm->serverTimeout;
sm->eap_if->eapResp = TRUE; sm->eap_if->eapResp = true;
/* sendRespToServer(); */ /* sendRespToServer(); */
sm->backendResponses++; sm->backendResponses++;
} }
@ -504,8 +504,8 @@ SM_STATE(BE_AUTH, SUCCESS)
SM_ENTRY_MA(BE_AUTH, SUCCESS, be_auth); SM_ENTRY_MA(BE_AUTH, SUCCESS, be_auth);
txReq(); txReq();
sm->authSuccess = TRUE; sm->authSuccess = true;
sm->keyRun = TRUE; sm->keyRun = true;
} }
@ -514,7 +514,7 @@ SM_STATE(BE_AUTH, FAIL)
SM_ENTRY_MA(BE_AUTH, FAIL, be_auth); SM_ENTRY_MA(BE_AUTH, FAIL, be_auth);
txReq(); txReq();
sm->authFail = TRUE; sm->authFail = true;
} }
@ -522,7 +522,7 @@ SM_STATE(BE_AUTH, TIMEOUT)
{ {
SM_ENTRY_MA(BE_AUTH, TIMEOUT, be_auth); SM_ENTRY_MA(BE_AUTH, TIMEOUT, be_auth);
sm->authTimeout = TRUE; sm->authTimeout = true;
} }
@ -530,7 +530,7 @@ SM_STATE(BE_AUTH, IDLE)
{ {
SM_ENTRY_MA(BE_AUTH, IDLE, be_auth); SM_ENTRY_MA(BE_AUTH, IDLE, be_auth);
sm->authStart = FALSE; sm->authStart = false;
} }
@ -538,7 +538,7 @@ SM_STATE(BE_AUTH, IGNORE)
{ {
SM_ENTRY_MA(BE_AUTH, IGNORE, be_auth); SM_ENTRY_MA(BE_AUTH, IGNORE, be_auth);
sm->eap_if->eapNoReq = FALSE; sm->eap_if->eapNoReq = false;
} }
@ -621,7 +621,7 @@ SM_STATE(REAUTH_TIMER, REAUTHENTICATE)
{ {
SM_ENTRY_MA(REAUTH_TIMER, REAUTHENTICATE, reauth_timer); SM_ENTRY_MA(REAUTH_TIMER, REAUTHENTICATE, reauth_timer);
sm->reAuthenticate = TRUE; sm->reAuthenticate = true;
sm->eapol->cb.eapol_event(sm->eapol->conf.ctx, sm->sta, sm->eapol->cb.eapol_event(sm->eapol->conf.ctx, sm->sta,
EAPOL_AUTH_REAUTHENTICATE); EAPOL_AUTH_REAUTHENTICATE);
} }
@ -663,8 +663,8 @@ SM_STATE(AUTH_KEY_TX, KEY_TRANSMIT)
SM_ENTRY_MA(AUTH_KEY_TX, KEY_TRANSMIT, auth_key_tx); SM_ENTRY_MA(AUTH_KEY_TX, KEY_TRANSMIT, auth_key_tx);
txKey(); txKey();
sm->eap_if->eapKeyAvailable = FALSE; sm->eap_if->eapKeyAvailable = false;
sm->keyDone = TRUE; sm->keyDone = true;
} }
@ -705,7 +705,7 @@ SM_STATE(KEY_RX, KEY_RECEIVE)
SM_ENTRY_MA(KEY_RX, KEY_RECEIVE, key_rx); SM_ENTRY_MA(KEY_RX, KEY_RECEIVE, key_rx);
processKey(); processKey();
sm->rxKey = FALSE; sm->rxKey = false;
} }
@ -807,7 +807,7 @@ eapol_auth_alloc(struct eapol_authenticator *eapol, const u8 *addr,
sm->reauth_timer_state = REAUTH_TIMER_INITIALIZE; sm->reauth_timer_state = REAUTH_TIMER_INITIALIZE;
sm->reAuthPeriod = eapol->conf.eap_reauth_period; sm->reAuthPeriod = eapol->conf.eap_reauth_period;
sm->reAuthEnabled = eapol->conf.eap_reauth_period > 0 ? TRUE : FALSE; sm->reAuthEnabled = eapol->conf.eap_reauth_period > 0;
sm->auth_key_tx_state = AUTH_KEY_TX_NO_KEY_TRANSMIT; sm->auth_key_tx_state = AUTH_KEY_TX_NO_KEY_TRANSMIT;
@ -820,14 +820,14 @@ eapol_auth_alloc(struct eapol_authenticator *eapol, const u8 *addr,
#ifdef CONFIG_WEP #ifdef CONFIG_WEP
if (!eapol->conf.wpa && if (!eapol->conf.wpa &&
(eapol->default_wep_key || eapol->conf.individual_wep_key_len > 0)) (eapol->default_wep_key || eapol->conf.individual_wep_key_len > 0))
sm->keyTxEnabled = TRUE; sm->keyTxEnabled = true;
else else
#endif /* CONFIG_WEP */ #endif /* CONFIG_WEP */
sm->keyTxEnabled = FALSE; sm->keyTxEnabled = false;
if (eapol->conf.wpa) if (eapol->conf.wpa)
sm->portValid = FALSE; sm->portValid = false;
else else
sm->portValid = TRUE; sm->portValid = true;
os_memset(&eap_sess, 0, sizeof(eap_sess)); os_memset(&eap_sess, 0, sizeof(eap_sess));
eap_sess.assoc_wps_ie = assoc_wps_ie; eap_sess.assoc_wps_ie = assoc_wps_ie;
@ -949,7 +949,7 @@ restart:
/* TODO: find a better location for this */ /* TODO: find a better location for this */
if (sm->eap_if->aaaEapResp) { if (sm->eap_if->aaaEapResp) {
sm->eap_if->aaaEapResp = FALSE; sm->eap_if->aaaEapResp = false;
if (sm->eap_if->aaaEapRespData == NULL) { if (sm->eap_if->aaaEapRespData == NULL) {
wpa_printf(MSG_DEBUG, "EAPOL: aaaEapResp set, " wpa_printf(MSG_DEBUG, "EAPOL: aaaEapResp set, "
"but no aaaEapRespData available"); "but no aaaEapRespData available");
@ -996,14 +996,14 @@ void eapol_auth_step(struct eapol_state_machine *sm)
static void eapol_auth_initialize(struct eapol_state_machine *sm) static void eapol_auth_initialize(struct eapol_state_machine *sm)
{ {
sm->initializing = TRUE; sm->initializing = true;
/* Initialize the state machines by asserting initialize and then /* Initialize the state machines by asserting initialize and then
* deasserting it after one step */ * deasserting it after one step */
sm->initialize = TRUE; sm->initialize = true;
eapol_sm_step_run(sm); eapol_sm_step_run(sm);
sm->initialize = FALSE; sm->initialize = false;
eapol_sm_step_run(sm); eapol_sm_step_run(sm);
sm->initializing = FALSE; sm->initializing = false;
/* Start one second tick for port timers state machine */ /* Start one second tick for port timers state machine */
eloop_cancel_timeout(eapol_port_timers_tick, NULL, sm); eloop_cancel_timeout(eapol_port_timers_tick, NULL, sm);
@ -1091,7 +1091,7 @@ void eapol_auth_reauthenticate(struct eapol_state_machine *sm)
{ {
wpa_printf(MSG_DEBUG, "EAPOL: External reauthentication trigger for " wpa_printf(MSG_DEBUG, "EAPOL: External reauthentication trigger for "
MACSTR, MAC2STR(sm->addr)); MACSTR, MAC2STR(sm->addr));
sm->reAuthenticate = TRUE; sm->reAuthenticate = true;
eapol_auth_step(sm); eapol_auth_step(sm);
} }
@ -1144,9 +1144,9 @@ int eapol_auth_set_conf(struct eapol_state_machine *sm, const char *param,
if (os_strcasecmp(param, "reAuthEnabled") == 0) { if (os_strcasecmp(param, "reAuthEnabled") == 0) {
if (os_strcmp(value, "TRUE") == 0) if (os_strcmp(value, "TRUE") == 0)
sm->reAuthEnabled = TRUE; sm->reAuthEnabled = true;
else if (os_strcmp(value, "FALSE") == 0) else if (os_strcmp(value, "FALSE") == 0)
sm->reAuthEnabled = FALSE; sm->reAuthEnabled = false;
else else
return -1; return -1;
eapol_auth_step(sm); eapol_auth_step(sm);
@ -1155,9 +1155,9 @@ int eapol_auth_set_conf(struct eapol_state_machine *sm, const char *param,
if (os_strcasecmp(param, "KeyTransmissionEnabled") == 0) { if (os_strcasecmp(param, "KeyTransmissionEnabled") == 0) {
if (os_strcmp(value, "TRUE") == 0) if (os_strcmp(value, "TRUE") == 0)
sm->keyTxEnabled = TRUE; sm->keyTxEnabled = true;
else if (os_strcmp(value, "FALSE") == 0) else if (os_strcmp(value, "FALSE") == 0)
sm->keyTxEnabled = FALSE; sm->keyTxEnabled = false;
else else
return -1; return -1;
eapol_auth_step(sm); eapol_auth_step(sm);

View file

@ -43,23 +43,23 @@ struct eapol_state_machine {
int reAuthWhen; int reAuthWhen;
/* global variables */ /* global variables */
Boolean authAbort; bool authAbort;
Boolean authFail; bool authFail;
PortState authPortStatus; PortState authPortStatus;
Boolean authStart; bool authStart;
Boolean authTimeout; bool authTimeout;
Boolean authSuccess; bool authSuccess;
Boolean eapolEap; bool eapolEap;
Boolean initialize; bool initialize;
Boolean keyDone; bool keyDone;
Boolean keyRun; bool keyRun;
Boolean keyTxEnabled; bool keyTxEnabled;
PortTypes portControl; PortTypes portControl;
Boolean portValid; bool portValid;
Boolean reAuthenticate; bool reAuthenticate;
/* Port Timers state machine */ /* Port Timers state machine */
/* 'Boolean tick' implicitly handled as registered timeout */ /* 'bool tick' implicitly handled as registered timeout */
/* Authenticator PAE state machine */ /* Authenticator PAE state machine */
enum { AUTH_PAE_INITIALIZE, AUTH_PAE_DISCONNECTED, AUTH_PAE_CONNECTING, enum { AUTH_PAE_INITIALIZE, AUTH_PAE_DISCONNECTED, AUTH_PAE_CONNECTING,
@ -67,8 +67,8 @@ struct eapol_state_machine {
AUTH_PAE_ABORTING, AUTH_PAE_HELD, AUTH_PAE_FORCE_AUTH, AUTH_PAE_ABORTING, AUTH_PAE_HELD, AUTH_PAE_FORCE_AUTH,
AUTH_PAE_FORCE_UNAUTH, AUTH_PAE_RESTART } auth_pae_state; AUTH_PAE_FORCE_UNAUTH, AUTH_PAE_RESTART } auth_pae_state;
/* variables */ /* variables */
Boolean eapolLogoff; bool eapolLogoff;
Boolean eapolStart; bool eapolStart;
PortTypes portMode; PortTypes portMode;
unsigned int reAuthCount; unsigned int reAuthCount;
/* constants */ /* constants */
@ -109,7 +109,7 @@ struct eapol_state_machine {
} reauth_timer_state; } reauth_timer_state;
/* constants */ /* constants */
unsigned int reAuthPeriod; /* default 3600 s */ unsigned int reAuthPeriod; /* default 3600 s */
Boolean reAuthEnabled; bool reAuthEnabled;
/* Authenticator Key Transmit state machine */ /* Authenticator Key Transmit state machine */
enum { AUTH_KEY_TX_NO_KEY_TRANSMIT, AUTH_KEY_TX_KEY_TRANSMIT enum { AUTH_KEY_TX_NO_KEY_TRANSMIT, AUTH_KEY_TX_KEY_TRANSMIT
@ -118,14 +118,14 @@ struct eapol_state_machine {
/* Key Receive state machine */ /* Key Receive state machine */
enum { KEY_RX_NO_KEY_RECEIVE, KEY_RX_KEY_RECEIVE } key_rx_state; enum { KEY_RX_NO_KEY_RECEIVE, KEY_RX_KEY_RECEIVE } key_rx_state;
/* variables */ /* variables */
Boolean rxKey; bool rxKey;
/* Controlled Directions state machine */ /* Controlled Directions state machine */
enum { CTRL_DIR_FORCE_BOTH, CTRL_DIR_IN_OR_BOTH } ctrl_dir_state; enum { CTRL_DIR_FORCE_BOTH, CTRL_DIR_IN_OR_BOTH } ctrl_dir_state;
/* variables */ /* variables */
ControlledDirection adminControlledDirections; ControlledDirection adminControlledDirections;
ControlledDirection operControlledDirections; ControlledDirection operControlledDirections;
Boolean operEdge; bool operEdge;
/* Authenticator Statistics Table */ /* Authenticator Statistics Table */
Counter dot1xAuthEapolFramesRx; Counter dot1xAuthEapolFramesRx;
@ -161,8 +161,8 @@ struct eapol_state_machine {
struct eap_sm *eap; struct eap_sm *eap;
Boolean initializing; /* in process of initializing state machines */ bool initializing; /* in process of initializing state machines */
Boolean changed; bool changed;
struct eapol_authenticator *eapol; struct eapol_authenticator *eapol;