2 * IEEE 802.1X-2004 Authenticator - EAPOL state machine (internal definitions)
3 * Copyright (c) 2002-2009, Jouni Malinen <j@w1.fi>
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
9 #ifndef EAPOL_AUTH_SM_I_H
10 #define EAPOL_AUTH_SM_I_H
12 #include "common/defs.h"
13 #include "radius/radius.h"
15 /* IEEE Std 802.1X-2004, Ch. 8.2 */
17 typedef enum { ForceUnauthorized = 1, ForceAuthorized = 3, Auto = 2 }
19 typedef enum { Unauthorized = 2, Authorized = 1 } PortState;
20 typedef enum { Both = 0, In = 1 } ControlledDirection;
21 typedef unsigned int Counter;
25 * struct eapol_authenticator - Global EAPOL authenticator data
27 struct eapol_authenticator {
28 struct eapol_auth_config conf;
29 struct eapol_auth_cb cb;
32 u8 default_wep_key_idx;
37 * struct eapol_state_machine - Per-Supplicant Authenticator state machines
39 struct eapol_state_machine {
45 /* global variables */
48 PortState authPortStatus;
57 PortTypes portControl;
59 Boolean reAuthenticate;
61 /* Port Timers state machine */
62 /* 'Boolean tick' implicitly handled as registered timeout */
64 /* Authenticator PAE state machine */
65 enum { AUTH_PAE_INITIALIZE, AUTH_PAE_DISCONNECTED, AUTH_PAE_CONNECTING,
66 AUTH_PAE_AUTHENTICATING, AUTH_PAE_AUTHENTICATED,
67 AUTH_PAE_ABORTING, AUTH_PAE_HELD, AUTH_PAE_FORCE_AUTH,
68 AUTH_PAE_FORCE_UNAUTH, AUTH_PAE_RESTART } auth_pae_state;
73 unsigned int reAuthCount;
75 unsigned int quietPeriod; /* default 60; 0..65535 */
76 #define AUTH_PAE_DEFAULT_quietPeriod 60
77 unsigned int reAuthMax; /* default 2 */
78 #define AUTH_PAE_DEFAULT_reAuthMax 2
80 Counter authEntersConnecting;
81 Counter authEapLogoffsWhileConnecting;
82 Counter authEntersAuthenticating;
83 Counter authAuthSuccessesWhileAuthenticating;
84 Counter authAuthTimeoutsWhileAuthenticating;
85 Counter authAuthFailWhileAuthenticating;
86 Counter authAuthEapStartsWhileAuthenticating;
87 Counter authAuthEapLogoffWhileAuthenticating;
88 Counter authAuthReauthsWhileAuthenticated;
89 Counter authAuthEapStartsWhileAuthenticated;
90 Counter authAuthEapLogoffWhileAuthenticated;
92 /* Backend Authentication state machine */
93 enum { BE_AUTH_REQUEST, BE_AUTH_RESPONSE, BE_AUTH_SUCCESS,
94 BE_AUTH_FAIL, BE_AUTH_TIMEOUT, BE_AUTH_IDLE, BE_AUTH_INITIALIZE,
98 unsigned int serverTimeout; /* default 30; 1..X */
99 #define BE_AUTH_DEFAULT_serverTimeout 30
101 Counter backendResponses;
102 Counter backendAccessChallenges;
103 Counter backendOtherRequestsToSupplicant;
104 Counter backendAuthSuccesses;
105 Counter backendAuthFails;
107 /* Reauthentication Timer state machine */
108 enum { REAUTH_TIMER_INITIALIZE, REAUTH_TIMER_REAUTHENTICATE
109 } reauth_timer_state;
111 unsigned int reAuthPeriod; /* default 3600 s */
112 Boolean reAuthEnabled;
114 /* Authenticator Key Transmit state machine */
115 enum { AUTH_KEY_TX_NO_KEY_TRANSMIT, AUTH_KEY_TX_KEY_TRANSMIT
118 /* Key Receive state machine */
119 enum { KEY_RX_NO_KEY_RECEIVE, KEY_RX_KEY_RECEIVE } key_rx_state;
123 /* Controlled Directions state machine */
124 enum { CTRL_DIR_FORCE_BOTH, CTRL_DIR_IN_OR_BOTH } ctrl_dir_state;
126 ControlledDirection adminControlledDirections;
127 ControlledDirection operControlledDirections;
130 /* Authenticator Statistics Table */
131 Counter dot1xAuthEapolFramesRx;
132 Counter dot1xAuthEapolFramesTx;
133 Counter dot1xAuthEapolStartFramesRx;
134 Counter dot1xAuthEapolLogoffFramesRx;
135 Counter dot1xAuthEapolRespIdFramesRx;
136 Counter dot1xAuthEapolRespFramesRx;
137 Counter dot1xAuthEapolReqIdFramesTx;
138 Counter dot1xAuthEapolReqFramesTx;
139 Counter dot1xAuthInvalidEapolFramesRx;
140 Counter dot1xAuthEapLengthErrorFramesRx;
141 Counter dot1xAuthLastEapolFrameVersion;
143 /* Other variables - not defined in IEEE 802.1X */
144 u8 addr[ETH_ALEN]; /* Supplicant address */
145 int flags; /* EAPOL_SM_* */
147 /* EAPOL/AAA <-> EAP full authenticator interface */
148 struct eap_eapol_interface *eap_if;
150 int radius_identifier;
151 /* TODO: check when the last messages can be released */
152 struct radius_msg *last_recv_radius;
153 u8 last_eap_id; /* last used EAP Identifier */
156 u8 eap_type_authsrv; /* EAP type of the last EAP packet from
157 * Authentication server */
158 u8 eap_type_supp; /* EAP type of the last EAP packet from Supplicant */
159 struct radius_class_data radius_class;
160 struct wpabuf *radius_cui; /* Chargeable-User-Identity */
162 /* Keys for encrypting and signing EAPOL-Key frames */
164 size_t eapol_key_sign_len;
166 size_t eapol_key_crypt_len;
170 Boolean initializing; /* in process of initializing state machines */
173 struct eapol_authenticator *eapol;
175 void *sta; /* station context pointer to use in callbacks */
178 #endif /* EAPOL_AUTH_SM_I_H */