routing(6) TCP/IP R4.11 routing(6)
NAME
routing - network packet routing
SYNOPSIS
#include <net/route.h>
DESCRIPTION
The network facilities provide limited packet routing. A simple set
of data structures comprise a "routing table" used in selecting the
appropriate network interface when transmitting packets. This table
contains a single entry for each route to a specific network or host.
A user program, route(1M), allows the operator to configure this
database with the aid of two socket specific ioctl(2), commands,
SIOCADDRT and SIOCDELRT. The commands allow the addition and
deletion of a single routing table entry, respectively. Routing
table manipulations may be carried out only by a user with the
appropriate privilege. On a generic DG/UX system, appropriate
privilege is granted by having an effective UID of 0 (root). See the
appropriateprivilege(5) man page for more information.
On a system with DG/UX information security, appropriate privilege is
granted by having one or more specific capabilities enabled in the
effective capability set of the user. See the capdefaults(5) man
page for the default capabilities for this command.
A routing table entry has the following form, as defined in
net/route.h;
struct rtentry {
struct sockaddr rtdst;
struct sockaddr rtgateway;
short rtflags;
};
with rtflags defined from the following:
RTF_UP route useable
RTF_GATEWAY destination is a gateway
RTF_HOST host entry (net otherwise)
RTF_DYNAMIC created dynamically (by redirect)
RTF_MODIFIED modified dynamically (by redirect)
RTF_STATIC manaully added route
Routing table entries come in three flavors: for a specific host, for
all hosts on a specific network, and for any other destination not
matched by entries of the first two types (a wildcard route). When
an interface is started, it installs a routing table entry.
Normally, the interface specifies that the route coming through it is
a "direct" connection to the destination host or network. If the
route is direct, the transport layer of a protocol family usually
requests that the packet be sent to the same host specified in the
packet. Otherwise, the interface may be requested to address the
packet to an entity different from the eventual recipient (that is,
the packet is forwarded).
The routing code returns EEXIST if requested to duplicate an existing
entry, ESRCH if requested to delete a non-existent entry, ENOMEM if
insufficient resources were available to install a new route, or
ENETUNREACH if the gateway specified is not on the same network as
the host system.
The routing policy for transmitting packets is as follows:
1) When a single host route exists, it is used. When multiple
host routes exist, the first route entry found is used.
2) When host routes don't exist, but a network route does, then
the network route is used. When multiple network routes
exist, the first route entry found is used.
3) When neither host nor network routes exist, but a wildcard
route exists, then the wildcard route is used.
4) When host, network, and wildcard routes don't exist, the
packet cannot be routed and is dropped.
A wildcard routing entry is specified with a zero destination address
value. Wildcard routes are used only when the system fails to find a
route to the destination host and network. The combination of
wildcard routes and routing redirects can provide an economical
mechanism for routing traffic.
SEE ALSO
ioctl(2), socket(2), appropriateprivilege(5).
Licensed material--property of copyright holder(s)