Skip to content

Commit

Permalink
[cmdline] Accept "netX" in iPXE commands
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
mcb30 committed Jul 13, 2013
1 parent 66ea458 commit eba6bb3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/net/netdevice.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit eba6bb3

Please sign in to comment.