1routing(7P)                        Protocols                       routing(7P)
2
3
4

NAME

6       routing - system support for packet network routing
7

DESCRIPTION

9       The  network  facilities  provide  general  packet routing. The routing
10       interface described here can be used  to  maintain  the  system's  IPv4
11       routing  table.  It  has  been  maintained for compatibility with older
12       applications. The recommended interface for  maintaining  the  system's
13       routing tables is the routing socket, described at route(7P). The rout‐
14       ing socket can be used to manipulate both the  IPv4  and  IPv6  routing
15       tables  of  the system. Routing table maintenance may be implemented in
16       applications processes.
17
18
19       A simple set of data structures  compose  a  "routing  table"  used  in
20       selecting  the appropriate network interface when transmitting packets.
21       This table contains a single entry for each route to a specific network
22       or  host.  The  routing  table  was designed to support routing for the
23       Internet Protocol (IP), but its implementation is protocol  independent
24       and thus it may serve other protocols as well. User programs may manip‐
25       ulate this data base with the aid of two ioctl(2)  commands,  SIOCADDRT
26       and SIOCDELRT. These commands allow the addition and deletion of a sin‐
27       gle routing table entry, respectively. Routing table manipulations  may
28       only be carried out by privileged user.
29
30
31       A   routing   table  entry  has  the  following  form,  as  defined  in
32       /usr/include/net/route.h:
33
34         struct rtentry {
35                 unit_t   rt_hash;               /* to speed lookups */
36                 struct  sockaddr rt_dst;        /* key */
37                 struct  sockaddr rt_gateway;    /* value */
38                 short   rt_flags;               /* up/down?, host/net */
39                 short   rt_refcnt;              /* # held references */
40                 unit_t   rt_use;                /* raw # packets forwarded */
41         /*
42          * The kernel does not use this field, and without it the structure is
43          * datamodel independent.
44          */
45         #if !defined(_KERNEL)
46                 struct  ifnet *rt_ifp;          /* the answer: interface to use */
47         #endif                                  /* !defined(_KERNEL) */
48         };
49
50
51
52       with rt_flags defined from:
53
54         #define RTF_UP 0x1         /* route usable */
55         #define RTF_GATEWAY 0x2    /* destination is a gateway */
56         #define RTF_HOST 0x4       /* host entry (net otherwise) */
57
58
59
60       There are three types of routing table entries: those  for  a  specific
61       host,  those  for  all  hosts  on a specific network, and those for any
62       destination not matched by entries of the first  two  types,  called  a
63       wildcard  route.  Each network interface installs a routing table entry
64       when  it is initialized. Normally the interface specifies if the  route
65       through it is a "direct" connection to the destination host or network.
66       If the route is direct, the transport layer of a protocol  family  usu‐
67       ally  requests  the  packet  be  sent to the same host specified in the
68       packet. Otherwise, the interface may be requested to address the packet
69       to  an  entity  different from the eventual recipient; essentially, the
70       packet is forwarded.
71
72
73       Routing table entries installed by a user process may not  specify  the
74       hash, reference count, use, or interface fields; these are filled in by
75       the routing routines. If a route is in use when it is deleted,  meaning
76       its rt_refcnt is non-zero, the resources associated with it will not be
77       reclaimed until all references to it are removed.
78
79
80       User processes read the routing tables through the /dev/ip device.
81
82
83       The rt_use field contains the number of packets sent along  the  route.
84       This value is used to select among multiple routes to the same destina‐
85       tion. When multiple routes to the same  destination  exist,  the  least
86       used route is selected.
87
88
89       A  wildcard routing entry is specified with a  zero destination address
90       value. Wildcard routes are used only when the system fails  to  find  a
91       route  to the destination host and network. The combination of wildcard
92       routes and routing redirects can provide an  economical  mechanism  for
93       routing traffic.
94

ERRORS

96       EEXIST         A request was made to duplicate an existing entry.
97
98
99       ESRCH          A request was made to delete a non-existent entry.
100
101
102       ENOBUFS        Insufficient  resources  were available to install a new
103                      route.
104
105
106       ENOMEM         Insufficient resources were available to install  a  new
107                      route.
108
109
110       ENETUNREACH    The  gateway is not directly reachable.  For example, it
111                      does not match the destination/subnet on any of the net‐
112                      work interfaces.
113
114

FILES

116       /dev/ip    IP device driver
117
118

SEE ALSO

120       route(1M), ioctl(2), route(7P)
121
122
123
124SunOS 5.11                        9 Nov 1999                       routing(7P)
Impressum