Maps an interface index into its corresponding name.
Standard C Library <libc.a>
#include <net/if.h>
char *if_indextoname(unsigned int ifindex, char *ifname);
If ifindex is an interface index, the if_indextoname Subroutine returns the ifname value, which points to a buffer containing the interface name. Otherwise, it returns a NULL pointer and sets the errno global value to indicate the error.
If there is no interface corresponding to the specified index, the errno global value is set to ENXIO. If a system error occurs (such as insufficient memory), the errno global value is set to the proper value (such as, ENOMEM).
Item | Description |
---|---|
ifindex | Possible interface index |
ifname | Possible name of an interface |
Item | Description |
---|---|
ENXIO | There is no interface corresponding to the specified index |
ENOMEM | Insufficient memory |