*BSD News Article 8827


Return to BSD News archive

Path: sserve!manuel.anu.edu.au!munnari.oz.au!ariel.ucs.unimelb.EDU.AU!werple.apana.org.au!news
From: andrew@werple.apana.org.au (Andrew Herbert)
Newsgroups: comp.unix.bsd
Subject: [386bsd] ICMP redirect handling panic - FIX
Date: 14 Dec 1992 13:30:41 +1100
Organization: werple public-access unix, Melbourne
Lines: 65
Message-ID: <1ggrkhINN67h@werple.apana.org.au>
NNTP-Posting-Host: werple.apana.org.au

Running a 386bsd machine attached to a router box (running the freely available
pcroute software) handling modem-based SLIP links can panic 386bsd if a link
fails while in use.  This is due to pcroute sending ICMP redirects to say that
the current route is no longer valid.

The fact that the ENETUNREACH branch (look in the source for rtredirect()),
the cause of the panic, is taken at all makes me somewhat dubious as to whether
pcroute is doing the right thing.  printf()s indicated that the redirects were
coming from the router's slip interface that had just died, rather than the
ethernet interface as is (reasonably) expected by 386bsd.  But in any case, it
certainly uncovered a 386bsd bug.

Few people are likely to have run into this particular problem, but for those
that have (and for people that don't like the thought of running broken
kernels :-) the fix follows...

enjoy,
Andrew Herbert

*** /sys/net/route.c.unhacked	Sat Dec 12 18:06:18 1992
--- /sys/net/route.c	Mon Dec 14 13:06:07 1992
***************
*** 31,36 ****
--- 31,40 ----
   * SUCH DAMAGE.
   *
   *	@(#)route.c	7.22 (Berkeley) 6/27/91
+  *
+  * PATCHES
+  * -------
+  * rtredirect() fix	12 Dec 92	andrew@werple.apana.org.au
   */
  #include "param.h"
  #include "systm.h"
***************
*** 150,156 ****
  	int flags;
  	struct rtentry **rtp;
  {
! 	register struct rtentry *rt;
  	int error = 0;
  	short *stat = 0;
  
--- 154,160 ----
  	int flags;
  	struct rtentry **rtp;
  {
! 	register struct rtentry *rt = 0;   /* andrew@werple - 12 Dec 92  XXX */
  	int error = 0;
  	short *stat = 0;
  
***************
*** 170,175 ****
--- 174,183 ----
  	if (!(flags & RTF_DONE) && rt && !equal(src, rt->rt_gateway))
  		error = EINVAL;
  	else if (ifa_ifwithaddr(gateway))
+ /*
+  * XXX - shouldn't this be testing whether (ifa_ifwithaddr(gateway) == 0) ???
+  * i.e. gateway can't be reached from any interface - andrew@werple, 12 Dec 92
+  */
  		error = EHOSTUNREACH;
  	if (error)
  		goto done;