Skip to content

Commit

Permalink
[dhcp] Reset start time when deferring discovery
Browse files Browse the repository at this point in the history
If we detect (via STP) that a switch port is in a non-forwarding
state, then the link is marked as being temporarily blocked and DHCP
discovery will be deferred until the link becomes unblocked.

The timer used to decide when to give up waiting for ProxyDHCPOFFERs
is currently based on the time that DHCP discovery was started, and
makes no allowances for any time spent waiting for the link to become
unblocked.  Consequently, if STP is used then the timeout for
ProxyDHCPOFFERs becomes essentially zero.

Fix by resetting the recorded start time whenever DHCP discovery is
deferred due to a blocked link.

Debugged-by: Sebastian Roth <sebastian.roth@zoho.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
mcb30 committed Oct 30, 2015
1 parent 6847232 commit 7cc7e0e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/net/udp/dhcp.c
Expand Up @@ -446,6 +446,7 @@ static void dhcp_discovery_expired ( struct dhcp_session *dhcp ) {
/* If link is blocked, defer DHCP discovery (and reset timeout) */
if ( netdev_link_blocked ( dhcp->netdev ) ) {
DBGC ( dhcp, "DHCP %p deferring discovery\n", dhcp );
dhcp->start = currticks();
start_timer_fixed ( &dhcp->timer,
( DHCP_DISC_START_TIMEOUT_SEC *
TICKS_PER_SEC ) );
Expand Down

0 comments on commit 7cc7e0e

Please sign in to comment.