]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[cmdline] Accept "netX" in iPXE commands
authorMichael Brown <mcb30@ipxe.org>
Sat, 13 Jul 2013 13:22:34 +0000 (15:22 +0200)
committerMichael Brown <mcb30@ipxe.org>
Sat, 13 Jul 2013 13:22:34 +0000 (15:22 +0200)
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>
src/net/netdevice.c

index 1191ebc190bea70d256b0028c0af03e47e7824c5..5af9c6dc8b6d297a4b791a15174208e53f4074d9 100644 (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;