Browse Source

[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>
tags/v1.20.1
Michael Brown 11 years ago
parent
commit
eba6bb38f2
1 changed files with 5 additions and 0 deletions
  1. 5
    0
      src/net/netdevice.c

+ 5
- 0
src/net/netdevice.c View File

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

Loading…
Cancel
Save