diff options
author | Joshua Oreman | 2009-06-20 10:52:41 +0200 |
---|---|---|
committer | Michael Brown | 2009-06-24 14:18:31 +0200 |
commit | 62549983274af297c65fed369d9f5a2ea795cd99 (patch) | |
tree | d40c73fe349171019db7bfd952805feaaa3c991c /src/usr/dhcpmgmt.c | |
parent | [ifmgmt] Move link-up status messages from autoboot() to iflinkwait() (diff) | |
download | ipxe-62549983274af297c65fed369d9f5a2ea795cd99.tar.gz ipxe-62549983274af297c65fed369d9f5a2ea795cd99.tar.xz ipxe-62549983274af297c65fed369d9f5a2ea795cd99.zip |
[dhcp] Await link-up before starting DHCP
Modified-by: Michael Brown <mcb30@etherboot.org>
Signed-off-by: Michael Brown <mcb30@etherboot.org>
Diffstat (limited to 'src/usr/dhcpmgmt.c')
-rw-r--r-- | src/usr/dhcpmgmt.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/usr/dhcpmgmt.c b/src/usr/dhcpmgmt.c index a0ac4c30..c1cc36ef 100644 --- a/src/usr/dhcpmgmt.c +++ b/src/usr/dhcpmgmt.c @@ -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 ) |