mirror of
https://github.com/xcat2/xNBA.git
synced 2024-11-26 19:29:04 +00: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:
parent
0a6c66a830
commit
467c4f77c3
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user