xref: /openbsd-src/share/man/man9/route.9 (revision 0b7734b3d77bb9b21afec6f4621cae6c805dbd45)
1.\"     $OpenBSD: route.9,v 1.16 2015/11/23 17:53:57 jmc Exp $
2.\"
3.\" Copyright (c) 2011 Bret S. Lambert <blambert@openbsd.org>
4.\" All rights reserved.
5.\"
6.\" Permission to use, copy, modify, and distribute this software for any
7.\" purpose with or without fee is hereby granted, provided that the above
8.\" copyright notice and this permission notice appear in all copies.
9.\"
10.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17.\"
18.Dd $Mdocdate: November 23 2015 $
19.Dt RT_LOOKUP 9
20.Os
21.Sh NAME
22.Nm rt_lookup ,
23.Nm rt_setgate ,
24.Nm rtredirect ,
25.Nm rtdeletemsg
26.Nd kernel routing interface
27.Sh SYNOPSIS
28.In net/route.h
29.Ft struct rtentry *
30.Fn rt_lookup "struct sockaddr *dst" "struct sockaddr *mask" "u_int tableid"
31.Ft int
32.Fn rt_setgate "struct rtentry *rt0" "struct sockaddr *dst" \
33"struct sockaddr *gate" "u_int tableid"
34.Ft void
35.Fn rtredirect "struct sockaddr *dst" "struct sockaddr *gateway" \
36"struct sockaddr *netmask" "int flags" "struct sockaddr *src" \
37"struct rtentry **rtp" "u_int rdomain"
38.Ft int
39.Fn rtdeletemsg "struct rtentry *rt" "u_int tableid"
40.Sh DESCRIPTION
41Routing entries describe the routes to be taken by packets in a router.
42.Bl -tag -width Ds
43.It Fn rt_lookup "struct sockaddr *dst" "struct sockaddr *mask" "u_int tableid"
44Return pointer to routing entry corresponding to address
45.Fa dst
46with a mask of
47.Fa mask
48from table
49.Fa tableid .
50.It Fn rt_setgate "struct rtentry *rt0" "struct sockaddr *dst" \
51"struct sockaddr *gate" "u_int tableid"
52Set the address of the gateway for routes described by
53.Fa rt0
54to
55.Fa gateway .
56If memory must be allocated to hold the gateway address,
57the address for which
58.Fa rt0
59describes routes will be copied from
60.Fa dst .
61.It Fn rtredirect "struct sockaddr *dst" "struct sockaddr *gateway" \
62"struct sockaddr *netmask" "int flags" "struct sockaddr *src" \
63"struct rtentry **rtp" "u_int rdomain"
64Redirect routes to
65.Fa dst
66through
67.Fa gateway ,
68such as in response to an ICMP redirect message.
69.Fa src
70should be the address from which the redirect message was received.
71If
72.Fa rtp
73is not NULL,
74it will be populated by the routing entry corresponding to
75.Fa dst .
76.It Fn rtdeletemsg "struct rtentry *rt" "u_int tableid"
77Delete routing table entry
78.Fa rt
79from table
80.Fa tableid
81and forward a notification message to all
82.Fa AF_ROUTE
83sockets.
84.El
85.Sh RETURN VALUES
86.Fn rt_setgate
87may fail with:
88.Pp
89.Bl -tag -width Er -compact
90.It Bq Er ENOBUFS
91Memory could not be allocated for the gateway.
92.El
93.Pp
94.Fn rtdeletemsg
95may fail with:
96.Pp
97.Bl -tag -width Er -compact
98.It Bq Er EAFNOSUPPORT
99The protocol used by
100.Fa rt
101is not supported by table with ID
102.Fa tableid .
103.It Bq Er ESRCH
104No routing entry for
105.Fa rt
106could be found.
107.It Bq Er ESRCH
108.Fa rt
109is a multipath routing entry that conflicts with an existing one.
110.El
111.Sh SEE ALSO
112.Xr route 4 ,
113.Xr route 8 ,
114.Xr rt_timer_add 9 ,
115.Xr rtable_add 9 ,
116.Xr rtlabel_id2name 9 ,
117.Xr rtrequest 9
118