Skip to content

Commit

Permalink
[dhcp] Defer discovery if link is blocked
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
mcb30 committed Jun 25, 2015
1 parent 94dbfb4 commit d73982f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/net/udp/dhcp.c
Expand Up @@ -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 ) ) {
Expand Down

0 comments on commit d73982f

Please sign in to comment.