diff options
author | Michael Brown | 2008-10-31 02:51:26 +0100 |
---|---|---|
committer | Michael Brown | 2008-10-31 02:51:26 +0100 |
commit | 467c4f77c369da937f9f7f799fc905fba166d94c (patch) | |
tree | c9beae06ffb5ec9839f48857bcdfc53ee7347eae | |
parent | [settings] Add the notion of a "tag magic" to numbered settings (diff) | |
download | ipxe-467c4f77c369da937f9f7f799fc905fba166d94c.tar.gz ipxe-467c4f77c369da937f9f7f799fc905fba166d94c.tar.xz ipxe-467c4f77c369da937f9f7f799fc905fba166d94c.zip |
[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.
-rw-r--r-- | src/arch/i386/image/nbi.c | 7 | ||||
-rw-r--r-- | src/usr/aoeboot.c | 7 | ||||
-rw-r--r-- | src/usr/iscsiboot.c | 7 |
3 files changed, 12 insertions, 9 deletions
diff --git a/src/arch/i386/image/nbi.c b/src/arch/i386/image/nbi.c index e6a0ab0f..ea8375cb 100644 --- a/src/arch/i386/image/nbi.c +++ b/src/arch/i386/image/nbi.c @@ -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; diff --git a/src/usr/aoeboot.c b/src/usr/aoeboot.c index 08d21c4e..e977b10f 100644 --- a/src/usr/aoeboot.c +++ b/src/usr/aoeboot.c @@ -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; diff --git a/src/usr/iscsiboot.c b/src/usr/iscsiboot.c index e0098fd2..cdf7790b 100644 --- a/src/usr/iscsiboot.c +++ b/src/usr/iscsiboot.c @@ -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; |