[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 */
|
/** Shutdown flags for exit */
|
||||||
int shutdown_exit_flags = 0;
|
int shutdown_exit_flags = 0;
|
||||||
|
|
||||||
|
@ -153,10 +150,6 @@ static int netboot ( struct net_device *netdev ) {
|
||||||
return rc;
|
return rc;
|
||||||
ifstat ( netdev );
|
ifstat ( netdev );
|
||||||
|
|
||||||
/* Wait for link-up */
|
|
||||||
if ( ( rc = iflinkwait ( netdev, LINK_WAIT_MS ) ) != 0 )
|
|
||||||
return rc;
|
|
||||||
|
|
||||||
/* Configure device via DHCP */
|
/* Configure device via DHCP */
|
||||||
if ( ( rc = dhcp ( netdev ) ) != 0 )
|
if ( ( rc = dhcp ( netdev ) ) != 0 )
|
||||||
return rc;
|
return rc;
|
||||||
|
|
|
@ -28,6 +28,8 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
||||||
#include <usr/ifmgmt.h>
|
#include <usr/ifmgmt.h>
|
||||||
#include <usr/dhcpmgmt.h>
|
#include <usr/dhcpmgmt.h>
|
||||||
|
|
||||||
|
#define LINK_WAIT_MS 15000
|
||||||
|
|
||||||
/** @file
|
/** @file
|
||||||
*
|
*
|
||||||
* DHCP management
|
* DHCP management
|
||||||
|
@ -41,6 +43,10 @@ int dhcp ( struct net_device *netdev ) {
|
||||||
if ( ( rc = ifopen ( netdev ) ) != 0 )
|
if ( ( rc = ifopen ( netdev ) ) != 0 )
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
/* Wait for link-up */
|
||||||
|
if ( ( rc = iflinkwait ( netdev, LINK_WAIT_MS ) ) != 0 )
|
||||||
|
return rc;
|
||||||
|
|
||||||
/* Perform DHCP */
|
/* Perform DHCP */
|
||||||
printf ( "DHCP (%s %s)", netdev->name, netdev_hwaddr ( netdev ) );
|
printf ( "DHCP (%s %s)", netdev->name, netdev_hwaddr ( netdev ) );
|
||||||
if ( ( rc = start_dhcp ( &monojob, netdev ) ) == 0 )
|
if ( ( rc = start_dhcp ( &monojob, netdev ) ) == 0 )
|
||||||
|
|
Reference in New Issue