routed bug fix

BostonU SysMgr root%bostonu.csnet at csnet-relay.ARPA
Tue Jul 23 02:31:35 AEST 1985


Subject: routed sometimes fails to send gateway info
Index:	/usr/src/etc/routed/startup.c 4.2BSD

Description:
	A machine with multiple interfaces will not report that it
	can act as a gateway on all interfaces capable of receiving
	broadcast messages. This results in some systems not knowing
	about gateways. Perhaps this has been reported before, or
	maybe people have just patched their /etc/gateways files and
	stopped relying on routed (or used route explicitly etc.)

	This is caused by a simple collision of the meaning of a
	bit in the interface flags field (between how it appears
	in the kernel and how routed uses it.)

	I suspect my trouble was with the IFF_TRAILERS bit. This
	bug may not appear unless you have certain bits set via
	ifconfig.

Repeat-By:
	1. Delete any entries from the gateways files on a machine
	that shouldn't need them (ie. a 4.2 system running routed
	with another 4.2 system running routed that should be reporting
	its gateway services.) Delete gateway info (route delete...),
	see if the gateway info re-appears. If not, you have the bug.

	2. Go on the gateway machine and kill routed, re-run it by
	hand with the trace flag set, note if it fails to send info
	on all its broadcast interfaces.

Fix:
	Relatively trivial, in ifinit() (startup.c) mask off all bits
	other than 0x1f in ifs.if_flags, context diff follows:

*** startup.c.orig	Sun Jul 21 15:41:03 1985
--- startup.c	Fri Jul 19 18:38:35 1985
***************
*** 102,107
  		}
  		strcpy(ifp->int_name, name);
  		ifp->int_addr = ifs.if_addr;
  		ifp->int_flags = ifs.if_flags | IFF_INTERFACE;
  		/* this works because broadaddr overlaps dstaddr */
  		ifp->int_broadaddr = ifs.if_broadaddr;

--- 102,113 -----
  		}
  		strcpy(ifp->int_name, name);
  		ifp->int_addr = ifs.if_addr;
+ 		/*
+ 		 * BZS - bad botch, clear hi bits
+ 		 * (7/19/85)
+ 		 */
+ 		ifs.if_flags &= 0x1f ;	/* foo! */
+ 		/**/
  		ifp->int_flags = ifs.if_flags | IFF_INTERFACE;
  		/* this works because broadaddr overlaps dstaddr */
  		ifp->int_broadaddr = ifs.if_broadaddr;


	-Barry Shein, Boston University



More information about the Comp.unix.wizards mailing list