summaryrefslogtreecommitdiffstats
path: root/contrib/hostapd/eapol_sm.h
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2007-07-09 16:15:06 +0000
committersam <sam@FreeBSD.org>2007-07-09 16:15:06 +0000
commit1ae15be146f363fa41f3a9efad2e8818845710c0 (patch)
tree2bd9b7ea510ea511f6f5c075b9c6cc69f3825db5 /contrib/hostapd/eapol_sm.h
parent367201c0673eb288eabcc9b0b00a95f8c6f78b5a (diff)
parent1bf2fd00c50865c26197a0fb9ce70f417b9fa121 (diff)
downloadFreeBSD-src-1ae15be146f363fa41f3a9efad2e8818845710c0.zip
FreeBSD-src-1ae15be146f363fa41f3a9efad2e8818845710c0.tar.gz
This commit was generated by cvs2svn to compensate for changes in r171322,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'contrib/hostapd/eapol_sm.h')
-rw-r--r--contrib/hostapd/eapol_sm.h178
1 files changed, 82 insertions, 96 deletions
diff --git a/contrib/hostapd/eapol_sm.h b/contrib/hostapd/eapol_sm.h
index 0c34b4f..dcb5ee9 100644
--- a/contrib/hostapd/eapol_sm.h
+++ b/contrib/hostapd/eapol_sm.h
@@ -1,9 +1,23 @@
+/*
+ * hostapd / IEEE 802.1X Authenticator - EAPOL state machine
+ * Copyright (c) 2002-2005, Jouni Malinen <j@w1.fi>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Alternatively, this software may be distributed under the terms of BSD
+ * license.
+ *
+ * See README and COPYING for more details.
+ */
+
#ifndef EAPOL_SM_H
#define EAPOL_SM_H
#include "defs.h"
-/* IEEE Std 802.1X-REV-d11, Ch. 8.2 */
+/* IEEE Std 802.1X-2004, Ch. 8.2 */
typedef enum { ForceUnauthorized = 1, ForceAuthorized = 3, Auto = 2 }
PortTypes;
@@ -11,22 +25,64 @@ typedef enum { Unauthorized = 2, Authorized = 1 } PortState;
typedef enum { Both = 0, In = 1 } ControlledDirection;
typedef unsigned int Counter;
+struct eap_sm;
+
+struct radius_attr_data {
+ u8 *data;
+ size_t len;
+};
+
+struct radius_class_data {
+ struct radius_attr_data *attr;
+ size_t count;
+};
+
+struct eapol_state_machine {
+ /* timers */
+ int aWhile;
+ int quietWhile;
+ int reAuthWhen;
-/* Authenticator PAE state machine */
-struct eapol_auth_pae_sm {
+ /* global variables */
+ Boolean authAbort;
+ Boolean authFail;
+ PortState authPortStatus;
+ Boolean authStart;
+ Boolean authTimeout;
+ Boolean authSuccess;
+ Boolean eapFail;
+ Boolean eapolEap;
+ Boolean eapSuccess;
+ Boolean eapTimeout;
+ Boolean initialize;
+ Boolean keyAvailable;
+ Boolean keyDone;
+ Boolean keyRun;
+ Boolean keyTxEnabled;
+ PortTypes portControl;
+ Boolean portEnabled;
+ Boolean portValid;
+ Boolean reAuthenticate;
+
+ /* Port Timers state machine */
+ /* 'Boolean tick' implicitly handled as registered timeout */
+
+ /* Authenticator PAE state machine */
+ enum { AUTH_PAE_INITIALIZE, AUTH_PAE_DISCONNECTED, AUTH_PAE_CONNECTING,
+ AUTH_PAE_AUTHENTICATING, AUTH_PAE_AUTHENTICATED,
+ AUTH_PAE_ABORTING, AUTH_PAE_HELD, AUTH_PAE_FORCE_AUTH,
+ AUTH_PAE_FORCE_UNAUTH, AUTH_PAE_RESTART } auth_pae_state;
/* variables */
Boolean eapolLogoff;
Boolean eapolStart;
Boolean eapRestart;
PortTypes portMode;
unsigned int reAuthCount;
-
/* constants */
unsigned int quietPeriod; /* default 60; 0..65535 */
#define AUTH_PAE_DEFAULT_quietPeriod 60
unsigned int reAuthMax; /* default 2 */
#define AUTH_PAE_DEFAULT_reAuthMax 2
-
/* counters */
Counter authEntersConnecting;
Counter authEapLogoffsWhileConnecting;
@@ -40,24 +96,18 @@ struct eapol_auth_pae_sm {
Counter authAuthEapStartsWhileAuthenticated;
Counter authAuthEapLogoffWhileAuthenticated;
- enum { AUTH_PAE_INITIALIZE, AUTH_PAE_DISCONNECTED, AUTH_PAE_CONNECTING,
- AUTH_PAE_AUTHENTICATING, AUTH_PAE_AUTHENTICATED,
- AUTH_PAE_ABORTING, AUTH_PAE_HELD, AUTH_PAE_FORCE_AUTH,
- AUTH_PAE_FORCE_UNAUTH, AUTH_PAE_RESTART } state;
-};
-
-
-/* Backend Authentication state machine */
-struct eapol_backend_auth_sm {
+ /* Backend Authentication state machine */
+ enum { BE_AUTH_REQUEST, BE_AUTH_RESPONSE, BE_AUTH_SUCCESS,
+ BE_AUTH_FAIL, BE_AUTH_TIMEOUT, BE_AUTH_IDLE, BE_AUTH_INITIALIZE,
+ BE_AUTH_IGNORE
+ } be_auth_state;
/* variables */
Boolean eapNoReq;
Boolean eapReq;
Boolean eapResp;
-
/* constants */
unsigned int serverTimeout; /* default 30; 1..X */
#define BE_AUTH_DEFAULT_serverTimeout 30
-
/* counters */
Counter backendResponses;
Counter backendAccessChallenges;
@@ -65,98 +115,29 @@ struct eapol_backend_auth_sm {
Counter backendAuthSuccesses;
Counter backendAuthFails;
- enum { BE_AUTH_REQUEST, BE_AUTH_RESPONSE, BE_AUTH_SUCCESS,
- BE_AUTH_FAIL, BE_AUTH_TIMEOUT, BE_AUTH_IDLE, BE_AUTH_INITIALIZE,
- BE_AUTH_IGNORE
- } state;
-};
-
-
-/* Reauthentication Timer state machine */
-struct eapol_reauth_timer_sm {
+ /* Reauthentication Timer state machine */
+ enum { REAUTH_TIMER_INITIALIZE, REAUTH_TIMER_REAUTHENTICATE
+ } reauth_timer_state;
/* constants */
unsigned int reAuthPeriod; /* default 3600 s */
Boolean reAuthEnabled;
- enum { REAUTH_TIMER_INITIALIZE, REAUTH_TIMER_REAUTHENTICATE } state;
-};
-
+ /* Authenticator Key Transmit state machine */
+ enum { AUTH_KEY_TX_NO_KEY_TRANSMIT, AUTH_KEY_TX_KEY_TRANSMIT
+ } auth_key_tx_state;
-/* Authenticator Key Transmit state machine */
-struct eapol_auth_key_tx {
- enum { AUTH_KEY_TX_NO_KEY_TRANSMIT, AUTH_KEY_TX_KEY_TRANSMIT } state;
-};
-
-
-/* Key Receive state machine */
-struct eapol_key_rx {
+ /* Key Receive state machine */
+ enum { KEY_RX_NO_KEY_RECEIVE, KEY_RX_KEY_RECEIVE } key_rx_state;
/* variables */
Boolean rxKey;
- enum { KEY_RX_NO_KEY_RECEIVE, KEY_RX_KEY_RECEIVE } state;
-};
-
-
-/* Controlled Directions state machine */
-struct eapol_ctrl_dir {
+ /* Controlled Directions state machine */
+ enum { CTRL_DIR_FORCE_BOTH, CTRL_DIR_IN_OR_BOTH } ctrl_dir_state;
/* variables */
ControlledDirection adminControlledDirections;
ControlledDirection operControlledDirections;
Boolean operEdge;
- enum { CTRL_DIR_FORCE_BOTH, CTRL_DIR_IN_OR_BOTH } state;
-};
-
-
-struct eap_sm;
-
-struct radius_attr_data {
- u8 *data;
- size_t len;
-};
-
-struct radius_class_data {
- struct radius_attr_data *attr;
- size_t count;
-};
-
-struct eapol_state_machine {
- /* timers */
- int aWhile;
- int quietWhile;
- int reAuthWhen;
-
- /* global variables */
- Boolean authAbort;
- Boolean authFail;
- PortState authPortStatus;
- Boolean authStart;
- Boolean authTimeout;
- Boolean authSuccess;
- Boolean eapFail;
- Boolean eapolEap;
- Boolean eapSuccess;
- Boolean eapTimeout;
- Boolean initialize;
- Boolean keyAvailable;
- Boolean keyDone;
- Boolean keyRun;
- Boolean keyTxEnabled;
- PortTypes portControl;
- Boolean portEnabled;
- Boolean portValid;
- Boolean reAuthenticate;
-
- /* Port Timers state machine */
- /* 'Boolean tick' implicitly handled as registered timeout */
-
- struct eapol_auth_pae_sm auth_pae;
- struct eapol_backend_auth_sm be_auth;
- struct eapol_reauth_timer_sm reauth_timer;
- struct eapol_auth_key_tx auth_key_tx;
- struct eapol_key_rx key_rx;
- struct eapol_ctrl_dir ctrl_dir;
-
/* Authenticator Statistics Table */
Counter dot1xAuthEapolFramesRx;
Counter dot1xAuthEapolFramesTx;
@@ -185,6 +166,9 @@ struct eapol_state_machine {
size_t last_eap_radius_len;
u8 *identity;
size_t identity_len;
+ u8 eap_type_authsrv; /* EAP type of the last EAP packet from
+ * Authentication server */
+ u8 eap_type_supp; /* EAP type of the last EAP packet from Supplicant */
struct radius_class_data radius_class;
/* Keys for encrypting and signing EAPOL-Key frames */
@@ -205,6 +189,7 @@ struct eapol_state_machine {
u8 currentId;
Boolean initializing; /* in process of initializing state machines */
+ Boolean changed;
/* Somewhat nasty pointers to global hostapd and STA data to avoid
* passing these to every function */
@@ -213,12 +198,13 @@ struct eapol_state_machine {
};
-struct eapol_state_machine *eapol_sm_alloc(hostapd *hapd,
+struct eapol_state_machine *eapol_sm_alloc(struct hostapd_data *hapd,
struct sta_info *sta);
void eapol_sm_free(struct eapol_state_machine *sm);
void eapol_sm_step(struct eapol_state_machine *sm);
void eapol_sm_initialize(struct eapol_state_machine *sm);
void eapol_sm_dump_state(FILE *f, const char *prefix,
struct eapol_state_machine *sm);
+int eapol_sm_eap_pending_cb(struct eapol_state_machine *sm, void *ctx);
#endif /* EAPOL_SM_H */
OpenPOWER on IntegriCloud