1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
|
<table class="head">
<tr>
<td class="head-ltitle">RTENTRY(9)</td>
<td class="head-vol">Kernel Developer's Manual</td>
<td class="head-rtitle">RTENTRY(9)</td>
</tr>
</table>
<div class="manual-text">
<section class="Sh">
<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
<p class="Pp"><code class="Nm">rtentry</code> —
<span class="Nd">structure of an entry in the kernel routing
table</span></p>
</section>
<section class="Sh">
<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
<p class="Pp"><code class="In">#include
<<a class="In">sys/types.h</a>></code>
<br/>
<code class="In">#include <<a class="In">sys/socket.h</a>></code>
<br/>
<code class="In">#include <<a class="In">net/route.h</a>></code></p>
</section>
<section class="Sh">
<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
<p class="Pp">The kernel provides a common mechanism by which all protocols can
store and retrieve entries from a central table of routes. Parts of this
mechanism are also used to interact with user-level processes by means of a
socket in the <a class="Xr">route(4)</a> pseudo-protocol family. The
<code class="In"><<a class="In">net/route.h</a>></code> header file
defines the structures and manifest constants used in this facility.</p>
<p class="Pp">The basic structure of a route is defined by
<var class="Vt">struct rtentry</var>, which includes the following
fields:</p>
<div class="Bd-indent">
<dl class="Bl-tag">
<dt id="rt_key"><var class="Vt">struct radix_node rt_nodes[2]</var>;</dt>
<dd>Glue used by the radix-tree routines. These members also include in their
substructure the key (i.e., destination address) and mask used when the
route was created. The
<a class="permalink" href="#rt_key"><code class="Fn">rt_key</code></a>(<var class="Fa">rt</var>)
and
<a class="permalink" href="#rt_mask"><code class="Fn" id="rt_mask">rt_mask</code></a>(<var class="Fa">rt</var>)
macros can be used to extract this information (in the form of a
<var class="Vt">struct sockaddr *</var>) given a <var class="Vt">struct
rtentry *</var>.</dd>
<dt><var class="Vt">struct sockaddr *rt_gateway</var>;</dt>
<dd>The “target” of the route, which can either represent a
destination in its own right (some protocols will put a link-layer address
here), or some intermediate stop on the way to that destination (if the
<code class="Dv">RTF_GATEWAY</code> flag is set).</dd>
<dt id="rtfree"><var class="Vt">int rt_flags</var>;</dt>
<dd>See below. If the <code class="Dv">RTF_UP</code> flag is not present, the
<a class="permalink" href="#rtfree"><code class="Fn">rtfree</code></a>()
function will delete the route from the radix tree when the last reference
drops.</dd>
<dt><var class="Vt">int rt_refcnt</var>;</dt>
<dd>Route entries are reference-counted; this field indicates the number of
external (to the radix tree) references.</dd>
<dt><var class="Vt">struct ifnet *rt_ifp</var>;</dt>
<dd style="width: auto;"> </dd>
<dt><var class="Vt">struct ifaddr *rt_ifa</var>;</dt>
<dd>These two fields represent the “answer”, as it were, to the
question posed by a route lookup; that is, they name the interface and
interface address to be used in sending a packet to the destination or set
of destinations which this route represents.</dd>
<dt><var class="Vt">u_long rt_mtu</var>;</dt>
<dd>See description of rmx_mtu below.</dd>
<dt><var class="Vt">u_long rt_weight</var>;</dt>
<dd>See description of rmx_weight below.</dd>
<dt><var class="Vt">u_long rt_expire</var>;</dt>
<dd>See description of rmx_expire below.</dd>
<dt><var class="Vt">counter64_t rt_pksent</var>;</dt>
<dd>See description of rmx_pksent below.</dd>
<dt><var class="Vt">struct rtentry *rt_gwroute</var>;</dt>
<dd>This member is a reference to a route whose destination is
<var class="Va">rt_gateway</var>. It is only used for
<code class="Dv">RTF_GATEWAY</code> routes.</dd>
<dt><var class="Vt">struct mtx rt_mtx</var>;</dt>
<dd>Mutex to lock this routing entry.</dd>
</dl>
</div>
<p class="Pp">The following flag bits are defined:</p>
<div class="Bd-indent">
<dl class="Bl-tag Bl-compact">
<dt id="RTF_UP"><a class="permalink" href="#RTF_UP"><code class="Dv">RTF_UP</code></a></dt>
<dd>The route is not deleted.</dd>
<dt id="RTF_GATEWAY"><a class="permalink" href="#RTF_GATEWAY"><code class="Dv">RTF_GATEWAY</code></a></dt>
<dd>The route points to an intermediate destination and not the ultimate
recipient; the <var class="Va">rt_gateway</var> and
<var class="Va">rt_gwroute</var> fields name that destination.</dd>
<dt id="RTF_HOST"><a class="permalink" href="#RTF_HOST"><code class="Dv">RTF_HOST</code></a></dt>
<dd>This is a host route.</dd>
<dt id="RTF_REJECT"><a class="permalink" href="#RTF_REJECT"><code class="Dv">RTF_REJECT</code></a></dt>
<dd>The destination is presently unreachable. This should result in an
<code class="Er">EHOSTUNREACH</code> error from output routines.</dd>
<dt id="RTF_DYNAMIC"><a class="permalink" href="#RTF_DYNAMIC"><code class="Dv">RTF_DYNAMIC</code></a></dt>
<dd>This route was created dynamically by
<a class="permalink" href="#rtredirect"><code class="Fn" id="rtredirect">rtredirect</code></a>().</dd>
<dt id="RTF_MODIFIED"><a class="permalink" href="#RTF_MODIFIED"><code class="Dv">RTF_MODIFIED</code></a></dt>
<dd>This route was modified by <code class="Fn">rtredirect</code>().</dd>
<dt id="RTF_DONE"><a class="permalink" href="#RTF_DONE"><code class="Dv">RTF_DONE</code></a></dt>
<dd>Used only in the <a class="Xr">route(4)</a> protocol, indicating that the
request was executed.</dd>
<dt id="RTF_XRESOLVE"><a class="permalink" href="#RTF_XRESOLVE"><code class="Dv">RTF_XRESOLVE</code></a></dt>
<dd>When this route is returned as a result of a lookup, send a report on the
<a class="Xr">route(4)</a> interface requesting that an external process
perform resolution for this route.</dd>
<dt id="RTF_STATIC"><a class="permalink" href="#RTF_STATIC"><code class="Dv">RTF_STATIC</code></a></dt>
<dd>Indicates that this route was manually added by means of the
<a class="Xr">route(8)</a> command.</dd>
<dt id="RTF_BLACKHOLE"><a class="permalink" href="#RTF_BLACKHOLE"><code class="Dv">RTF_BLACKHOLE</code></a></dt>
<dd>Requests that output sent via this route be discarded.</dd>
<dt id="RTF_PROTO1"><a class="permalink" href="#RTF_PROTO1"><code class="Dv">RTF_PROTO1</code></a></dt>
<dd style="width: auto;"> </dd>
<dt id="RTF_PROTO2"><a class="permalink" href="#RTF_PROTO2"><code class="Dv">RTF_PROTO2</code></a></dt>
<dd style="width: auto;"> </dd>
<dt id="RTF_PROTO3"><a class="permalink" href="#RTF_PROTO3"><code class="Dv">RTF_PROTO3</code></a></dt>
<dd>Protocol-specific.</dd>
<dt id="RTF_PINNED"><a class="permalink" href="#RTF_PINNED"><code class="Dv">RTF_PINNED</code></a></dt>
<dd>Indicates that this route is immutable to a routing protocol.</dd>
<dt id="RTF_LOCAL"><a class="permalink" href="#RTF_LOCAL"><code class="Dv">RTF_LOCAL</code></a></dt>
<dd>Indicates that the destination of this route is an address configured as
belonging to this system.</dd>
<dt id="RTF_BROADCAST"><a class="permalink" href="#RTF_BROADCAST"><code class="Dv">RTF_BROADCAST</code></a></dt>
<dd>Indicates that the destination is a broadcast address.</dd>
<dt id="RTF_MULTICAST"><a class="permalink" href="#RTF_MULTICAST"><code class="Dv">RTF_MULTICAST</code></a></dt>
<dd>Indicates that the destination is a multicast address.</dd>
</dl>
</div>
<p class="Pp">Several metrics are supplied in <var class="Vt">struct
rt_metrics</var> passed with routing control messages via
<a class="Xr">route(4)</a> API. Currently only
<var class="Vt">rmx_mtu</var>, <var class="Vt">rmx_expire</var>, and
<var class="Vt">rmx_pksent</var> metrics are supplied. All others are
ignored.</p>
<p class="Pp">The following metrics are defined by <var class="Vt">struct
rt_metrics</var>:</p>
<div class="Bd-indent">
<dl class="Bl-tag">
<dt><var class="Vt">u_long rmx_locks</var>;</dt>
<dd>Flag bits indicating which metrics the kernel is not permitted to
dynamically modify.</dd>
<dt><var class="Vt">u_long rmx_mtu</var>;</dt>
<dd>MTU for this path.</dd>
<dt><var class="Vt">u_long rmx_hopcount</var>;</dt>
<dd>Number of intermediate systems on the path to this destination.</dd>
<dt><var class="Vt">u_long rmx_expire</var>;</dt>
<dd>The time (a la <a class="Xr">time(3)</a>) at which this route should
expire, or zero if it should never expire. It is the responsibility of
individual protocol suites to ensure that routes are actually deleted once
they expire.</dd>
<dt id="from"><var class="Vt">u_long rmx_recvpipe</var>;</dt>
<dd>Nominally, the bandwidth-delay product for the path
<a class="permalink" href="#from"><i class="Em">from</i></a> the
destination
<a class="permalink" href="#to"><i class="Em" id="to">to</i></a> this
system. In practice, this value is used to set the size of the receive
buffer (and thus the window in sliding-window protocols like TCP).</dd>
<dt><var class="Vt">u_long rmx_sendpipe</var>;</dt>
<dd>As before, but in the opposite direction.</dd>
<dt><var class="Vt">u_long rmx_ssthresh</var>;</dt>
<dd>The slow-start threshold used in TCP congestion-avoidance.</dd>
<dt><var class="Vt">u_long rmx_rtt</var>;</dt>
<dd>The round-trip time to this destination, in units of
<code class="Dv">RMX_RTTUNIT</code> per second.</dd>
<dt><var class="Vt">u_long rmx_rttvar</var>;</dt>
<dd>The average deviation of the round-trip time to this destination, in units
of <code class="Dv">RMX_RTTUNIT</code> per second.</dd>
<dt><var class="Vt">u_long rmx_pksent</var>;</dt>
<dd>A count of packets successfully sent via this route.</dd>
<dt><var class="Vt">u_long rmx_filler[4]</var>;</dt>
<dd>Empty space available for protocol-specific information.</dd>
</dl>
</div>
</section>
<section class="Sh">
<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
ALSO</a></h1>
<p class="Pp"><a class="Xr">route(4)</a>, <a class="Xr">route(8)</a></p>
</section>
<section class="Sh">
<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1>
<p class="Pp">The <var class="Vt">rtentry</var> structure first appeared in
<span class="Ux">4.2BSD</span>. The radix-tree representation of the routing
table and the <var class="Vt">rt_metrics</var> structure first appeared in
<span class="Ux">4.3BSD-Reno</span>.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1>
<p class="Pp">This manual page was written by <span class="An">Garrett
Wollman</span>.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="BUGS"><a class="permalink" href="#BUGS">BUGS</a></h1>
<p class="Pp">There are a number of historical relics remaining in this
interface. The <var class="Va">rt_gateway</var> and
<var class="Va">rmx_filler</var> fields could be named better.</p>
</section>
</div>
<table class="foot">
<tr>
<td class="foot-date">March 5, 2014</td>
<td class="foot-os">FreeBSD 15.0</td>
</tr>
</table>
|