libnetdevname - userspace library for mapping kernel name of a network interface to it's firmware provided alias and vice versa (c) 2009 Dell Inc. by Narendra K ================================================================================ What is libnetdevname? Libnetdevname is a library that provides an API to map the kernel name (ethN names) of a network interface device to it's firmware provided alias name and vice versa. For ex: cat /sys/class/net/eth1/device/label Embedded NIC 1 Given ethN, the library would provide "Embedded NIC N" and given "Embedded NIC N", library would provide the corresponding "ethN" name. The library achieves this by looking up the sysfs for the above mentioned path and performs Why libnetdevname? This is aimed at solving the NIC enumeration issue where add-in NICs get enumerated before LOMs which creates issues. For details, go to: http://linux.dell.com/wiki/index.php/Oss/libnetdevname Requirements for libnetdevname 1. You will require to patch the Linux kernel for it to create the sysfs attribute file "label" at the path /sys/class/net/ethN/device/label http://marc.info/?l=linux-netdev&m=128014182019492&w=2 How can I use libnetdevname in my application? Userspace utilities that traditionally use ethN names, can be patched to resolve the alias names to the device names by issuing a call to this library like this: char *alias; char ifname[IFNAMSIZ]; if (!netdev_alias_to_kernelname(alias, ifname)) printf("alias -> %s kernel name -> %s". alias, kernelname); where * char *alias -> is a pointer to the firmware provided alias names such as "Embedded NIC N" * char *kenelname -> is a pointer to a place holder which contains the corresponding "ethN" name of the interface, returned by the library which can be used for further transactions such as ioctls Example usage of ifconfig # /sbin/ifconfig Embedded NIC 1 # /usr/sbin/ethtool -p Embedded NIC 2