OpenBSD manual page server

Manual Page Search Parameters

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

rtalloc, rtalloc_mpath, rtisvalid, rtref, rtfree
routing entry interface

#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);

rtisvalid(struct rtentry *rt);

rtref(struct rtentry *rt);

rtfree(struct rtentry *rt);

The rtalloc() function looks in the routing table rtableid for an entry matching dst. The following flags can be specified:
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_RESOLVE flag, but selects a multipath routing entry corresponding to src when possible.

The rtisvalid() function checks if the route entry rt is still valid and can be used. Cached entries that are no longer valid should be released by calling rtfree().

The rtref() function increments a reference to the routing entry rt.

The rtfree() function releases a reference to the routing entry rt, freeing it if the reference count drops to 0. If rt is a NULL pointer, no action occurs.

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

rtisvalid() returns 1 if the route entry is valid, otherwise 0.

route(4), rtable_walk(9), rtrequest(9)
July 12, 2019 OpenBSD-current