david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

[cmdline] Accept "netX" in iPXE commands

Allow any iPXE command expecting a network device name to accept
"netX" as a synonym for "most recently opened network device".

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown 2013-07-13 15:22:34 +02:00
parent 66ea458125
commit eba6bb38f2
1 changed files with 5 additions and 0 deletions

View File

@ -670,6 +670,11 @@ void netdev_irq ( struct net_device *netdev, int enable ) {
struct net_device * find_netdev ( const char *name ) {
struct net_device *netdev;
/* Allow "netX" shortcut */
if ( strcmp ( name, "netX" ) == 0 )
return last_opened_netdev();
/* Identify network device by name */
list_for_each_entry ( netdev, &net_devices, list ) {
if ( strcmp ( netdev->name, name ) == 0 )
return netdev;