Quellcode durchsuchen

[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>
tags/v1.20.1
Michael Brown vor 9 Jahren
Ursprung
Commit
d73982f098
1 geänderte Dateien mit 9 neuen und 0 gelöschten Zeilen
  1. 9
    0
      src/net/udp/dhcp.c

+ 9
- 0
src/net/udp/dhcp.c Datei anzeigen

@@ -436,6 +436,15 @@ static void dhcp_discovery_rx ( struct dhcp_session *dhcp,
436 436
 static void dhcp_discovery_expired ( struct dhcp_session *dhcp ) {
437 437
 	unsigned long elapsed = ( currticks() - dhcp->start );
438 438
 
439
+	/* If link is blocked, defer DHCP discovery (and reset timeout) */
440
+	if ( netdev_link_blocked ( dhcp->netdev ) ) {
441
+		DBGC ( dhcp, "DHCP %p deferring discovery\n", dhcp );
442
+		start_timer_fixed ( &dhcp->timer,
443
+				    ( DHCP_DISC_START_TIMEOUT_SEC *
444
+				      TICKS_PER_SEC ) );
445
+		return;
446
+	}
447
+
439 448
 	/* Give up waiting for ProxyDHCP before we reach the failure point */
440 449
 	if ( dhcp->offer.s_addr &&
441 450
 	     ( elapsed > DHCP_DISC_PROXY_TIMEOUT_SEC * TICKS_PER_SEC ) ) {

Laden…
Abbrechen
Speichern