OpenBSD manual page server

Manual Page Search Parameters

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

rt_setgate, rtredirect, rtdeletemsgkernel routing interface

#include <net/route.h>

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

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

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

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

(struct rtentry *rt, struct sockaddr *gate, u_int tableid)
Set the address of the gateway for routes described by rt to gate. If memory must be allocated to hold the gateway address, the address for which rt describes routes will be copied from gate.
(struct sockaddr *dst, struct sockaddr *gateway, struct sockaddr *src, struct rtentry **rtp, unsigned 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, struct ifnet *ifp, u_int tableid)
Delete routing table entry rt from table tableid and forward a notification message to all AF_ROUTE sockets.

rt_setgate() may fail with:

[ENOBUFS]
Memory could not be allocated for the gateway.

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 routing entry that conflicts with an existing one.

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

January 11, 2017 OpenBSD-6.5