aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2021-01-19 12:21:28 +0000
committerMichael Brown <mcb30@ipxe.org>2021-01-19 12:21:28 +0000
commit860620459589444fd3c7c329aa7b177b5c9a4039 (patch)
tree0d2a983eec606975c74fd51d9d3d076427cf493f
parent0fb37a48a9405a6b3b0c5b198bdd87f1a4bb51f0 (diff)
downloadipxe-860620459589444fd3c7c329aa7b177b5c9a4039.zip
ipxe-860620459589444fd3c7c329aa7b177b5c9a4039.tar.gz
ipxe-860620459589444fd3c7c329aa7b177b5c9a4039.tar.bz2
[dhcp] Continue transmitting DHCPDISCOVER while link is blocked
Continue to transmit DHCPDISCOVER while waiting for a blocked link, in order to support mechanisms such as Cisco MAC Authentication Bypass that require repeated transmission attempts in order to trigger the action that will result in the link becoming unblocked. Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r--src/net/udp/dhcp.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/net/udp/dhcp.c b/src/net/udp/dhcp.c
index 3a3666c..4ebd38b 100644
--- a/src/net/udp/dhcp.c
+++ b/src/net/udp/dhcp.c
@@ -451,17 +451,6 @@ static void dhcp_discovery_rx ( struct dhcp_session *dhcp,
static void dhcp_discovery_expired ( struct dhcp_session *dhcp ) {
unsigned long elapsed = ( currticks() - dhcp->start );
- /* If link is blocked, defer DHCP discovery (and reset timeout) */
- if ( netdev_link_blocked ( dhcp->netdev ) &&
- ( dhcp->count <= DHCP_DISC_MAX_DEFERRALS ) ) {
- DBGC ( dhcp, "DHCP %p deferring discovery\n", dhcp );
- dhcp->start = currticks();
- start_timer_fixed ( &dhcp->timer,
- ( DHCP_DISC_START_TIMEOUT_SEC *
- TICKS_PER_SEC ) );
- return;
- }
-
/* Give up waiting for ProxyDHCP before we reach the failure point */
if ( dhcp->offer.s_addr &&
( elapsed > DHCP_DISC_PROXY_TIMEOUT_SEC * TICKS_PER_SEC ) ) {
@@ -469,8 +458,18 @@ static void dhcp_discovery_expired ( struct dhcp_session *dhcp ) {
return;
}
- /* Otherwise, retransmit current packet */
+ /* Retransmit current packet */
dhcp_tx ( dhcp );
+
+ /* If link is blocked, defer DHCP discovery timeout */
+ if ( netdev_link_blocked ( dhcp->netdev ) &&
+ ( dhcp->count <= DHCP_DISC_MAX_DEFERRALS ) ) {
+ DBGC ( dhcp, "DHCP %p deferring discovery timeout\n", dhcp );
+ dhcp->start = currticks();
+ start_timer_fixed ( &dhcp->timer,
+ ( DHCP_DISC_START_TIMEOUT_SEC *
+ TICKS_PER_SEC ) );
+ }
}
/** DHCP discovery state operations */