RTALLOC(9)

NAME
rtalloc, rtalloc_mpath, rtfree - routing entry interface

SYNOPSIS
#include <sys/types.h>
#include <sys/socket.h>
#include <net/route.h>
struct rtentry *
rtalloc(struct sockaddr *dst, int flags, unsigned int rtableid);
struct rtentry *
rtalloc_mpath(struct sockaddr *dst, uint32_t *src, unsigned int rtableid);
void
rtfree(struct rtentry *rt);

DESCRIPTION
The rtalloc() function looks in the routing table rtableid for an entry matching dst. The following flags can be specified:

RT_REPORT
    Notify the routing sockets if the lookup fails.

RT_RESOLVE
    Allocate and return a cloned entry for dst if it does not exist and the lookup returned a cloning entry.

The rtalloc_mpath() function does the same as rtalloc() with the RT_REPORT and RT_RESOLVE flags, but selects a multipath routing entry corresponding to src when possible.

The rtfree() function releases a reference to the routing entry rt, freeing it if the reference count drops to 0.

CONTEXT
rtalloc(), rtalloc_mpath(), and rtfree() can be called during autoconf, from process context, or from interrupt context.

SEE ALSO
route(4), rtrequest1(9)