OpenBSD manual page server

Manual Page Search Parameters

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

routekernel routing interface

#include <net/route.h>

struct rtentry *
rt_lookup(struct sockaddr *dst, struct sockaddr *mask, u_int tableid);

void
rtalloc(struct route *ro);

void
rtalloc_noclone(struct route *ro);

struct rtentry *
rtalloc1(struct sockaddr *dst, int flags, u_int tableid);

void
rtfree(struct rtentry *rt);

RTFREE(struct rtentry *rt);

int
rt_setgate(struct rtentry *rt0, struct sockaddr *dst, struct sockaddr *gate, u_int tableid);

void
rtredirect(struct sockaddr *dst, struct sockaddr *gateway, struct sockaddr *netmask, int flags, struct sockaddr *src, struct rtentry **rtp, u_int rdomain);

int
rtdeletemsg(struct rtentry *rt, u_int tableid);

Routing entries describe the routes to be taken by packets in a router.

(struct sockaddr *dst, struct sockaddr *mask, u_int tableid)
Return pointer to routing entry corresponding to address dst with a mask of mask from table tableid.
(struct rtentry *rt0, struct sockaddr *dst, struct sockaddr *gate, u_int tableid)
Set the address of the gateway for routes described by rt0 to gateway. If memory must be allocated to hold the gateway address, the address for which rt0 describes routes will be copied from dst.
(struct sockaddr *dst, struct sockaddr *gateway, struct sockaddr *netmask, int flags, struct sockaddr *src, struct rtentry **rtp, u_int rdomain)
Redirect routes to dst through gateway, such as in response to an ICMP redirect message. src should be the address from which the redirect message was received. If rtp is not NULL, it will be populated by the routing entry corresponding to dst.
(struct rtentry *rt, u_int tableid)
Delete routing table entry rt from table tableid and forward a notification message to all AF_ROUTE sockets.
(struct rtentry *rt)
Release a reference to rt, freeing it if the reference count drops to 0.
()
A macro which calls rtfree().

rt_setgate() returns non-0 if it cannot allocate memory.

rtdeletemsg() may fail with:

[EAFNOSUPPORT]
The protocol used by rt is not supported by table with ID tableid.
[ESRCH]
No routing entry for rt could be found.
[ESRCH]
rt is a multipath route that conflicts with existing multipath route.

route(4), route(8), rt_timer_add(9), rtable_add(9), rtlabel_id2name(9), rtrequest1(9)

April 2, 2014 OpenBSD-5.6