[comp.bugs.4bsd] Bug in new routed with multiple point-to-point links +FIX

bruce@Stride.COM (Bruce Robertson) (05/20/88)

Index:	etc/routed/startup.c 4.3BSD

Description:
	This describes a bug in the new version of routed found in
	~ftp/pub/routed.tar.Z on ucbarpa.

	If you have configured multiple point-to-point links with the
	same network number, routed will only supply the first
	interface with routing information.

	In ifinit(), for every new network interface seen, the list of
	previously seen interfaces is searched.  The interface is
	ignored if it is already on the list; this prevents routed
	from suppling routing information more than once on a single
	interface.  Unfortunately, routed uses the "source" address
	for this comparison, even with point-to-point links.  If your
	PTP links have the same network number, this source address is
	the same for all interfaces, causing only the first interface
	to be put on the list.  For PTP links, the destination address
	should be used.

Repeat-By:
	Configure more than one SLIP interface, giving them all the
	same network number.  Only the first interface will be
	supplied with routing information.

Fix:
	Install this patch:

*** /tmp/,RCSt1a15333	Wed May 18 09:39:58 1988
--- startup.c	Fri May 13 15:25:43 1988
***************
*** 65,83 ****
  			lookforinterfaces = 1;
  			continue;
  		}
- 		/* already known to us? */
- 		if (if_ifwithaddr(&ifs.int_addr))
- 			continue;
- 		/* argh, this'll have to change sometime */
- 		if (ifs.int_addr.sa_family != AF_INET)
- 			continue;
- 		if (ifs.int_flags & IFF_LOOPBACK) {
- 			foundloopback = 1;
- 			loopaddr = ifs.int_addr;
- 			for (ifp = ifnet; ifp; ifp = ifp->int_next)
- 			    if (ifp->int_flags & IFF_POINTOPOINT)
- 				add_ptopt_localrt(ifp);
- 		}
                  if (ifs.int_flags & IFF_POINTOPOINT) {
                          if (ioctl(s, SIOCGIFDSTADDR, (char *)&ifreq) < 0) {
                                  syslog(LOG_ERR, "ioctl (get dstaddr)");
--- 65,70 ----
***************
*** 91,96 ****
--- 78,101 ----
                                  continue;
                          }
  			ifs.int_broadaddr = ifreq.ifr_broadaddr;
+ 		}
+ 		/* already known to us? */
+ 		if (ifs.int_flags & IFF_POINTOPOINT)
+ 		{
+ 			if (if_ifwithdstaddr(&ifs.int_dstaddr))
+ 				continue;
+ 		}
+ 		else if (if_ifwithaddr(&ifs.int_addr))
+ 			continue;
+ 		/* argh, this'll have to change sometime */
+ 		if (ifs.int_addr.sa_family != AF_INET)
+ 			continue;
+ 		if (ifs.int_flags & IFF_LOOPBACK) {
+ 			foundloopback = 1;
+ 			loopaddr = ifs.int_addr;
+ 			for (ifp = ifnet; ifp; ifp = ifp->int_next)
+ 			    if (ifp->int_flags & IFF_POINTOPOINT)
+ 				add_ptopt_localrt(ifp);
  		}
  		if (ioctl(s, SIOCGIFMETRIC, (char *)&ifreq) < 0)
  			syslog(LOG_ERR, "ioctl (get metric)");
-- 

	Bruce Robertson
	MicroSage Computer Systems
	bruce@stride.com