]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - share/man/man9/rtentry.9
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / share / man / man9 / rtentry.9
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 .\" $FreeBSD$
30 .\"
31 .Dd December 11, 2008
32 .Dt RTENTRY 9
33 .Os
34 .Sh NAME
35 .Nm rtentry
36 .Nd structure of an entry in the kernel routing table
37 .Sh SYNOPSIS
38 .In sys/types.h
39 .In sys/socket.h
40 .In net/route.h
41 .Sh DESCRIPTION
42 The kernel provides a common mechanism by which all protocols can store
43 and retrieve entries from a central table of routes.
44 Parts of this
45 mechanism are also used to interact with user-level processes by means
46 of a socket in the
47 .Xr route 4
48 pseudo-protocol family.
49 The
50 .In net/route.h
51 header file defines the structures and manifest constants used in this
52 facility.
53 .Pp
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.
63 The
64 .Fn rt_key rt
65 and
66 .Fn rt_mask rt
67 macros can be used to extract this information (in the form of a
68 .Vt "struct sockaddr *" )
69 given a
70 .Vt "struct rtentry *" .
71 .It Vt "struct sockaddr *rt_gateway" ;
72 The
73 .Dq target
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
77 .Dv RTF_GATEWAY
78 flag is set).
79 .It Vt "int rt_flags" ;
80 See below.
81 .It Vt "int rt_refcnt" ;
82 Route entries are reference-counted; this field indicates the number
83 of external (to the radix tree) references.
84 .It Vt "struct ifnet *rt_ifp" ;
85 .It Vt "struct ifaddr *rt_ifa" ;
86 These two fields represent the
87 .Dq answer ,
88 as it were, to the question posed by a route lookup; that is, they
89 name the interface and interface address to be used in sending a
90 packet to the destination or set of destinations which this route
91 represents.
92 .It Vt "struct rt_metrics_lite rt_rmx" ;
93 See below.
94 If the
95 .Dv RTF_UP
96 flag is not present, the
97 .Fn rtfree
98 function will delete the route from the radix tree when the last
99 reference drops.
100 .It Vt "struct rtentry *rt_gwroute" ;
101 This member is a reference to a route whose destination is
102 .Va rt_gateway .
103 It is only used for
104 .Dv RTF_GATEWAY
105 routes.
106 .It Vt "struct mtx rt_mtx" ;
107 Mutex to lock this routing entry.
108 .El
109 .Pp
110 The following flag bits are defined:
111 .Bl -tag -offset indent -width ".Dv RTF_BLACKHOLE" -compact
112 .It Dv RTF_UP
113 The route is not deleted.
114 .It Dv RTF_GATEWAY
115 The route points to an intermediate destination and not the ultimate
116 recipient; the
117 .Va rt_gateway
118 and
119 .Va rt_gwroute
120 fields name that destination.
121 .It Dv RTF_HOST
122 This is a host route.
123 .It Dv RTF_REJECT
124 The destination is presently unreachable.
125 This should result in an
126 .Er EHOSTUNREACH
127 error from output routines.
128 .It Dv RTF_DYNAMIC
129 This route was created dynamically by
130 .Fn rtredirect .
131 .It Dv RTF_MODIFIED
132 This route was modified by
133 .Fn rtredirect .
134 .It Dv RTF_DONE
135 Used only in the
136 .Xr route 4
137 protocol, indicating that the request was executed.
138 .It Dv RTF_XRESOLVE
139 When this route is returned as a result of a lookup, send a report on
140 the
141 .Xr route 4
142 interface requesting that an external process perform resolution for
143 this route.
144 .It Dv RTF_STATIC
145 Indicates that this route was manually added by means of the
146 .Xr route 8
147 command.
148 .It Dv RTF_BLACKHOLE
149 Requests that output sent via this route be discarded.
150 .It Dv RTF_PROTO1
151 .It Dv RTF_PROTO2
152 .It Dv RTF_PROTO3
153 Protocol-specific.
154 .It Dv RTF_PRCLONING
155 This flag is obsolete and simply ignored by facility.
156 .It Dv RTF_PINNED
157 (Reserved for future use to indicate routes which are not to be
158 modified by a routing protocol.)
159 .It Dv RTF_LOCAL
160 Indicates that the destination of this route is an address configured
161 as belonging to this system.
162 .It Dv RTF_BROADCAST
163 Indicates that the destination is a broadcast address.
164 .It Dv RTF_MULTICAST
165 Indicates that the destination is a multicast address.
166 .El
167 .Pp
168 Every route has associated with it a set of metrics, stored in
169 .Vt "struct rt_metrics_lite" .
170 Metrics are supplied in
171 .Vt "struct rt_metrics"
172 passed with routing control messages via
173 .Xr route 4
174 API.
175 Currently only
176 .Vt rmx_mtu , rmx_expire ,
177 and
178 .Vt rmx_pksent
179 metrics are used in
180 .Vt "struct rt_metrics_lite" .
181 All others are ignored.
182 .Pp
183 The following metrics are defined by
184 .Vt "struct rt_metrics" :
185 .Bl -tag -offset indent -width 6n
186 .It Vt "u_long rmx_locks" ;
187 Flag bits indicating which metrics the kernel is not permitted to
188 dynamically modify.
189 .It Vt "u_long rmx_mtu" ;
190 MTU for this path.
191 .It Vt "u_long rmx_hopcount" ;
192 Number of intermediate systems on the path to this destination.
193 .It Vt "u_long rmx_expire" ;
194 The time
195 (a la
196 .Xr time 3 )
197 at which this route should expire, or zero if it should never expire.
198 It is the responsibility of individual protocol suites to ensure that routes
199 are actually deleted once they expire.
200 .It Vt "u_long rmx_recvpipe" ;
201 Nominally, the bandwidth-delay product for the path
202 .Em from
203 the destination
204 .Em to
205 this system.
206 In practice, this value is used to set the size of the
207 receive buffer (and thus the window in sliding-window protocols like
208 .Tn TCP ) .
209 .It Vt "u_long rmx_sendpipe" ;
210 As before, but in the opposite direction.
211 .It Vt "u_long rmx_ssthresh" ;
212 The slow-start threshold used in
213 .Tn TCP
214 congestion-avoidance.
215 .It Vt "u_long rmx_rtt" ;
216 The round-trip time to this destination, in units of
217 .Dv RMX_RTTUNIT
218 per second.
219 .It Vt "u_long rmx_rttvar" ;
220 The average deviation of the round-trip time to this destination, in
221 units of
222 .Dv RMX_RTTUNIT
223 per second.
224 .It Vt "u_long rmx_pksent" ;
225 A count of packets successfully sent via this route.
226 .It Vt "u_long rmx_filler[4]" ;
227 .\" XXX badly named
228 Empty space available for protocol-specific information.
229 .El
230 .Sh SEE ALSO
231 .Xr route 4 ,
232 .Xr route 8 ,
233 .Xr rtalloc 9
234 .Sh HISTORY
235 The
236 .Vt rtentry
237 structure first appeared in
238 .Bx 4.2 .
239 The radix-tree representation of the routing table and the
240 .Vt rt_metrics
241 structure first appeared in
242 .Bx 4.3 reno .
243 .Sh AUTHORS
244 This manual page was written by
245 .An Garrett Wollman .
246 .Sh BUGS
247 There are a number of historical relics remaining in this interface.
248 The
249 .Va rt_gateway
250 and
251 .Va rmx_filler
252 fields could be named better.