mirror of
https://github.com/xcat2/xNBA.git
synced 2024-12-04 02:24:35 +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:
parent
4125216a2f
commit
6254998327
@ -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;
|
||||
|
@ -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 )
|
||||
|
Loading…
Reference in New Issue
Block a user