Selaa lähdekoodia

[dhcp] Await link-up before starting DHCP

Modified-by: Michael Brown <mcb30@etherboot.org>
Signed-off-by: Michael Brown <mcb30@etherboot.org>
tags/v0.9.8
Joshua Oreman 15 vuotta sitten
vanhempi
commit
6254998327
2 muutettua tiedostoa jossa 6 lisäystä ja 7 poistoa
  1. 0
    7
      src/usr/autoboot.c
  2. 6
    0
      src/usr/dhcpmgmt.c

+ 0
- 7
src/usr/autoboot.c Näytä tiedosto

@@ -39,9 +39,6 @@ FILE_LICENCE ( GPL2_OR_LATER );
39 39
  *
40 40
  */
41 41
 
42
-/** Time to wait for link-up */
43
-#define LINK_WAIT_MS 15000
44
-
45 42
 /** Shutdown flags for exit */
46 43
 int shutdown_exit_flags = 0;
47 44
 
@@ -153,10 +150,6 @@ static int netboot ( struct net_device *netdev ) {
153 150
 		return rc;
154 151
 	ifstat ( netdev );
155 152
 
156
-	/* Wait for link-up */
157
-	if ( ( rc = iflinkwait ( netdev, LINK_WAIT_MS ) ) != 0 )
158
-		return rc;
159
-
160 153
 	/* Configure device via DHCP */
161 154
 	if ( ( rc = dhcp ( netdev ) ) != 0 )
162 155
 		return rc;

+ 6
- 0
src/usr/dhcpmgmt.c Näytä tiedosto

@@ -28,6 +28,8 @@ FILE_LICENCE ( GPL2_OR_LATER );
28 28
 #include <usr/ifmgmt.h>
29 29
 #include <usr/dhcpmgmt.h>
30 30
 
31
+#define LINK_WAIT_MS	15000
32
+
31 33
 /** @file
32 34
  *
33 35
  * DHCP management
@@ -41,6 +43,10 @@ int dhcp ( struct net_device *netdev ) {
41 43
 	if ( ( rc = ifopen ( netdev ) ) != 0 )
42 44
 		return rc;
43 45
 
46
+	/* Wait for link-up */
47
+	if ( ( rc = iflinkwait ( netdev, LINK_WAIT_MS ) ) != 0 )
48
+		return rc;
49
+
44 50
 	/* Perform DHCP */
45 51
 	printf ( "DHCP (%s %s)", netdev->name, netdev_hwaddr ( netdev ) );
46 52
 	if ( ( rc = start_dhcp ( &monojob, netdev ) ) == 0 )

Loading…
Peruuta
Tallenna