mirror of https://github.com/ipxe/ipxe.git
[eapol] Limit number of EAPoL-Start packets transmitted per attempt
Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/1073/head
parent
1bd01b761f
commit
595b1796f6
|
@ -42,11 +42,16 @@ struct eapol_supplicant {
|
||||||
struct eap_supplicant eap;
|
struct eap_supplicant eap;
|
||||||
/** EAPoL-Start retransmission timer */
|
/** EAPoL-Start retransmission timer */
|
||||||
struct retry_timer timer;
|
struct retry_timer timer;
|
||||||
|
/** EAPoL-Start transmission count */
|
||||||
|
unsigned int count;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Delay between EAPoL-Start packets */
|
/** Delay between EAPoL-Start packets */
|
||||||
#define EAPOL_START_INTERVAL ( 2 * TICKS_PER_SEC )
|
#define EAPOL_START_INTERVAL ( 2 * TICKS_PER_SEC )
|
||||||
|
|
||||||
|
/** Maximum number of EAPoL-Start packets to transmit */
|
||||||
|
#define EAPOL_START_COUNT 3
|
||||||
|
|
||||||
/** An EAPoL handler */
|
/** An EAPoL handler */
|
||||||
struct eapol_handler {
|
struct eapol_handler {
|
||||||
/** Type */
|
/** Type */
|
||||||
|
|
|
@ -167,6 +167,7 @@ static int eapol_eap_rx ( struct eapol_supplicant *supplicant,
|
||||||
/* Delay EAPoL-Start until after next expected packet */
|
/* Delay EAPoL-Start until after next expected packet */
|
||||||
DBGC ( netdev, "EAPOL %s deferring Start\n", netdev->name );
|
DBGC ( netdev, "EAPOL %s deferring Start\n", netdev->name );
|
||||||
start_timer_fixed ( &supplicant->timer, EAP_WAIT_TIMEOUT );
|
start_timer_fixed ( &supplicant->timer, EAP_WAIT_TIMEOUT );
|
||||||
|
supplicant->count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
drop:
|
drop:
|
||||||
|
@ -250,6 +251,12 @@ static void eapol_expired ( struct retry_timer *timer, int fail __unused ) {
|
||||||
container_of ( timer, struct eapol_supplicant, timer );
|
container_of ( timer, struct eapol_supplicant, timer );
|
||||||
struct net_device *netdev = supplicant->eap.netdev;
|
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 */
|
/* Schedule next transmission */
|
||||||
start_timer_fixed ( timer, EAPOL_START_INTERVAL );
|
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 */
|
/* Otherwise, start sending EAPoL-Start */
|
||||||
start_timer_nodelay ( &supplicant->timer );
|
start_timer_nodelay ( &supplicant->timer );
|
||||||
|
supplicant->count = 0;
|
||||||
DBGC ( netdev, "EAPOL %s starting up\n", netdev->name );
|
DBGC ( netdev, "EAPOL %s starting up\n", netdev->name );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue