Manual Page Result
0
Command: if_get | Section: 9 | Source: OpenBSD | File: if_get.9
IF_GET(9) FreeBSD Kernel Developer's Manual IF_GET(9)
NAME
if_get, if_unit, if_put - get an interface pointer from an interface
index
SYNOPSIS
#include <net/if.h>
struct ifnet *
if_get(unsigned int ifidx);
struct ifnet *
if_unit(const char *name);
void
if_put(struct ifnet *ifp);
DESCRIPTION
The if_get() function returns a pointer to the interface descriptor
corresponding to the unique index ifidx. This descriptor is guaranteed
to be valid until if_put() is called on the returned pointer.
The index value 0 is never associated with an interface descriptor and
can be used to determine if an interface index is valid or not.
The if_unit() function returns a pointer to the interface descriptor
corresponding to the unique name name. This descriptor is guaranteed to
be valid until if_put() is called on the returned pointer.
The if_put() function releases a reference on the interface descriptor
pointed by ifp. If ifp is a NULL pointer, no action occurs.
CONTEXT
if_get(), if_unit() and if_put() can be called during autoconf, from
process context, or from interrupt context.
RETURN VALUES
if_get() returns a pointer to an interface descriptor if the index is
valid, otherwise NULL.
if_unit() returns a pointer to an interface descriptor if the interface
with present name exists, otherwise NULL.
FreeBSD 14.1-RELEASE-p8 January 18, 2021 FreeBSD 14.1-RELEASE-p8