ifunit Kernel Service
Purpose
Returns a pointer to the ifnet structure of the requested interface.
Syntax
#include <sys/types.h>
#include <sys/errno.h>
#include <net/if.h>
Parameter
Item | Description |
---|---|
name | Specifies the name of an interface (for example, en0). |
Description
The ifunit kernel service searches the list of configured interfaces for an interface specified by the name parameter. If a match is found, the ifunit service returns the address of the ifnet structure for that interface.
Execution Environment
The ifunit kernel service can be called from either the process or interrupt environment.
Return Values
The ifunit kernel service returns the address of the ifnet structure associated with the named interface. If the interface is not found, the service returns a null value.
Example
To return a pointer to the ifnet structure of the requested interface, invoke the ifunit kernel service as follows:
ifp = ifunit("en0");