12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
-
-
- FILE_LICENCE ( GPL2_OR_LATER );
-
- #include <string.h>
- #include <stdio.h>
- #include <errno.h>
- #include <ipxe/netdevice.h>
- #include <ipxe/dhcp.h>
- #include <ipxe/monojob.h>
- #include <ipxe/process.h>
- #include <usr/ifmgmt.h>
- #include <usr/dhcpmgmt.h>
-
- #define LINK_WAIT_MS 15000
-
-
-
- int dhcp ( struct net_device *netdev ) {
- int rc;
-
-
- if ( ( rc = ifopen ( netdev ) ) != 0 )
- return rc;
-
-
- if ( ( rc = iflinkwait ( netdev, LINK_WAIT_MS ) ) != 0 )
- return rc;
-
-
- printf ( "DHCP (%s %s)", netdev->name,
- netdev->ll_protocol->ntoa ( netdev->ll_addr ) );
- if ( ( rc = start_dhcp ( &monojob, netdev ) ) == 0 ) {
- rc = monojob_wait ( "" );
- } else if ( rc > 0 ) {
- printf ( " using cached\n" );
- rc = 0;
- }
-
- return rc;
- }
-
- int pxebs ( struct net_device *netdev, unsigned int pxe_type ) {
- int rc;
-
-
- printf ( "PXEBS (%s type %d)", netdev->name, pxe_type );
- if ( ( rc = start_pxebs ( &monojob, netdev, pxe_type ) ) == 0 )
- rc = monojob_wait ( "" );
-
- return rc;
- }
|