Skip to content

Commit eba6bb3

Browse files
committed
[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>
1 parent 66ea458 commit eba6bb3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/net/netdevice.c

+5
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,11 @@ void netdev_irq ( struct net_device *netdev, int enable ) {
670670
struct net_device * find_netdev ( const char *name ) {
671671
struct net_device *netdev;
672672

673+
/* Allow "netX" shortcut */
674+
if ( strcmp ( name, "netX" ) == 0 )
675+
return last_opened_netdev();
676+
677+
/* Identify network device by name */
673678
list_for_each_entry ( netdev, &net_devices, list ) {
674679
if ( strcmp ( netdev->name, name ) == 0 )
675680
return netdev;

0 commit comments

Comments
 (0)