From fbc3b4a104698658202c2a83217ca8722453bf49 Mon Sep 17 00:00:00 2001 From: Nahum Shalman Date: Fri, 1 Dec 2023 18:35:12 +0000 Subject: [PATCH] Revert "[eapol] Send EAPoL-Start packets to trigger EAP authentication" This reverts commit 8b14652e506d99499cfbeaed0df07d6a83ec029e. Conflicts: src/include/ipxe/eapol.h src/net/eapol.c --- src/include/ipxe/eapol.h | 13 ------- src/net/eapol.c | 81 ---------------------------------------- 2 files changed, 94 deletions(-) diff --git a/src/include/ipxe/eapol.h b/src/include/ipxe/eapol.h index dcf392946ea..f6009a2ff50 100644 --- a/src/include/ipxe/eapol.h +++ b/src/include/ipxe/eapol.h @@ -30,9 +30,6 @@ struct eapol_header { /** EAPoL-encapsulated EAP packets */ #define EAPOL_TYPE_EAP 0 -/** EAPoL start */ -#define EAPOL_TYPE_START 1 - /** EAPoL key */ #define EAPOL_TYPE_KEY 5 @@ -40,18 +37,8 @@ struct eapol_header { struct eapol_supplicant { /** EAP supplicant */ struct eap_supplicant eap; - /** EAPoL-Start retransmission timer */ - struct retry_timer timer; - /** EAPoL-Start transmission count */ - unsigned int count; }; -/** Delay between EAPoL-Start packets */ -#define EAPOL_START_INTERVAL ( 2 * TICKS_PER_SEC ) - -/** Maximum number of EAPoL-Start packets to transmit */ -#define EAPOL_START_COUNT 3 - /** An EAPoL handler */ struct eapol_handler { /** Type */ diff --git a/src/net/eapol.c b/src/net/eapol.c index 8b09ca231bb..172037ce1e7 100644 --- a/src/net/eapol.c +++ b/src/net/eapol.c @@ -31,7 +31,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); #include #include #include -#include #include #include @@ -155,21 +154,6 @@ static int eapol_eap_rx ( struct eapol_supplicant *supplicant, goto drop; } - /* Update EAPoL-Start transmission timer */ - if ( supplicant->eap.flags & EAP_FL_PASSIVE ) { - /* Stop sending EAPoL-Start */ - if ( timer_running ( &supplicant->timer ) ) { - DBGC ( netdev, "EAPOL %s becoming passive\n", - netdev->name ); - } - stop_timer ( &supplicant->timer ); - } else if ( supplicant->eap.flags & EAP_FL_ONGOING ) { - /* Delay EAPoL-Start until after next expected packet */ - DBGC ( netdev, "EAPOL %s deferring Start\n", netdev->name ); - start_timer_fixed ( &supplicant->timer, EAP_WAIT_TIMEOUT ); - supplicant->count = 0; - } - drop: free_iob ( iobuf ); return rc; @@ -240,31 +224,6 @@ static int eapol_eap_tx ( struct eap_supplicant *eap, const void *data, return eapol_tx ( supplicant, EAPOL_TYPE_EAP, data, len ); } -/** - * (Re)transmit EAPoL-Start packet - * - * @v timer EAPoL-Start timer - * @v expired Failure indicator - */ -static void eapol_expired ( struct retry_timer *timer, int fail __unused ) { - struct eapol_supplicant *supplicant = - container_of ( timer, struct eapol_supplicant, timer ); - struct net_device *netdev = supplicant->eap.netdev; - - /* Stop transmitting after maximum number of attempts */ - if ( supplicant->count++ >= EAPOL_START_COUNT ) { - DBGC ( netdev, "EAPOL %s giving up\n", netdev->name ); - return; - } - - /* Schedule next transmission */ - start_timer_fixed ( timer, EAPOL_START_INTERVAL ); - - /* Transmit EAPoL-Start, ignoring errors */ - DBGC2 ( netdev, "EAPOL %s transmitting Start\n", netdev->name ); - eapol_tx ( supplicant, EAPOL_TYPE_START, NULL, 0 ); -} - /** * Create EAPoL supplicant * @@ -285,53 +244,13 @@ static int eapol_probe ( struct net_device *netdev, void *priv ) { /* Initialise structure */ supplicant->eap.netdev = netdev; supplicant->eap.tx = eapol_eap_tx; - timer_init ( &supplicant->timer, eapol_expired, &netdev->refcnt ); return 0; } -/** - * Handle EAPoL supplicant state change - * - * @v netdev Network device - * @v priv Private data - */ -static void eapol_notify ( struct net_device *netdev, void *priv ) { - struct eapol_supplicant *supplicant = priv; - - /* Ignore non-EAPoL devices */ - if ( ! supplicant->eap.netdev ) - return; - - /* Terminate and reset EAP when link goes down */ - if ( ! ( netdev_is_open ( netdev ) && netdev_link_ok ( netdev ) ) ) { - if ( timer_running ( &supplicant->timer ) ) { - DBGC ( netdev, "EAPOL %s shutting down\n", - netdev->name ); - } - supplicant->eap.flags = 0; - stop_timer ( &supplicant->timer ); - return; - } - - /* Do nothing if EAP is already in progress */ - if ( timer_running ( &supplicant->timer ) ) - return; - - /* Do nothing if EAP has already finished transmitting */ - if ( supplicant->eap.flags & EAP_FL_PASSIVE ) - return; - - /* Otherwise, start sending EAPoL-Start */ - start_timer_nodelay ( &supplicant->timer ); - supplicant->count = 0; - DBGC ( netdev, "EAPOL %s starting up\n", netdev->name ); -} - /** EAPoL driver */ struct net_driver eapol_driver __net_driver = { .name = "EAPoL", .priv_len = sizeof ( struct eapol_supplicant ), .probe = eapol_probe, - .notify = eapol_notify, };