david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

[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:
Michael Brown 2008-10-31 01:51:26 +00:00
parent 0a6c66a830
commit 467c4f77c3
3 changed files with 12 additions and 9 deletions

View File

@ -372,11 +372,12 @@ static int nbi_boot32 ( struct image *image, struct imgheader *imgheader ) {
* @ret netdev Boot network device
*/
static struct net_device * guess_boot_netdev ( void ) {
struct net_device *boot_netdev;
struct net_device *netdev;
/* Just use the first network device */
for_each_netdev ( boot_netdev ) {
return boot_netdev;
for_each_netdev ( netdev ) {
if ( netdev->state & NETDEV_OPEN )
return netdev;
}
return NULL;

View File

@ -16,11 +16,12 @@
* @ret netdev Boot network device
*/
static struct net_device * guess_boot_netdev ( void ) {
struct net_device *boot_netdev;
struct net_device *netdev;
/* Just use the first network device */
for_each_netdev ( boot_netdev ) {
return boot_netdev;
for_each_netdev ( netdev ) {
if ( netdev->state & NETDEV_OPEN )
return netdev;
}
return NULL;

View File

@ -26,11 +26,12 @@ struct setting keep_san_setting __setting = {
* @ret netdev Boot network device
*/
static struct net_device * guess_boot_netdev ( void ) {
struct net_device *boot_netdev;
struct net_device *netdev;
/* Just use the first network device */
for_each_netdev ( boot_netdev ) {
return boot_netdev;
for_each_netdev ( netdev ) {
if ( netdev->state & NETDEV_OPEN )
return netdev;
}
return NULL;