瀏覽代碼

[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 年之前
父節點
當前提交
eba6bb38f2
共有 1 個文件被更改,包括 5 次插入0 次删除
  1. 5
    0
      src/net/netdevice.c

+ 5
- 0
src/net/netdevice.c 查看文件

@@ -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…
取消
儲存