[ipxe-devel] 'brief' network device list

Michael Brown mbrown at fensystems.co.uk
Fri Apr 8 19:09:02 UTC 2011

On Friday 08 Apr 2011 19:17:29 Greg Jednaszewski wrote:
> I'm working on building an interactive boot ISO using iPXE, and I'd like to
>  be able to prompt the user for the interface to configure (either
>  statically or via DHCP).  I want to print out a simple list showing just
>  the device name, MAC, and whether the link is up/down, like this:
> Devices present:
>  net0:  00:00:00:00:00:00    Link Up
>  net1:  11:11:11:11:11:11    Link Down
> This information is available with 'ifstat', but that is kind of verbose
>  for a user to look at, especially if there are many NICs in the system. If
>  I implement this kind of brief listing, is it preferable to make it an
>  option to ifstat (e.g. "ifstat -b"), or a new separate command?

I would suggest adding an option to ifstat() in usr/ifmgmt.c that allows you 
to omit everything after the underlying PCI device name (netdev->dev->name).  
This would give you output such as:

  net0: 52:54:00:12:34:56 using rtl8139 on PCI00:03.0
  net1: 00:02:c9:0d:13:cc using mt26428 on PCI00:07.0

which includes only the information that is potentially useful in terms of 
helping the user to identify the device.  Doing this would have a minimal 
code-size impact compared to adding a new command.

Including the link up/down state is almost certainly going to be misleading, 
because many drivers won't accurately report link state while the device is 
closed, and you can't viably open many devices at once since you'll rapidly 
start running out of I/O buffer memory.


More information about the ipxe-devel mailing list