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 softwar...
NAMErtentry - structure of an entry in the kernel routing table
SYNOPSISIn sys/types.h In sys/socket.h In net/route.h
DESCRIPTIONThe 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 route(4) pseudo-protocol family. The In net/route.h header file defines the structures and manifest constants used in this facility.
The basic structure of a route is defined by Vt struct rtentry , which includes the following fields:
- Vt struct radix_node rt_nodes
- 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 Fn rt_key rt and Fn rt_mask rt macros can be used to extract this information (in the form of a Vt struct sockaddr * ) given a Vt struct rtentry * .
- Vt struct sockaddr *rt_gateway
- 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 RTF_GATEWAY flag is set).
- Vt int rt_flags
- See below. If the RTF_UP flag is not present, the Fn rtfree function will delete the route from the radix tree when the last reference drops.
- Vt int rt_refcnt
- Route entries are reference-counted; this field indicates the number of external (to the radix tree) references.
- Vt struct ifnet *rt_ifp
- Vt struct ifaddr *rt_ifa
- 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.
- Vt u_long rt_mtu;
- See description of rmx_mtu below.
- Vt u_long rt_weight;
- See description of rmx_weight below.
- Vt u_long rt_expire;
- See description of rmx_expire below.
- Vt counter64_t rt_pksent;
- See description of rmx_pksent below.
- Vt struct rtentry *rt_gwroute
- This member is a reference to a route whose destination is rt_gateway It is only used for RTF_GATEWAY routes.
- Vt struct mtx rt_mtx
- Mutex to lock this routing entry.
The following flag bits are defined:
- The route is not deleted.
- The route points to an intermediate destination and not the ultimate recipient; the rt_gateway and rt_gwroute fields name that destination.
- This is a host route.
- The destination is presently unreachable. This should result in an Er EHOSTUNREACH error from output routines.
- This route was created dynamically by Fn rtredirect .
- This route was modified by Fn rtredirect .
- Used only in the route(4) protocol, indicating that the request was executed.
- When this route is returned as a result of a lookup, send a report on the route(4) interface requesting that an external process perform resolution for this route.
- Indicates that this route was manually added by means of the route(8) command.
- Requests that output sent via this route be discarded.
- (Reserved for future use to indicate routes which are not to be modified by a routing protocol.)
- Indicates that the destination of this route is an address configured as belonging to this system.
- Indicates that the destination is a broadcast address.
- Indicates that the destination is a multicast address.
Several metrics are supplied in Vt struct rt_metrics passed with routing control messages via route(4) API. Currently only Vt rmx_mtu , rmx_expire , and Vt rmx_pksent metrics are supplied. All others are ignored.
The following metrics are defined by Vt struct rt_metrics :
- Vt u_long rmx_locks
- Flag bits indicating which metrics the kernel is not permitted to dynamically modify.
- Vt u_long rmx_mtu
- MTU for this path.
- Vt u_long rmx_hopcount
- Number of intermediate systems on the path to this destination.
- Vt u_long rmx_expire
- The time (a la time(3)) 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.
- Vt u_long rmx_recvpipe
- Nominally, the bandwidth-delay product for the path from the destination to 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 )
- Vt u_long rmx_sendpipe
- As before, but in the opposite direction.
- Vt u_long rmx_ssthresh
- The slow-start threshold used in TCP congestion-avoidance.
- Vt u_long rmx_rtt
- The round-trip time to this destination, in units of RMX_RTTUNIT per second.
- Vt u_long rmx_rttvar
- The average deviation of the round-trip time to this destination, in units of RMX_RTTUNIT per second.
- Vt u_long rmx_pksent
- A count of packets successfully sent via this route.
- Vt u_long rmx_filler
- Empty space available for protocol-specific information.