[eap] Define a supplicant model for EAP and EAPoL

Extend the EAP model to include a record of whether or not EAP
authentication has completed (successfully or otherwise), and to
provide a method for transmitting EAP responses.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2023-09-15 16:10:07 +01:00
parent cac3a584dc
commit 56cc61a168
5 changed files with 184 additions and 27 deletions

View File

@@ -64,6 +64,25 @@ union eap_packet {
*/
#define EAP_BLOCK_TIMEOUT ( 45 * TICKS_PER_SEC )
extern int eap_rx ( struct net_device *netdev, const void *data, size_t len );
/** An EAP supplicant */
struct eap_supplicant {
/** Network device */
struct net_device *netdev;
/** Authentication outcome is final */
int done;
/**
* Transmit EAP response
*
* @v supplicant EAP supplicant
* @v data Response data
* @v len Length of response data
* @ret rc Return status code
*/
int ( * tx ) ( struct eap_supplicant *supplicant,
const void *data, size_t len );
};
extern int eap_rx ( struct eap_supplicant *supplicant,
const void *data, size_t len );
#endif /* _IPXE_EAP_H */

View File

@@ -12,6 +12,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdint.h>
#include <ipxe/netdevice.h>
#include <ipxe/tables.h>
#include <ipxe/eap.h>
/** EAPoL header */
struct eapol_header {
@@ -32,6 +33,12 @@ struct eapol_header {
/** EAPoL key */
#define EAPOL_TYPE_KEY 5
/** An EAPoL supplicant */
struct eapol_supplicant {
/** EAP supplicant */
struct eap_supplicant eap;
};
/** An EAPoL handler */
struct eapol_handler {
/** Type */
@@ -39,15 +46,15 @@ struct eapol_handler {
/**
* Process received packet
*
* @v supplicant EAPoL supplicant
* @v iobuf I/O buffer
* @v netdev Network device
* @v ll_source Link-layer source address
* @ret rc Return status code
*
* This method takes ownership of the I/O buffer.
*/
int ( * rx ) ( struct io_buffer *iobuf, struct net_device *netdev,
const void *ll_source );
int ( * rx ) ( struct eapol_supplicant *supplicant,
struct io_buffer *iobuf, const void *ll_source );
};
/** EAPoL handler table */