---
name: "rtentry"
section: "9"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["linux", "freebsd"]
url: "https://new.carta.tech/rtentry"
---

# rtentry(9)

structure of an entry in the kernel routing table

## NAME

**rtentry** – structure of an entry in the kernel routing table

## SYNOPSIS

**#include \<sys/types.h\>**

**#include \<sys/socket.h\>**

**#include \<net/route.h\>**

## DESCRIPTION

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 [route(4)](/route/4.md) pseudo-protocol family. The ⟨net/route.h⟩ header file defines the structures and manifest constants used in this facility.

The basic structure of a route is defined by *struct rtentry*, which includes the following fields:

- *struct radix\_node rt\_nodes\[2\]*;

  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 **rt\_key**(*rt*) and **rt\_mask**(*rt*) macros can be used to extract this information (in the form of a *struct sockaddr \**) given a *struct rtentry \**.

- *struct nhop\_object \*rt\_nhop*;

  The [nhop(9)](/nhop/9.md) of the route, which can either a single nexthop or a nexthop group. A nexthop can be a directly connected destination (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).

- *int rt\_flags*;

  See below. If the RTF\_UP flag is not present, the **rtfree**() function will delete the route from the radix tree when the last reference drops.

- *u\_long rt\_weight*;

  See description of rmx\_weight below.

The following flag bits are defined:

- RTF\_UP

  The route is not deleted.

- RTF\_GATEWAY

  The route points to an intermediate destination and not the ultimate recipient; the *rt\_gateway* and *rt\_gwroute* fields name that destination.

- RTF\_HOST

  This is a host route.

- RTF\_REJECT

  The destination is presently unreachable. This should result in an EHOSTUNREACH error from output routines.

- RTF\_DYNAMIC

  This route was created dynamically by **rtredirect**().

- RTF\_MODIFIED

  This route was modified by **rtredirect**().

- RTF\_DONE

  Used only in the [route(4)](/route/4.md) protocol, indicating that the request was executed.

- RTF\_XRESOLVE

  When this route is returned as a result of a lookup, send a report on the [route(4)](/route/4.md) interface requesting that an external process perform resolution for this route.

- RTF\_STATIC

  Indicates that this route was manually added by means of the [route(8)](/route/8.md) command.

- RTF\_BLACKHOLE

  Requests that output sent via this route be discarded.

- RTF\_PROTO1

  - RTF\_PROTO2

  - RTF\_PROTO3

  Protocol-specific.

- RTF\_PINNED

  Indicates that this route is immutable to a routing protocol.

- RTF\_LOCAL

  Indicates that the destination of this route is an address configured as belonging to this system.

- RTF\_BROADCAST

  Indicates that the destination is a broadcast address.

- RTF\_MULTICAST

  Indicates that the destination is a multicast address.

Several metrics are supplied in *struct rt\_metrics* passed with routing control messages via [route(4)](/route/4.md) API. Currently only *rmx\_mtu*, *rmx\_expire*, and *rmx\_pksent* metrics are supplied. All others are ignored.

The following metrics are defined by *struct rt\_metrics*:

- *u\_long rmx\_locks*;

  Flag bits indicating which metrics the kernel is not permitted to dynamically modify.

- *u\_long rmx\_mtu*;

  MTU for this path.

- *u\_long rmx\_hopcount*;

  Number of intermediate systems on the path to this destination.

- *u\_long rmx\_expire*;

  The time (a la [time(3)](/time/3.md)) 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.

- *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).

- *u\_long rmx\_sendpipe*;

  As before, but in the opposite direction.

- *u\_long rmx\_ssthresh*;

  The slow-start threshold used in TCP congestion-avoidance.

- *u\_long rmx\_rtt*;

  The round-trip time to this destination, in units of RMX\_RTTUNIT per second.

- *u\_long rmx\_rttvar*;

  The average deviation of the round-trip time to this destination, in units of RMX\_RTTUNIT per second.

- *u\_long rmx\_pksent*;

  A count of packets successfully sent via this route.

- *u\_long rmx\_weight*;

  The weight of nexthop in multipath route.

- *u\_long rmx\_nhidx*;

  The kernel index of route nexthop.

- *u\_long rmx\_metric*;

  The metric of the route, the lowest value wins.

- *u\_long rmx\_filler\[1\]*;

  Empty space available for protocol-specific information.

## SEE ALSO

[route(4)](/route/4.md), [route(8)](/route/8.md), [nhop(9)](/nhop/9.md)

## HISTORY

The *rtentry* structure first appeared in 4.2BSD. The radix-tree representation of the routing table and the *rt\_metrics* structure first appeared in 4.3BSD-reno.

## AUTHORS

This manual page was written by Garrett Wollman.
