aboutsummaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2015-06-25 17:30:49 +0100
committerMichael Brown <mcb30@ipxe.org>2015-06-25 17:32:24 +0100
commitd73982f098db9fdedb28a3826eb97a6832eac1e4 (patch)
tree0888168a93e844a54731c3393760371e06649373 /src/net
parent94dbfb43746445e91e775c498db89392313934c7 (diff)
downloadipxe-d73982f098db9fdedb28a3826eb97a6832eac1e4.zip
ipxe-d73982f098db9fdedb28a3826eb97a6832eac1e4.tar.gz
ipxe-d73982f098db9fdedb28a3826eb97a6832eac1e4.tar.bz2
[dhcp] Defer discovery if link is blocked
If the link is blocked (e.g. due to a Spanning Tree Protocol port not yet forwarding packets) then defer DHCP discovery until the link becomes unblocked. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/net')
-rw-r--r--src/net/udp/dhcp.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/net/udp/dhcp.c b/src/net/udp/dhcp.c
index 8fe2774..61bef99 100644
--- a/src/net/udp/dhcp.c
+++ b/src/net/udp/dhcp.c
@@ -436,6 +436,15 @@ 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 ) ) {
+ DBGC ( dhcp, "DHCP %p deferring discovery\n", dhcp );
+ 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 ) ) {