Maps an interface name to its corresponding index.
Format
#include <if.h>
unsigned int if_nametoindex ( const char *ifname );
1 – Arguments
ifname
Points to a buffer that contains the interface name.
2 – Description
This function maps an interface name to its corresponding
interface index number.
3 – Return Values
0 (zero) Interface does not exist.
x Upon successful conversion, the if_
nametoindex() function returns an interface
index number.