ifa_ifwithnet Kernel Service

Purpose

Locates an interface on a specific network.

Syntax

#include <sys/types.h>
#include <sys/errno.h>
#include <sys/socket.h>
#include <net/if.h>

struct ifaddr * ifa_ifwithnet ( addr)
register struct sockaddr *addr;

Parameter

Item Description
addr Specifies the address.

Description

The ifa_ifwithnet kernel service locates an interface that matches the network specified by the address it is passed. If more than one interface matches, the ifa_ifwithnet service returns the first interface found.

Execution Environment

The ifa_ifwithnet kernel service can be called from either the process or interrupt environment.

Return Values

If successful, the ifa_ifwithnet service returns the ifaddr structure of the correct interface. If no interface is found, the ifa_ifwithnet service returns a null pointer.

Example

To locate an interface on a specific network, invoke the ifa_ifwithnet kernel service as follows:

ifa_ifwithnet((struct sockaddr *)&ipaddr);