The SCO TCP/IP start/stop script, tcp(ADMN), starts and stops the routed daemon when a STARTDAEMONx/STOPDAEMONx variable pair is set to /etc/routed in the tcp(SFF) configuration file (/etc/default/tcp).
In normal operation, routed listens on the udp(ADMP) socket 520 (decimal) to provide the route service (see services(SFF)) for routing information packets. If the host is an internetwork router, it periodically supplies copies of its Routing Tables to any directly connected hosts and networks.
When routed is started, it uses the SIOCGIFCONF ioctl(S) to find those directly connected interfaces configured into the system and ``marked up'' (the software loopback interface will be ignored). If multiple interfaces are present and the kernel variable ipforwarding is set, it is assumed that the host will forward packets between networks. Then routed transmits a REQUEST packet on each interface (using a broadcast packet if the interface supports it) and enters a loop, listening for REQUEST and RESPONSE packets from other hosts.
When a REQUEST packet is received, routed formulates a reply based on the information maintained in its internal tables. The generated RESPONSE packet contains a list of known routes, each marked with a ``hop count'' metric (a count of 16, or greater, is considered ``infinite''). The metric associated with each route returned provides a metric ``relative to the sender''.
Any RESPONSE packets received by routed are used to update the Routing Tables if one of the following conditions is satisfied:
In addition to processing incoming packets, routed also checks the Routing Table entries periodically. If an entry has not been updated for 3 minutes, this entry's metric is set to infinity and marked for deletion. Deletions are delayed for an additional 60 seconds to insure the invalidation is propagated throughout the local internet.
Any hosts acting as internetwork routers gratuitously supply their routing tables every 30 seconds to all directly connected hosts and networks. The response is sent to the broadcast address on nets capable of that function, to the destination address on point-to-point links, and to the router's own address on other networks. The normal Routing Tables are bypassed when sending gratuitous responses. The reception of responses on each network is used to determine that the network and interfaces are functioning correctly. If no response is received on an interface, another route may be chosen to route around the interface, or the route may be dropped if no alternative route is available.
For details on the kernel variables ipforwarding and ipsendredirects, see ``Internet Protocol (IP) parameters'' in the Performance Guide.
Any other argument supplied is interpreted as the name of a file in which routed's actions should be logged. This log contains information about any changes to the Routing Tables and -- if not tracing all packets -- a history of recent messages sent and received which are related to the changed route.
In addition to the facilities described above, routed supports the notion of ``distant'' passive and active gateways. When routed is started up, it reads the file /etc/gateways to find gateways which may not be located using only information from the SIOCGIFCONF ioctl. Gateways specified in this manner should be marked passive if they are not expected to exchange routing information, while gateways marked active should be willing to exchange routing information (i.e., they should have a routed process running on the machine). Routes through passive gateways will be installed in the kernel's routing tables once upon startup. Such routes are not included in any routing information transmitted. The active gateways will be treated the same as network interfaces. Routing information will be distributed to the gateway; if no routing information is received for a period of time, the associated route will be deleted. External gateways are also passive, but will not be placed into the kernel Routing Table nor will they be included in the routing updates. The function of these external entries is to inform routed that another routing process will install such a route and that alternate routes to that destination should not be installed. Such entries are required only when both routers may learn of routes to the same destination.
The /etc/gateways table consists of a series of lines, each of the following format:
<net | host> name1 gateway name2 metric value < passive | active | external>where:
In addition, routed should listen to any ``intelligent interfaces'' (such as an IMP) and to error protocols (such as ICMP). For example, routed should listen for any ``redirects'' included with ICMP packets received via a raw socket where these ICMP ``redirects'' will cause changed or added routes.
If the value of metric is greater than 9, it will be
interpreted as a netmask.
For example, the old form of the command which specifies a metric
route add default gateway 16
should be replaced by:
route add -hopcount 16 default gateway