|
@@ -25,39 +25,15 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
25
|
25
|
#include <ipxe/netdevice.h>
|
26
|
26
|
#include <ipxe/dhcp.h>
|
27
|
27
|
#include <ipxe/monojob.h>
|
28
|
|
-#include <ipxe/timer.h>
|
29
|
28
|
#include <usr/ifmgmt.h>
|
30
|
29
|
#include <usr/dhcpmgmt.h>
|
31
|
30
|
|
32
|
|
-/** Default time to wait for link-up */
|
33
|
|
-#define LINK_WAIT_TIMEOUT ( 15 * TICKS_PER_SEC )
|
34
|
|
-
|
35
|
31
|
/** @file
|
36
|
32
|
*
|
37
|
33
|
* DHCP management
|
38
|
34
|
*
|
39
|
35
|
*/
|
40
|
36
|
|
41
|
|
-int dhcp ( struct net_device *netdev ) {
|
42
|
|
- int rc;
|
43
|
|
-
|
44
|
|
- /* Check we can open the interface first */
|
45
|
|
- if ( ( rc = ifopen ( netdev ) ) != 0 )
|
46
|
|
- return rc;
|
47
|
|
-
|
48
|
|
- /* Wait for link-up */
|
49
|
|
- if ( ( rc = iflinkwait ( netdev, LINK_WAIT_TIMEOUT ) ) != 0 )
|
50
|
|
- return rc;
|
51
|
|
-
|
52
|
|
- /* Perform DHCP */
|
53
|
|
- printf ( "DHCP (%s %s)", netdev->name,
|
54
|
|
- netdev->ll_protocol->ntoa ( netdev->ll_addr ) );
|
55
|
|
- if ( ( rc = start_dhcp ( &monojob, netdev ) ) == 0 )
|
56
|
|
- rc = monojob_wait ( "", 0 );
|
57
|
|
-
|
58
|
|
- return rc;
|
59
|
|
-}
|
60
|
|
-
|
61
|
37
|
int pxebs ( struct net_device *netdev, unsigned int pxe_type ) {
|
62
|
38
|
int rc;
|
63
|
39
|
|