xref: /freebsd/share/man/man9/rtentry.9 (revision 027768a21217499dd85aba8608715a5bf66a7857)
1.\"
2.\" Copyright 1996 Massachusetts Institute of Technology
3.\"
4.\" Permission to use, copy, modify, and distribute this software and
5.\" its documentation for any purpose and without fee is hereby
6.\" granted, provided that both the above copyright notice and this
7.\" permission notice appear in all copies, that both the above
8.\" copyright notice and this permission notice appear in all
9.\" supporting documentation, and that the name of M.I.T. not be used
10.\" in advertising or publicity pertaining to distribution of the
11.\" software without specific, written prior permission.  M.I.T. makes
12.\" no representations about the suitability of this software for any
13.\" purpose.  It is provided "as is" without express or implied
14.\" warranty.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''.  M.I.T. DISCLAIMS
17.\" ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
18.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
20.\" SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23.\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24.\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27.\" SUCH DAMAGE.
28.\"
29.Dd March 5, 2014
30.Dt RTENTRY 9
31.Os
32.Sh NAME
33.Nm rtentry
34.Nd structure of an entry in the kernel routing table
35.Sh SYNOPSIS
36.In sys/types.h
37.In sys/socket.h
38.In net/route.h
39.Sh DESCRIPTION
40The kernel provides a common mechanism by which all protocols can store
41and retrieve entries from a central table of routes.
42Parts of this
43mechanism are also used to interact with user-level processes by means
44of a socket in the
45.Xr route 4
46pseudo-protocol family.
47The
48.In net/route.h
49header file defines the structures and manifest constants used in this
50facility.
51.Pp
52The basic structure of a route is defined by
53.Vt "struct rtentry" ,
54which includes the following fields:
55.Bl -tag -offset indent -width 6n
56.It Vt "struct radix_node rt_nodes[2]" ;
57Glue used by the radix-tree routines.
58These members also include in
59their substructure the key (i.e., destination address) and mask used
60when the route was created.
61The
62.Fn rt_key rt
63and
64.Fn rt_mask rt
65macros can be used to extract this information (in the form of a
66.Vt "struct sockaddr *" )
67given a
68.Vt "struct rtentry *" .
69.It Vt "struct sockaddr *rt_gateway" ;
70The
71.Dq target
72of the route, which can either represent a destination in its own
73right (some protocols will put a link-layer address here), or some
74intermediate stop on the way to that destination (if the
75.Dv RTF_GATEWAY
76flag is set).
77.It Vt "int rt_flags" ;
78See below.
79If the
80.Dv RTF_UP
81flag is not present, the
82.Fn rtfree
83function will delete the route from the radix tree when the last
84reference drops.
85.It Vt "int rt_refcnt" ;
86Route entries are reference-counted; this field indicates the number
87of external (to the radix tree) references.
88.It Vt "struct ifnet *rt_ifp" ;
89.It Vt "struct ifaddr *rt_ifa" ;
90These two fields represent the
91.Dq answer ,
92as it were, to the question posed by a route lookup; that is, they
93name the interface and interface address to be used in sending a
94packet to the destination or set of destinations which this route
95represents.
96.It Vt "u_long rt_mtu";
97See description of rmx_mtu below.
98.It Vt "u_long rt_weight";
99See description of rmx_weight below.
100.It Vt "u_long rt_expire";
101See description of rmx_expire below.
102.It Vt "counter64_t rt_pksent";
103See description of rmx_pksent below.
104.It Vt "struct rtentry *rt_gwroute" ;
105This member is a reference to a route whose destination is
106.Va rt_gateway .
107It is only used for
108.Dv RTF_GATEWAY
109routes.
110.It Vt "struct mtx rt_mtx" ;
111Mutex to lock this routing entry.
112.El
113.Pp
114The following flag bits are defined:
115.Bl -tag -offset indent -width ".Dv RTF_BLACKHOLE" -compact
116.It Dv RTF_UP
117The route is not deleted.
118.It Dv RTF_GATEWAY
119The route points to an intermediate destination and not the ultimate
120recipient; the
121.Va rt_gateway
122and
123.Va rt_gwroute
124fields name that destination.
125.It Dv RTF_HOST
126This is a host route.
127.It Dv RTF_REJECT
128The destination is presently unreachable.
129This should result in an
130.Er EHOSTUNREACH
131error from output routines.
132.It Dv RTF_DYNAMIC
133This route was created dynamically by
134.Fn rtredirect .
135.It Dv RTF_MODIFIED
136This route was modified by
137.Fn rtredirect .
138.It Dv RTF_DONE
139Used only in the
140.Xr route 4
141protocol, indicating that the request was executed.
142.It Dv RTF_XRESOLVE
143When this route is returned as a result of a lookup, send a report on
144the
145.Xr route 4
146interface requesting that an external process perform resolution for
147this route.
148.It Dv RTF_STATIC
149Indicates that this route was manually added by means of the
150.Xr route 8
151command.
152.It Dv RTF_BLACKHOLE
153Requests that output sent via this route be discarded.
154.It Dv RTF_PROTO1
155.It Dv RTF_PROTO2
156.It Dv RTF_PROTO3
157Protocol-specific.
158.It Dv RTF_PINNED
159Indicates that this route is immutable to a routing protocol.
160.It Dv RTF_LOCAL
161Indicates that the destination of this route is an address configured
162as belonging to this system.
163.It Dv RTF_BROADCAST
164Indicates that the destination is a broadcast address.
165.It Dv RTF_MULTICAST
166Indicates that the destination is a multicast address.
167.El
168.Pp
169Several metrics are supplied in
170.Vt "struct rt_metrics"
171passed with routing control messages via
172.Xr route 4
173API.
174Currently only
175.Vt rmx_mtu , rmx_expire ,
176and
177.Vt rmx_pksent
178metrics are supplied.
179All others are ignored.
180.Pp
181The following metrics are defined by
182.Vt "struct rt_metrics" :
183.Bl -tag -offset indent -width 6n
184.It Vt "u_long rmx_locks" ;
185Flag bits indicating which metrics the kernel is not permitted to
186dynamically modify.
187.It Vt "u_long rmx_mtu" ;
188MTU for this path.
189.It Vt "u_long rmx_hopcount" ;
190Number of intermediate systems on the path to this destination.
191.It Vt "u_long rmx_expire" ;
192The time
193(a la
194.Xr time 3 )
195at which this route should expire, or zero if it should never expire.
196It is the responsibility of individual protocol suites to ensure that routes
197are actually deleted once they expire.
198.It Vt "u_long rmx_recvpipe" ;
199Nominally, the bandwidth-delay product for the path
200.Em from
201the destination
202.Em to
203this system.
204In practice, this value is used to set the size of the
205receive buffer (and thus the window in sliding-window protocols like
206.Tn TCP ) .
207.It Vt "u_long rmx_sendpipe" ;
208As before, but in the opposite direction.
209.It Vt "u_long rmx_ssthresh" ;
210The slow-start threshold used in
211.Tn TCP
212congestion-avoidance.
213.It Vt "u_long rmx_rtt" ;
214The round-trip time to this destination, in units of
215.Dv RMX_RTTUNIT
216per second.
217.It Vt "u_long rmx_rttvar" ;
218The average deviation of the round-trip time to this destination, in
219units of
220.Dv RMX_RTTUNIT
221per second.
222.It Vt "u_long rmx_pksent" ;
223A count of packets successfully sent via this route.
224.It Vt "u_long rmx_filler[4]" ;
225.\" XXX badly named
226Empty space available for protocol-specific information.
227.El
228.Sh SEE ALSO
229.Xr route 4 ,
230.Xr route 8 ,
231.Sh HISTORY
232The
233.Vt rtentry
234structure first appeared in
235.Bx 4.2 .
236The radix-tree representation of the routing table and the
237.Vt rt_metrics
238structure first appeared in
239.Bx 4.3 reno .
240.Sh AUTHORS
241This manual page was written by
242.An Garrett Wollman .
243.Sh BUGS
244There are a number of historical relics remaining in this interface.
245The
246.Va rt_gateway
247and
248.Va rmx_filler
249fields could be named better.
250