1996-10-08 20:25:39 +00:00
|
|
|
.\"
|
|
|
|
.\" Copyright 1996 Massachusetts Institute of Technology
|
|
|
|
.\"
|
|
|
|
.\" Permission to use, copy, modify, and distribute this software and
|
|
|
|
.\" its documentation for any purpose and without fee is hereby
|
|
|
|
.\" granted, provided that both the above copyright notice and this
|
|
|
|
.\" permission notice appear in all copies, that both the above
|
|
|
|
.\" copyright notice and this permission notice appear in all
|
|
|
|
.\" supporting documentation, and that the name of M.I.T. not be used
|
|
|
|
.\" in advertising or publicity pertaining to distribution of the
|
|
|
|
.\" software without specific, written prior permission. M.I.T. makes
|
|
|
|
.\" no representations about the suitability of this software for any
|
|
|
|
.\" purpose. It is provided "as is" without express or implied
|
|
|
|
.\" warranty.
|
2001-07-14 19:41:16 +00:00
|
|
|
.\"
|
1996-10-08 20:25:39 +00:00
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS
|
|
|
|
.\" ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
|
|
|
.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
|
|
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
|
|
|
|
.\" SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
|
|
|
.\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
|
|
.\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
|
|
.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
|
|
|
.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
1999-08-28 00:22:10 +00:00
|
|
|
.\" $FreeBSD$
|
2004-06-15 19:26:11 +00:00
|
|
|
.\"
|
This main goals of this project are:
1. separating L2 tables (ARP, NDP) from the L3 routing tables
2. removing as much locking dependencies among these layers as
possible to allow for some parallelism in the search operations
3. simplify the logic in the routing code,
The most notable end result is the obsolescent of the route
cloning (RTF_CLONING) concept, which translated into code reduction
in both IPv4 ARP and IPv6 NDP related modules, and size reduction in
struct rtentry{}. The change in design obsoletes the semantics of
RTF_CLONING, RTF_WASCLONE and RTF_LLINFO routing flags. The userland
applications such as "arp" and "ndp" have been modified to reflect
those changes. The output from "netstat -r" shows only the routing
entries.
Quite a few developers have contributed to this project in the
past: Glebius Smirnoff, Luigi Rizzo, Alessandro Cerri, and
Andre Oppermann. And most recently:
- Kip Macy revised the locking code completely, thus completing
the last piece of the puzzle, Kip has also been conducting
active functional testing
- Sam Leffler has helped me improving/refactoring the code, and
provided valuable reviews
- Julian Elischer setup the perforce tree for me and has helped
me maintaining that branch before the svn conversion
2008-12-15 06:10:57 +00:00
|
|
|
.Dd December 11, 2008
|
1996-10-08 20:25:39 +00:00
|
|
|
.Dt RTENTRY 9
|
2010-04-14 19:08:06 +00:00
|
|
|
.Os
|
1996-10-08 20:25:39 +00:00
|
|
|
.Sh NAME
|
|
|
|
.Nm rtentry
|
|
|
|
.Nd structure of an entry in the kernel routing table
|
|
|
|
.Sh SYNOPSIS
|
2001-10-01 16:09:29 +00:00
|
|
|
.In sys/types.h
|
|
|
|
.In sys/socket.h
|
|
|
|
.In net/route.h
|
1996-10-08 20:25:39 +00:00
|
|
|
.Sh DESCRIPTION
|
1996-12-01 00:25:06 +00:00
|
|
|
The kernel provides a common mechanism by which all protocols can store
|
2003-10-23 02:15:46 +00:00
|
|
|
and retrieve entries from a central table of routes.
|
|
|
|
Parts of this
|
1996-10-08 20:25:39 +00:00
|
|
|
mechanism are also used to interact with user-level processes by means
|
|
|
|
of a socket in the
|
|
|
|
.Xr route 4
|
|
|
|
pseudo-protocol family.
|
|
|
|
The
|
2003-09-08 19:57:22 +00:00
|
|
|
.In net/route.h
|
1996-10-08 20:25:39 +00:00
|
|
|
header file defines the structures and manifest constants used in this
|
|
|
|
facility.
|
|
|
|
.Pp
|
2002-03-14 18:43:09 +00:00
|
|
|
The basic structure of a route is defined by
|
2004-06-15 19:26:11 +00:00
|
|
|
.Vt "struct rtentry" ,
|
1996-10-08 20:25:39 +00:00
|
|
|
which includes the following fields:
|
|
|
|
.Bl -tag -offset indent -width 6n
|
2004-06-15 19:26:11 +00:00
|
|
|
.It Vt "struct radix_node rt_nodes[2]" ;
|
2003-10-23 02:15:46 +00:00
|
|
|
Glue used by the radix-tree routines.
|
|
|
|
These members also include in
|
1996-10-08 20:25:39 +00:00
|
|
|
their substructure the key (i.e., destination address) and mask used
|
2003-10-23 02:15:46 +00:00
|
|
|
when the route was created.
|
|
|
|
The
|
2004-06-15 19:26:11 +00:00
|
|
|
.Fn rt_key rt
|
1996-10-08 20:25:39 +00:00
|
|
|
and
|
2004-06-15 19:26:11 +00:00
|
|
|
.Fn rt_mask rt
|
1996-10-08 20:25:39 +00:00
|
|
|
macros can be used to extract this information (in the form of a
|
2004-06-15 19:26:11 +00:00
|
|
|
.Vt "struct sockaddr *" )
|
1996-10-08 20:25:39 +00:00
|
|
|
given a
|
2004-06-15 19:26:11 +00:00
|
|
|
.Vt "struct rtentry *" .
|
|
|
|
.It Vt "struct sockaddr *rt_gateway" ;
|
1996-10-08 20:25:39 +00:00
|
|
|
The
|
|
|
|
.Dq target
|
|
|
|
of the route, which can either represent a destination in its own
|
1996-12-01 00:25:06 +00:00
|
|
|
right (some protocols will put a link-layer address here), or some
|
1996-10-08 20:25:39 +00:00
|
|
|
intermediate stop on the way to that destination (if the
|
|
|
|
.Dv RTF_GATEWAY
|
|
|
|
flag is set).
|
This main goals of this project are:
1. separating L2 tables (ARP, NDP) from the L3 routing tables
2. removing as much locking dependencies among these layers as
possible to allow for some parallelism in the search operations
3. simplify the logic in the routing code,
The most notable end result is the obsolescent of the route
cloning (RTF_CLONING) concept, which translated into code reduction
in both IPv4 ARP and IPv6 NDP related modules, and size reduction in
struct rtentry{}. The change in design obsoletes the semantics of
RTF_CLONING, RTF_WASCLONE and RTF_LLINFO routing flags. The userland
applications such as "arp" and "ndp" have been modified to reflect
those changes. The output from "netstat -r" shows only the routing
entries.
Quite a few developers have contributed to this project in the
past: Glebius Smirnoff, Luigi Rizzo, Alessandro Cerri, and
Andre Oppermann. And most recently:
- Kip Macy revised the locking code completely, thus completing
the last piece of the puzzle, Kip has also been conducting
active functional testing
- Sam Leffler has helped me improving/refactoring the code, and
provided valuable reviews
- Julian Elischer setup the perforce tree for me and has helped
me maintaining that branch before the svn conversion
2008-12-15 06:10:57 +00:00
|
|
|
.It Vt "int rt_flags" ;
|
1996-10-08 20:25:39 +00:00
|
|
|
See below.
|
This main goals of this project are:
1. separating L2 tables (ARP, NDP) from the L3 routing tables
2. removing as much locking dependencies among these layers as
possible to allow for some parallelism in the search operations
3. simplify the logic in the routing code,
The most notable end result is the obsolescent of the route
cloning (RTF_CLONING) concept, which translated into code reduction
in both IPv4 ARP and IPv6 NDP related modules, and size reduction in
struct rtentry{}. The change in design obsoletes the semantics of
RTF_CLONING, RTF_WASCLONE and RTF_LLINFO routing flags. The userland
applications such as "arp" and "ndp" have been modified to reflect
those changes. The output from "netstat -r" shows only the routing
entries.
Quite a few developers have contributed to this project in the
past: Glebius Smirnoff, Luigi Rizzo, Alessandro Cerri, and
Andre Oppermann. And most recently:
- Kip Macy revised the locking code completely, thus completing
the last piece of the puzzle, Kip has also been conducting
active functional testing
- Sam Leffler has helped me improving/refactoring the code, and
provided valuable reviews
- Julian Elischer setup the perforce tree for me and has helped
me maintaining that branch before the svn conversion
2008-12-15 06:10:57 +00:00
|
|
|
.It Vt "int rt_refcnt" ;
|
|
|
|
Route entries are reference-counted; this field indicates the number
|
|
|
|
of external (to the radix tree) references.
|
2004-06-15 19:26:11 +00:00
|
|
|
.It Vt "struct ifnet *rt_ifp" ;
|
|
|
|
.It Vt "struct ifaddr *rt_ifa" ;
|
1996-10-08 20:25:39 +00:00
|
|
|
These two fields represent the
|
|
|
|
.Dq 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.
|
2004-10-08 09:57:12 +00:00
|
|
|
.It Vt "struct rt_metrics_lite rt_rmx" ;
|
|
|
|
See below.
|
2008-12-15 07:51:59 +00:00
|
|
|
If the
|
2004-10-08 09:57:12 +00:00
|
|
|
.Dv RTF_UP
|
|
|
|
flag is not present, the
|
|
|
|
.Fn rtfree
|
|
|
|
function will delete the route from the radix tree when the last
|
|
|
|
reference drops.
|
2004-06-15 19:26:11 +00:00
|
|
|
.It Vt "struct rtentry *rt_gwroute" ;
|
1996-10-08 20:25:39 +00:00
|
|
|
This member is a reference to a route whose destination is
|
2004-06-15 19:26:11 +00:00
|
|
|
.Va rt_gateway .
|
1996-10-08 20:25:39 +00:00
|
|
|
It is only used for
|
|
|
|
.Dv RTF_GATEWAY
|
|
|
|
routes.
|
2004-10-08 09:57:12 +00:00
|
|
|
.It Vt "struct mtx rt_mtx" ;
|
|
|
|
Mutex to lock this routing entry.
|
1996-10-08 20:25:39 +00:00
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
The following flag bits are defined:
|
2004-10-08 09:57:12 +00:00
|
|
|
.Bl -tag -offset indent -width ".Dv RTF_BLACKHOLE" -compact
|
1996-10-08 20:25:39 +00:00
|
|
|
.It Dv RTF_UP
|
|
|
|
The route is not deleted.
|
|
|
|
.It Dv RTF_GATEWAY
|
|
|
|
The route points to an intermediate destination and not the ultimate
|
|
|
|
recipient; the
|
2004-06-15 19:26:11 +00:00
|
|
|
.Va rt_gateway
|
1996-10-08 20:25:39 +00:00
|
|
|
and
|
2004-06-15 19:26:11 +00:00
|
|
|
.Va rt_gwroute
|
1996-10-08 20:25:39 +00:00
|
|
|
fields name that destination.
|
|
|
|
.It Dv RTF_HOST
|
|
|
|
This is a host route.
|
|
|
|
.It Dv RTF_REJECT
|
2003-10-23 02:15:46 +00:00
|
|
|
The destination is presently unreachable.
|
|
|
|
This should result in an
|
1996-10-08 20:25:39 +00:00
|
|
|
.Er EHOSTUNREACH
|
|
|
|
error from output routines.
|
|
|
|
.It Dv RTF_DYNAMIC
|
|
|
|
This route was created dynamically by
|
|
|
|
.Fn rtredirect .
|
|
|
|
.It Dv RTF_MODIFIED
|
|
|
|
This route was modified by
|
|
|
|
.Fn rtredirect .
|
|
|
|
.It Dv RTF_DONE
|
|
|
|
Used only in the
|
|
|
|
.Xr route 4
|
|
|
|
protocol, indicating that the request was executed.
|
|
|
|
.It Dv RTF_XRESOLVE
|
|
|
|
When this route is returned as a result of a lookup, send a report on
|
|
|
|
the
|
|
|
|
.Xr route 4
|
|
|
|
interface requesting that an external process perform resolution for
|
2004-05-05 10:47:19 +00:00
|
|
|
this route.
|
1996-10-08 20:25:39 +00:00
|
|
|
.It Dv RTF_STATIC
|
|
|
|
Indicates that this route was manually added by means of the
|
|
|
|
.Xr route 8
|
|
|
|
command.
|
|
|
|
.It Dv RTF_BLACKHOLE
|
|
|
|
Requests that output sent via this route be discarded.
|
|
|
|
.It Dv RTF_PROTO1
|
|
|
|
.It Dv RTF_PROTO2
|
|
|
|
.It Dv RTF_PROTO3
|
|
|
|
Protocol-specific.
|
|
|
|
.It Dv RTF_PRCLONING
|
2004-10-08 09:57:12 +00:00
|
|
|
This flag is obsolete and simply ignored by facility.
|
1996-10-08 20:25:39 +00:00
|
|
|
.It Dv RTF_PINNED
|
|
|
|
(Reserved for future use to indicate routes which are not to be
|
|
|
|
modified by a routing protocol.)
|
|
|
|
.It Dv RTF_LOCAL
|
|
|
|
Indicates that the destination of this route is an address configured
|
|
|
|
as belonging to this system.
|
|
|
|
.It Dv RTF_BROADCAST
|
|
|
|
Indicates that the destination is a broadcast address.
|
|
|
|
.It Dv RTF_MULTICAST
|
|
|
|
Indicates that the destination is a multicast address.
|
|
|
|
.El
|
|
|
|
.Pp
|
2004-10-08 09:57:12 +00:00
|
|
|
Every route has associated with it a set of metrics, stored in
|
|
|
|
.Vt "struct rt_metrics_lite" .
|
|
|
|
Metrics are supplied in
|
|
|
|
.Vt "struct rt_metrics"
|
|
|
|
passed with routing control messages via
|
|
|
|
.Xr route 4
|
|
|
|
API.
|
|
|
|
Currently only
|
|
|
|
.Vt rmx_mtu , rmx_expire ,
|
|
|
|
and
|
|
|
|
.Vt rmx_pksent
|
|
|
|
metrics are used in
|
2005-01-02 18:20:29 +00:00
|
|
|
.Vt "struct rt_metrics_lite" .
|
2004-10-08 09:57:12 +00:00
|
|
|
All others are ignored.
|
|
|
|
.Pp
|
|
|
|
The following metrics are defined by
|
2004-06-15 19:26:11 +00:00
|
|
|
.Vt "struct rt_metrics" :
|
1996-10-08 20:25:39 +00:00
|
|
|
.Bl -tag -offset indent -width 6n
|
2004-06-15 19:26:11 +00:00
|
|
|
.It Vt "u_long rmx_locks" ;
|
1996-10-08 20:25:39 +00:00
|
|
|
Flag bits indicating which metrics the kernel is not permitted to
|
|
|
|
dynamically modify.
|
2004-06-15 19:26:11 +00:00
|
|
|
.It Vt "u_long rmx_mtu" ;
|
1996-10-08 20:25:39 +00:00
|
|
|
MTU for this path.
|
2004-06-15 19:26:11 +00:00
|
|
|
.It Vt "u_long rmx_hopcount" ;
|
1996-10-08 20:25:39 +00:00
|
|
|
Number of intermediate systems on the path to this destination.
|
2004-06-15 19:26:11 +00:00
|
|
|
.It Vt "u_long rmx_expire" ;
|
2001-07-14 19:41:16 +00:00
|
|
|
The time
|
2000-12-29 09:18:45 +00:00
|
|
|
(a la
|
1999-08-16 22:11:19 +00:00
|
|
|
.Xr time 3 )
|
1996-10-08 20:25:39 +00:00
|
|
|
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.
|
2004-06-15 19:26:11 +00:00
|
|
|
.It Vt "u_long rmx_recvpipe" ;
|
2001-07-14 19:41:16 +00:00
|
|
|
Nominally, the bandwidth-delay product for the path
|
1996-10-08 20:25:39 +00:00
|
|
|
.Em from
|
|
|
|
the destination
|
|
|
|
.Em to
|
2003-10-23 02:15:46 +00:00
|
|
|
this system.
|
|
|
|
In practice, this value is used to set the size of the
|
1996-10-08 20:25:39 +00:00
|
|
|
receive buffer (and thus the window in sliding-window protocols like
|
|
|
|
.Tn TCP ) .
|
2004-06-15 19:26:11 +00:00
|
|
|
.It Vt "u_long rmx_sendpipe" ;
|
1996-10-08 20:25:39 +00:00
|
|
|
As before, but in the opposite direction.
|
2004-06-15 19:26:11 +00:00
|
|
|
.It Vt "u_long rmx_ssthresh" ;
|
1996-10-08 20:25:39 +00:00
|
|
|
The slow-start threshold used in
|
|
|
|
.Tn TCP
|
|
|
|
congestion-avoidance.
|
2004-06-15 19:26:11 +00:00
|
|
|
.It Vt "u_long rmx_rtt" ;
|
1996-10-08 20:25:39 +00:00
|
|
|
The round-trip time to this destination, in units of
|
|
|
|
.Dv RMX_RTTUNIT
|
|
|
|
per second.
|
2004-06-15 19:26:11 +00:00
|
|
|
.It Vt "u_long rmx_rttvar" ;
|
2007-08-05 07:38:09 +00:00
|
|
|
The average deviation of the round-trip time to this destination, in
|
1996-10-08 20:25:39 +00:00
|
|
|
units of
|
|
|
|
.Dv RMX_RTTUNIT
|
|
|
|
per second.
|
2004-06-15 19:26:11 +00:00
|
|
|
.It Vt "u_long rmx_pksent" ;
|
1996-10-08 20:25:39 +00:00
|
|
|
A count of packets successfully sent via this route.
|
2004-06-15 19:26:11 +00:00
|
|
|
.It Vt "u_long rmx_filler[4]" ;
|
1996-10-08 20:25:39 +00:00
|
|
|
.\" XXX badly named
|
|
|
|
Empty space available for protocol-specific information.
|
|
|
|
.El
|
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr route 4 ,
|
|
|
|
.Xr route 8 ,
|
|
|
|
.Xr rtalloc 9
|
|
|
|
.Sh HISTORY
|
|
|
|
The
|
2004-06-15 19:26:11 +00:00
|
|
|
.Vt rtentry
|
1996-10-08 20:25:39 +00:00
|
|
|
structure first appeared in
|
|
|
|
.Bx 4.2 .
|
|
|
|
The radix-tree representation of the routing table and the
|
2004-06-15 19:26:11 +00:00
|
|
|
.Vt rt_metrics
|
1998-06-24 13:30:25 +00:00
|
|
|
structure first appeared in
|
1996-10-08 20:38:28 +00:00
|
|
|
.Bx 4.3 reno .
|
2005-01-21 08:36:40 +00:00
|
|
|
.Sh AUTHORS
|
|
|
|
This manual page was written by
|
|
|
|
.An Garrett Wollman .
|
1996-10-08 20:25:39 +00:00
|
|
|
.Sh BUGS
|
|
|
|
There are a number of historical relics remaining in this interface.
|
|
|
|
The
|
2004-06-15 19:26:11 +00:00
|
|
|
.Va rt_gateway
|
1996-10-08 20:25:39 +00:00
|
|
|
and
|
2004-06-15 19:26:11 +00:00
|
|
|
.Va rmx_filler
|
1996-10-08 20:25:39 +00:00
|
|
|
fields could be named better.
|