2
0
mirror of https://github.com/xcat2/xNBA.git synced 2024-12-12 14:26:34 +00:00

[dhcp] Await link-up before starting DHCP

Modified-by: Michael Brown <mcb30@etherboot.org>
Signed-off-by: Michael Brown <mcb30@etherboot.org>
This commit is contained in:
Joshua Oreman 2009-06-20 01:52:41 -07:00 committed by Michael Brown
parent 4125216a2f
commit 6254998327
2 changed files with 6 additions and 7 deletions

View File

@ -39,9 +39,6 @@ FILE_LICENCE ( GPL2_OR_LATER );
*
*/
/** Time to wait for link-up */
#define LINK_WAIT_MS 15000
/** Shutdown flags for exit */
int shutdown_exit_flags = 0;
@ -153,10 +150,6 @@ static int netboot ( struct net_device *netdev ) {
return rc;
ifstat ( netdev );
/* Wait for link-up */
if ( ( rc = iflinkwait ( netdev, LINK_WAIT_MS ) ) != 0 )
return rc;
/* Configure device via DHCP */
if ( ( rc = dhcp ( netdev ) ) != 0 )
return rc;

View File

@ -28,6 +28,8 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <usr/ifmgmt.h>
#include <usr/dhcpmgmt.h>
#define LINK_WAIT_MS 15000
/** @file
*
* DHCP management
@ -41,6 +43,10 @@ int dhcp ( struct net_device *netdev ) {
if ( ( rc = ifopen ( netdev ) ) != 0 )
return rc;
/* Wait for link-up */
if ( ( rc = iflinkwait ( netdev, LINK_WAIT_MS ) ) != 0 )
return rc;
/* Perform DHCP */
printf ( "DHCP (%s %s)", netdev->name, netdev_hwaddr ( netdev ) );
if ( ( rc = start_dhcp ( &monojob, netdev ) ) == 0 )