RT_IFA_ADD(9)

NAME
rt_ifa_add, rt_ifa_del, rt_ifa_addloop, rt_ifa_delloop - add or delete routes associated with an address

SYNOPSIS
#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);
void
rt_ifa_addloop(struct ifaddr *ifa);
void
rt_ifa_delloop(struct ifaddr *ifa);

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

rt_ifa_add()
    Creates and associates a connected route with ifa.

    Connected routes are mostly 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 routes are routes to hosts and should be created with RTF_HOST in flags and the destination address in dst. Connected routes have a priority of RTP_CONNECTED.

rt_ifa_del()
    Removes the connected route associated with ifa.

rt_ifa_addloop()
    Creates and associates a local route with ifa.

    Local routes 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_delloop()
    Removes the local route associated with ifa.

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

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

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