ifa_ifwithaddr Kernel Service

Purpose

Locates an interface based on a complete address.

Syntax

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

struct ifaddr * ifa_ifwithaddr ( addr)
struct sockaddr *addr;

Parameter

Item Description
addr Specifies a complete address.

Description

The ifa_ifwithaddr kernel service is passed a complete address and locates the corresponding interface. If successful, the ifa_ifwithaddr service returns the ifaddr structure associated with that address.

Execution Environment

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

Return Values

If successful, the ifa_ifwithaddr service returns the corresponding ifaddr structure associated with the address it is passed. If no interface is found, the ifa_ifwithaddr service returns a null pointer.

Example

To locate an interface based on a complete address, invoke the ifa_ifwithaddr kernel service as follows:

ifa_ifwithaddr((struct sockaddr *)&ipaddr);