2 .\" Copyright 1996 Massachusetts Institute of Technology
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
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
29 .\" $FreeBSD: src/share/man/man9/rtentry.9,v 1.11.2.6 2002/03/17 09:12:50 schweikh Exp $
30 .\" $DragonFly: src/share/man/man9/rtentry.9,v 1.4 2006/05/26 19:39:40 swildner Exp $
36 .Nd structure of an entry in the kernel routing table
42 The kernel provides a common mechanism by which all protocols can store
43 and retrieve entries from a central table of routes. Parts of this
44 mechanism are also used to interact with user-level processes by means
47 pseudo-protocol family.
50 header file defines the structures and manifest constants used in this
53 The basic structure of a route is defined by
54 .Dq Li struct rtentry ,
55 which includes the following fields:
56 .Bl -tag -offset indent -width 6n
58 .Vt "struct radix_node rt_nodes[2]" ;
60 Glue used by the radix-tree routines. These members also include in
61 their substructure the key (i.e., destination address) and mask used
62 when the route was created. The
66 macros can be used to extract this information (in the form of a
67 .Dq Li "struct sockaddr *" )
69 .Li "struct rtentry *" .
71 .Vt "struct sockaddr *rt_gateway" ;
75 of the route, which can either represent a destination in its own
76 right (some protocols will put a link-layer address here), or some
77 intermediate stop on the way to that destination (if the
81 .Vt "long rt_refcnt" ;
83 Route entries are reference-counted; this field indicates the number
84 of external (to the radix tree) references. If the
86 flag is not present, the
88 function will delete the route from the radix tree when the last
91 .Vt "u_long rt_flags" ;
95 .Vt "struct ifnet *rt_ifp" ;
98 .Vt "struct ifaddr *rt_ifa" ;
100 These two fields represent the
102 as it were, to the question posed by a route lookup; that is, they
103 name the interface and interface address to be used in sending a
104 packet to the destination or set of destinations which this route
107 .Vt "struct sockaddr *rt_genmask" ;
111 family of functions performs a cloning operation as requested by the
115 flag, this field is used as the mask for the new route which is
116 inserted into the table. If this field is a null pointer, then a host
119 .Vt "caddr_t rt_llinfo" ;
123 flag is set, this field contains information specific to the link
124 layer represented by the named interface address. (It is normally
126 .Fn rt_ifa->ifa_rtrequest
127 routine.) Protocols such as
129 use this field to reference per-destination state internal to that
132 .Vt "struct rt_metrics rt_rmx" ;
136 .Vt "struct rtentry *rt_gwroute" ;
138 This member is a reference to a route whose destination is
143 .\" .It Dv "int (*rt_output)();"
146 .Vt "struct rtentry *rt_parent" ;
148 A reference to the route from which this route was cloned, or a null
149 pointer if this route was not generated by cloning. See also the
154 The following flag bits are defined:
155 .Bl -tag -offset indent -width RTF_CHAINDELETE -compact
157 The route is not deleted.
159 The route points to an intermediate destination and not the ultimate
164 fields name that destination.
166 This is a host route.
168 The destination is presently unreachable. This should result in an
170 error from output routines.
172 This route was created dynamically by
175 This route was modified by
180 protocol, indicating that the request was executed.
182 When this route is returned as a result of a lookup, automatically
183 create a new route using this one as a template and
185 (if present) as a mask.
187 When this route is returned as a result of a lookup, send a report on
190 interface requesting that an external process perform resolution for
191 this route. (Used in conjunction with
194 Indicates that this route represents information being managed by a
195 link layer's adaptation layer (e.g.,
198 Indicates that this route was manually added by means of the
202 Requests that output sent via this route be discarded.
210 only managed by an entire protocol. (E.g.,
212 uses this flag to manage a per-host cache integrated with the routing
213 table, for those destinations which do not have a link layer
214 performing this function.)
216 Indicates that this route was generated as a result of cloning
223 field indicates the route from which this one was generated.
225 (Reserved for future use to indicate routes which are not to be
226 modified by a routing protocol.)
228 Indicates that the destination of this route is an address configured
229 as belonging to this system.
231 Indicates that the destination is a broadcast address.
233 Indicates that the destination is a multicast address.
236 Every route has associated with it a set of metrics, defined by
237 .Li struct rt_metrics :
238 .Bl -tag -offset indent -width 6n
240 .Vt "u_long rmx_locks" ;
242 Flag bits indicating which metrics the kernel is not permitted to
245 .Vt "u_long rmx_mtu" ;
249 .Vt "u_long rmx_hopcount" ;
251 Number of intermediate systems on the path to this destination.
253 .Vt "u_long rmx_expire" ;
258 at which this route should expire, or zero if it should never expire.
259 It is the responsibility of individual protocol suites to ensure that routes
260 are actually deleted once they expire.
262 .Vt "u_long rmx_recvpipe" ;
264 Nominally, the bandwidth-delay product for the path
268 this system. In practice, this value is used to set the size of the
269 receive buffer (and thus the window in sliding-window protocols like
272 .Vt "u_long rmx_sendpipe" ;
274 As before, but in the opposite direction.
276 .Vt "u_long rmx_ssthresh" ;
278 The slow-start threshold used in
280 congestion-avoidance.
282 .Vt "u_long rmx_rtt" ;
284 The round-trip time to this destination, in units of
288 .Vt "u_long rmx_rttvar" ;
290 The average deviation of the round-type time to this destination, in
295 .Vt "u_long rmx_pksent" ;
297 A count of packets successfully sent via this route.
299 .Vt "u_long rmx_filler[4]" ;
302 Empty space available for protocol-specific information.
311 structure first appeared in
313 The radix-tree representation of the routing table and the
315 structure first appeared in
319 mechanism first appeared in
322 This manual page was written by
323 .An Garrett Wollman .
325 There are a number of historical relics remaining in this interface.
330 fields could be named better.
332 There is some disagreement over whether it is legitimate for
334 to be set by any process other than
335 .Fn rt_ifa->ifa_rtrequest .