From: Michael Brown Date: Sat, 13 Jul 2013 13:22:34 +0000 (+0200) Subject: [cmdline] Accept "netX" in iPXE commands X-Git-Tag: v1.20.1~1486 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=eba6bb38f2d6642efcb20d43e8b4c6c20406dd32;p=thirdparty%2Fipxe.git [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 --- diff --git a/src/net/netdevice.c b/src/net/netdevice.c index 1191ebc19..5af9c6dc8 100644 --- a/src/net/netdevice.c +++ b/src/net/netdevice.c @@ -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;