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
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.
45 mechanism are also used to interact with user-level processes by means
48 pseudo-protocol family.
51 header file defines the structures and manifest constants used in this
54 The basic structure of a route is defined by
55 .Vt "struct rtentry" ,
56 which includes the following fields:
57 .Bl -tag -offset indent -width 6n
58 .It Vt "struct radix_node rt_nodes[2]" ;
59 Glue used by the radix-tree routines.
60 These members also include in
61 their substructure the key (i.e., destination address) and mask used
62 when the route was created.
67 macros can be used to extract this information (in the form of a
68 .Vt "struct sockaddr *" )
70 .Vt "struct rtentry *" .
71 .It Vt "struct sockaddr *rt_gateway" ;
74 of the route, which can either represent a destination in its own
75 right (some protocols will put a link-layer address here), or some
76 intermediate stop on the way to that destination (if the
79 .It Vt "u_long rt_flags" ;
81 .It Vt "struct ifnet *rt_ifp" ;
82 .It Vt "struct ifaddr *rt_ifa" ;
83 These two fields represent the
85 as it were, to the question posed by a route lookup; that is, they
86 name the interface and interface address to be used in sending a
87 packet to the destination or set of destinations which this route
89 .It Vt "struct rt_metrics_lite rt_rmx" ;
91 .It Vt "long rt_refcnt" ;
92 Route entries are reference-counted; this field indicates the number
93 of external (to the radix tree) references.
96 flag is not present, the
98 function will delete the route from the radix tree when the last
100 .It Vt "struct sockaddr *rt_genmask" ;
103 family of functions performs a cloning operation as requested by the
105 flag, this field is used as the mask for the new route which is
106 inserted into the table.
107 If this field is a null pointer, then a host
109 .It Vt "caddr_t rt_llinfo" ;
112 flag is set, this field contains information specific to the link
113 layer represented by the named interface address.
114 (It is normally managed by the
115 .Va rt_ifa->ifa_rtrequest
119 use this field to reference per-destination state internal to that
121 .It Vt "struct rtentry *rt_gwroute" ;
122 This member is a reference to a route whose destination is
127 .It Vt "struct rtentry *rt_parent" ;
128 A reference to the route from which this route was cloned, or a null
129 pointer if this route was not generated by cloning.
133 .It Vt "struct mtx rt_mtx" ;
134 Mutex to lock this routing entry.
137 The following flag bits are defined:
138 .Bl -tag -offset indent -width ".Dv RTF_BLACKHOLE" -compact
140 The route is not deleted.
142 The route points to an intermediate destination and not the ultimate
147 fields name that destination.
149 This is a host route.
151 The destination is presently unreachable.
152 This should result in an
154 error from output routines.
156 This route was created dynamically by
159 This route was modified by
164 protocol, indicating that the request was executed.
166 When this route is returned as a result of a lookup, automatically
167 create a new route using this one as a template and
169 (if present) as a mask.
171 When this route is returned as a result of a lookup, send a report on
174 interface requesting that an external process perform resolution for
176 (Used in conjunction with
179 Indicates that this route represents information being managed by a
180 link layer's adaptation layer (e.g.,
183 Indicates that this route was manually added by means of the
187 Requests that output sent via this route be discarded.
193 This flag is obsolete and simply ignored by facility.
195 Indicates that this route was generated as a result of cloning
201 field indicates the route from which this one was generated.
203 (Reserved for future use to indicate routes which are not to be
204 modified by a routing protocol.)
206 Indicates that the destination of this route is an address configured
207 as belonging to this system.
209 Indicates that the destination is a broadcast address.
211 Indicates that the destination is a multicast address.
214 Every route has associated with it a set of metrics, stored in
215 .Vt "struct rt_metrics_lite" .
216 Metrics are supplied in
217 .Vt "struct rt_metrics"
218 passed with routing control messages via
222 .Vt rmx_mtu , rmx_expire ,
226 .Vt "struct rt_metrics_lite" .
227 All others are ignored.
229 The following metrics are defined by
230 .Vt "struct rt_metrics" :
231 .Bl -tag -offset indent -width 6n
232 .It Vt "u_long rmx_locks" ;
233 Flag bits indicating which metrics the kernel is not permitted to
235 .It Vt "u_long rmx_mtu" ;
237 .It Vt "u_long rmx_hopcount" ;
238 Number of intermediate systems on the path to this destination.
239 .It Vt "u_long rmx_expire" ;
243 at which this route should expire, or zero if it should never expire.
244 It is the responsibility of individual protocol suites to ensure that routes
245 are actually deleted once they expire.
246 .It Vt "u_long rmx_recvpipe" ;
247 Nominally, the bandwidth-delay product for the path
252 In practice, this value is used to set the size of the
253 receive buffer (and thus the window in sliding-window protocols like
255 .It Vt "u_long rmx_sendpipe" ;
256 As before, but in the opposite direction.
257 .It Vt "u_long rmx_ssthresh" ;
258 The slow-start threshold used in
260 congestion-avoidance.
261 .It Vt "u_long rmx_rtt" ;
262 The round-trip time to this destination, in units of
265 .It Vt "u_long rmx_rttvar" ;
266 The average deviation of the round-trip time to this destination, in
270 .It Vt "u_long rmx_pksent" ;
271 A count of packets successfully sent via this route.
272 .It Vt "u_long rmx_filler[4]" ;
274 Empty space available for protocol-specific information.
283 structure first appeared in
285 The radix-tree representation of the routing table and the
287 structure first appeared in
290 This manual page was written by
291 .An Garrett Wollman .
293 There are a number of historical relics remaining in this interface.
298 fields could be named better.
300 There is some disagreement over whether it is legitimate for
302 to be set by any process other than
303 .Va rt_ifa->ifa_rtrequest .