RT_LOOKUP(9)

NAME
rt_lookup, rt_setgate, rtredirect, rtdeletemsg - kernel routing interface

SYNOPSIS
#include <net/route.h>
struct rtentry *
rt_lookup(struct sockaddr *dst, struct sockaddr *mask, u_int tableid);
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);

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

rt_lookup(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.

rt_setgate(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.

rtredirect(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.

rtdeletemsg(struct rtentry *rt, u_int tableid)
    Delete routing table entry rt from table tableid and forward a notification message to all AF_ROUTE sockets.

RETURN VALUES
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.

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