*** UNIX MANUAL PAGE BROWSER ***

A Nergahak database for man pages research.

Navigation

Directory Browser

1Browse 4.4BSD4.4BSD
1Browse Digital UNIXDigital UNIX 4.0e
1Browse FreeBSDFreeBSD 14.3
1Browse MINIXMINIX 3.4.0rc6-d5e4fc0
1Browse NetBSDNetBSD 10.1
1Browse OpenBSDOpenBSD 7.7
1Browse UNIX v7Version 7 UNIX
1Browse UNIX v10Version 10 UNIX

Manual Page Search

Manual Page Result

0 Command: route | Section: 7 | Source: Digital UNIX | File: route.7.gz
route(7) Miscellaneous Information Manual route(7) NAME route - Kernel packet forwarding database SYNOPSIS #include <sys/socket.h> #include <net/if.h> #include <net/route.h> int family s = socket(PF_ROUTE, SOCK_RAW, family); DESCRIPTION The UNIX operating system provides packet routing facilities. The ker- nel maintains a routing information database, which is used in select- ing the appropriate network interface when transmitting packets. A user process (or possibly multiple cooperating processes) maintains this database by sending messages over a special kind of socket. Rout- ing table changes may only be carried out by the superuser. The operating system may spontaneously emit routing messages in re- sponse to external events, such as receipt of a redirect, or failure to locate a suitable route for a request. Routing database entries are of two types: those for a specific host, and those for all hosts on a generic subnetwork (as specified by a bit mask and value under the mask). The effect of a wildcard or default route may be achieved by using a mask of all zeros. There may be hier- archical routes. When the system is booted and addresses are assigned to the network in- terfaces, each protocol family installs a routing table entry for each interface when it is ready for traffic. Normally the protocol speci- fies the route through each interface as 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 host specified in the packet. Otherwise, the interface is re- quested to address the packet to the gateway listed in the routing en- try (that is, the packet is forwarded). When routing a packet, the kernel first attempts to find a route to the destination host. Failing that, a search is made for a route to the network of the destination. Finally, any route to a default (wildcard) gateway is chosen. If no entry is found, the destination is declared to be unreachable, and an error message is generated if there are any listeners on the routing control socket described later in this sec- tion. 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. To open the channel for passing routing control messages, use the socket call shown in the SYNOPSIS section. The family parameter may be AF_UNSPEC which will provide routing infor- mation for all address families, or can be restricted to a specific ad- dress family by specifying which one is desired. There can be more than one routing socket open per system. Messages are formed by a header followed by a small number of sockaddrs (now variable length), interpreted by position, and delimited by the new length entry in the sockaddr. An example of a message with four addresses might be an ISO redirect: destination, netmask, gateway, and author of the redirect. The interpretation of which addresses are present is given by a bit mask within the header, and the sequence is least significant to most significant bit within the vector. Any messages sent to the kernel are returned, and copies are sent to all interested listeners. The kernel will provide the process ID for the sender, and the sender may use an additional sequence field to dis- tinguish between outstanding messages. However, message replies may be lost when kernel buffers are exhausted. The kernel may reject certain messages, and will indicate this by fill- ing in the rtm_errno field. In the current implementation, all routing process run locally, and the values for rtm_errno are available through the normal errno mechanism, even if the routing reply message is lost. A process may avoid the expense of reading replies to its own messages by issuing a setsockopt() call indicating that the SO_USELOOPBACK op- tion at the SOL_SOCKET level is to be turned off. A process may ignore all messages from the routing socket by shutting down further input with the shutdown() function. If a route is in use when it is deleted, the routing entry will be marked down and removed from the routing table, but the resources asso- ciated with it will not be reclaimed until all references to it are re- leased. User processes can obtain information about the routing entry to a specific destination by using a RTM_GET message, or by reading the /dev/kmem device. ERRORS If messages are rejected, rtm_errno may be set to one of the following values: The entry to be created already exists. The entry to be deleted does not exist. Insufficient resources were available to in- stall a new route. delim off route(7)

Navigation Options