mirror of
https://github.com/ipxe/ipxe
synced 2025-12-27 18:12:36 +03:00
[netdevice] Kill off the various guess_boot_netdev() functions
Remove the assortment of miscellaneous hacks to guess the "network boot device", and replace them each with a call to last_opened_netdev(). It still isn't guaranteed correct, but it won't be any worse than before, and it will at least be consistent.
This commit is contained in:
@@ -366,23 +366,6 @@ static int nbi_boot32 ( struct image *image, struct imgheader *imgheader ) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Guess boot network device
|
||||
*
|
||||
* @ret netdev Boot network device
|
||||
*/
|
||||
static struct net_device * guess_boot_netdev ( void ) {
|
||||
struct net_device *netdev;
|
||||
|
||||
/* Just use the first network device */
|
||||
for_each_netdev ( netdev ) {
|
||||
if ( netdev->state & NETDEV_OPEN )
|
||||
return netdev;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare DHCP parameter block for NBI image
|
||||
*
|
||||
@@ -393,7 +376,7 @@ static int nbi_prepare_dhcp ( struct image *image ) {
|
||||
struct net_device *boot_netdev;
|
||||
int rc;
|
||||
|
||||
boot_netdev = guess_boot_netdev();
|
||||
boot_netdev = last_opened_netdev();
|
||||
if ( ! boot_netdev ) {
|
||||
DBGC ( image, "NBI %p could not identify a network device\n",
|
||||
image );
|
||||
|
||||
@@ -42,20 +42,14 @@ struct image_type pxe_image_type __image_type ( PROBE_PXE );
|
||||
* @ret rc Return status code
|
||||
*/
|
||||
static int pxe_exec ( struct image *image ) {
|
||||
struct net_device *netdev;
|
||||
int rc;
|
||||
|
||||
/* Ensure that PXE stack is ready to use */
|
||||
pxe_init_structures();
|
||||
pxe_hook_int1a();
|
||||
|
||||
/* Arbitrarily pick the first open network device to use for PXE */
|
||||
for_each_netdev ( netdev ) {
|
||||
if ( netdev->state & NETDEV_OPEN ) {
|
||||
pxe_set_netdev ( netdev );
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* Arbitrarily pick the most recently opened network device */
|
||||
pxe_set_netdev ( last_opened_netdev() );
|
||||
|
||||
/* Many things will break if pxe_netdev is NULL */
|
||||
if ( ! pxe_netdev ) {
|
||||
|
||||
Reference in New Issue
Block a user