aboutsummaryrefslogtreecommitdiffstats
path: root/src/net
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2023-11-07 13:50:15 +0000
committerMichael Brown <mcb30@ipxe.org>2023-11-07 13:51:16 +0000
commit595b1796f6dc980cf27ca3883cde3baa23655528 (patch)
treee00ed7398c4bc85b412fbfeb21f42161b33123cb /src/net
parent1bd01b761f1f33723f0b07d277863b3284dfe232 (diff)
downloadipxe-595b1796f6dc980cf27ca3883cde3baa23655528.tar.gz
[eapol] Limit number of EAPoL-Start packets transmitted per attempt
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/net')
-rw-r--r--src/net/eapol.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/net/eapol.c b/src/net/eapol.c
index ce7be55d5..8b09ca231 100644
--- a/src/net/eapol.c
+++ b/src/net/eapol.c
@@ -167,6 +167,7 @@ static int eapol_eap_rx ( struct eapol_supplicant *supplicant,
/* 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:
@@ -250,6 +251,12 @@ static void eapol_expired ( struct retry_timer *timer, int fail __unused ) {
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 );
@@ -317,6 +324,7 @@ static void eapol_notify ( struct net_device *netdev, void *priv ) {
/* Otherwise, start sending EAPoL-Start */
start_timer_nodelay ( &supplicant->timer );
+ supplicant->count = 0;
DBGC ( netdev, "EAPOL %s starting up\n", netdev->name );
}