Updated: April 19, 2023 |
Map an interface name to its index
#include <net/if.h> unsigned int if_nametoindex( const char * ifname );
The if_nametoindex() function maps the interface name specified by ifname to its corresponding index.
The index number of the interface, or 0 if the specified interface couldn't be found or an error occurred while using getifaddrs() to retrieve the list of interfaces.
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | No |
Thread | Yes |