mirror of
https://github.com/ipxe/ipxe
synced 2025-12-22 13:00:39 +03:00
[hacks] Improve the guess_boot_netdev() logic
This function is a major kludge, but can be made slightly more accurate by ignoring net devices that aren't open. Eventually it needs to be removed entirely.
This commit is contained in:
@@ -372,11 +372,12 @@ static int nbi_boot32 ( struct image *image, struct imgheader *imgheader ) {
|
|||||||
* @ret netdev Boot network device
|
* @ret netdev Boot network device
|
||||||
*/
|
*/
|
||||||
static struct net_device * guess_boot_netdev ( void ) {
|
static struct net_device * guess_boot_netdev ( void ) {
|
||||||
struct net_device *boot_netdev;
|
struct net_device *netdev;
|
||||||
|
|
||||||
/* Just use the first network device */
|
/* Just use the first network device */
|
||||||
for_each_netdev ( boot_netdev ) {
|
for_each_netdev ( netdev ) {
|
||||||
return boot_netdev;
|
if ( netdev->state & NETDEV_OPEN )
|
||||||
|
return netdev;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@@ -16,11 +16,12 @@
|
|||||||
* @ret netdev Boot network device
|
* @ret netdev Boot network device
|
||||||
*/
|
*/
|
||||||
static struct net_device * guess_boot_netdev ( void ) {
|
static struct net_device * guess_boot_netdev ( void ) {
|
||||||
struct net_device *boot_netdev;
|
struct net_device *netdev;
|
||||||
|
|
||||||
/* Just use the first network device */
|
/* Just use the first network device */
|
||||||
for_each_netdev ( boot_netdev ) {
|
for_each_netdev ( netdev ) {
|
||||||
return boot_netdev;
|
if ( netdev->state & NETDEV_OPEN )
|
||||||
|
return netdev;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@@ -26,11 +26,12 @@ struct setting keep_san_setting __setting = {
|
|||||||
* @ret netdev Boot network device
|
* @ret netdev Boot network device
|
||||||
*/
|
*/
|
||||||
static struct net_device * guess_boot_netdev ( void ) {
|
static struct net_device * guess_boot_netdev ( void ) {
|
||||||
struct net_device *boot_netdev;
|
struct net_device *netdev;
|
||||||
|
|
||||||
/* Just use the first network device */
|
/* Just use the first network device */
|
||||||
for_each_netdev ( boot_netdev ) {
|
for_each_netdev ( netdev ) {
|
||||||
return boot_netdev;
|
if ( netdev->state & NETDEV_OPEN )
|
||||||
|
return netdev;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user