RT_IFA_ADD(9)

NAME
rt_ifa_add, rt_ifa_del, rt_ifa_addlocal, rt_ifa_dellocal - add or delete routing entries associated with an address

SYNOPSIS
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>
#include <net/route.h>
int
rt_ifa_add(struct ifaddr *ifa, int flags, struct sockaddr *dst);
int
rt_ifa_del(struct ifaddr *ifa, int flags, struct sockaddr *dst);
int
rt_ifa_addlocal(struct ifaddr *ifa);
int
rt_ifa_dellocal(struct ifaddr *ifa);

DESCRIPTION
These functions create and delete routing entries required by the network stack and managed by the kernel.

rt_ifa_add()
    Creates and associates a connected routing entry with ifa.

    Connected routing entries represent routes to prefixes and should be created with RTF_CLONING in flags and the address of ifa in dst. But for Point-to-Point interfaces, connected routing entries represent routes to hosts and should be created with RTF_HOST in flags and the destination address in dst. Connected routing entries have a priority of RTP_CONNECTED.

rt_ifa_del()
    Removes the connected routing entry associated with ifa.

rt_ifa_addlocal()
    Creates and associates a local routing entry with ifa.

    Local routing entries are used to not send packets destined to a local address on the wire and instead redirect them to lo(4). They have the lowest priority available, RTP_LOCAL, and contain a special flag, RTF_LOCAL, that can be checked to determine if the address is configured on the system.

rt_ifa_dellocal()
    Removes the local routing entry associated with ifa.

CONTEXT
rt_ifa_add(), rt_ifa_del(), rt_ifa_addlocal(), and rt_ifa_dellocal() can be called during autoconf, from process context, or from interrupt context.

RETURN VALUES
rt_ifa_add(), rt_ifa_del(), rt_ifa_addlocal(), and rt_ifa_dellocal() will return 0 on success and the return value of rtrequest1(9) otherwise.

SEE ALSO
lo(4), route(4), rtrequest1(9)