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