|
NAMEif_nametoindex , if_indextoname ,
if_nameindex , if_freenameindex
—
provide mappings between interface names and indexes
SYNOPSIS#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>
unsigned int
char *
struct if_nameindex *
void
DESCRIPTIONTheif_nametoindex () function maps the interface name
specified in ifname to its corresponding index. If the
specified interface does not exist, it returns 0.
The The unsigned int if_index; /* 1, 2, ... */ char *if_name; /* null terminated name: "le0", ... */ The end of the array of structures is indicated by a structure
with an if_index of 0 and an
if_name of The RETURN VALUESUpon successful completion,if_nametoindex () returns the
index number of the interface. If the interface is not found, a value of 0 is
returned and errno is set to
ENXIO . A value of 0 is also returned if an error
occurs while retrieving the list of interfaces via
getifaddrs(3).
Upon successful completion,
The SEE ALSOgetifaddrs(3), networking(4)STANDARDSTheif_nametoindex (),
if_indextoname (),
if_nameindex (), and
if_freenameindex () functions conform to
RFC 2553.
HISTORYThe implementation first appeared in BSDi BSD/OS.
Visit the GSP FreeBSD Man Page Interface. |