[OpenBSD]

Manual Page Search Parameters

RT_IFA_ADD(9) Kernel Developer's Manual RT_IFA_ADD(9)

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

#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, unsigned int rdomain);

int
rt_ifa_del(struct ifaddr *ifa, int flags, struct sockaddr *dst, unsigned int rdomain);

int
rt_ifa_addlocal(struct ifaddr *ifa);

int
rt_ifa_dellocal(struct ifaddr *ifa);

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 in the routing domain specified by rdomain.

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 in the routing domain specified by rdomain.
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.

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.

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

lo(4), route(4), rtrequest(9)
February 13, 2019 OpenBSD-current