[comp.protocols.tcp-ip] BSD "routed" & gateways query

beau@ultra.UUCP (Beau James {Manager - SW Development - Ultra Networks}) (09/14/89)

I'd appreciate any insight available from those who are more
familiar with the internals of the BSD routing daemon than I.
My questions are based on the 4.3BSD-tahoe network release
sources, although the same problem occurs with the binary
releases of SunOS though 4.0.3.

The routing daemon provides the /etc/gateways file as a
mechanism for declaring routes to host machines or networks
via gateways that do not participate in the BSD routing protocol
(passive gateways) or that can participate, but can't be located
via broadcast (active gateways).  Information about passive
gateways is not redistributed by the routing daemon; active
gateways are redistributed.

Question 1: What is the benefit of hiding passive gateways
		from users on the "internal" net?

		The code comments that "internal machines should
		use the default route to a suitable gateway (like
		us)".  But that means that the internal machines
		will forward ALL traffic to otherwise-unreachable
		nets to the gateway, not just traffic for nets
		that the gateway knows how to reach.  The internal
		machines will never see ENETUNREACH; they will
		always have to wait for a timeout.

		As an aside, the BSD route daemon behaves this way
		and is documented this way.  The Sun route daemon
		behaves this way, but is documented to distribute
		both the active and passive entries from the
		gateways file.

Question 2: Why are all active gateways entered by the route daemon
		as paths to the default network (0.0.0.0)?

		This certainly seems like a bug.  They should be
		entered as paths to the network cited in the
		/etc/gateways file.  But the code initializes
		each active gateway entry of type "net" quite
		deliberately.  In the routine "addrouteforif":

		    if (ifp->int_flags & IFF_POINTOPOINT)
			    dst = &ifp->int_dstaddr;
		    else {
			    bzero((char *)&net, sizeof (net));
			    net.sin_family = AF_INET;
			    net.sin_addr =
				    inet_makeaddr(ifp->int_subnet, INADDR_ANY);
			    dst = (struct sockaddr *)&net;
		    }
	            rt = rtfind(dst);

		The gateway machine ends up with a route to the "default"
		network (0.0.0.0) for each active gateway in the
		/etc/gateways file, instead of a route to the network
		identified in the file.  And it then propogates that
		bogus route to other machines on the net.

Any BSD routing/network intimates out there who can explain
what's supposed to be going on here, or explain which of
these behaviors is a bug and how to fix it?

Beau James				beau@Ultra.COM
Ultra Network Technologies, Inc.	{sun,ames}!ultra!beau

P.S. A further note: if an entry in the /etc/gateways file happens to
     unintentionally use the "host" keyword for a network, e.g.
     
     	host Really-A-Net gateway Gateway-To-That-Net metric 1 active
     
     then the route daemon will interpret (and redistribute) that as
     a route to network 255.255.255.255, due to an untested possible
     error return in the routine "getnetorhostname".