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