if_nametoindex(3) Library Functions Manual if_nametoindex(3) if_nametoindex, if_indextoname - C (libc, -lc) #include unsigned int if_nametoindex(const char *ifname); char *if_indextoname(unsigned int ifindex, char *ifname); if_nametoindex() , ifname. if_indextoname() , ifindex. , ifname. IF_NAMESIZE . On success, if_nametoindex() returns the index number of the network interface; on error, 0 is returned and errno is set to indicate the error. On success, if_indextoname() returns ifname; on error, NULL is returned and errno is set to indicate the error. if_nametoindex() errno : ENODEV . if_indextoname() errno : ENXIO . if_nametoindex() if_indextoname() , socket(2) ioctl(2). attributes(7). +----------------------------+----------------------------------------------------------+--------------------------+ | | | | +----------------------------+----------------------------------------------------------+--------------------------+ |if_nametoindex(), | | MT-Safe | |if_indextoname() | | | +----------------------------+----------------------------------------------------------+--------------------------+ POSIX.1-2008, RFC 3493. POSIX.1-2001. BSDi. getifaddrs(3), if_nameindex(3), ifconfig(8) () Azamat Hackimov , Dmitriy S. Seregin , Yuri Kozlov ; GNU (GNU General Public License - GPL, 3 ) , - . - , , () () () . Linux man-pages 6.18 8 2026 . if_nametoindex(3)