kern/112490: [route] [patch] Problem in "rt_check" routine.

Craig Rodrigues rodrigc at crodrigues.org
Thu Oct 11 10:40:03 PDT 2007


The following reply was made to PR kern/112490; it has been noted by GNATS.

From: "Craig Rodrigues" <rodrigc at crodrigues.org>
To: bug-followup at freebsd.org
Cc: mehuljv at yahoo.com, jhb at FreeBSD.org
Subject: Re: kern/112490: [route] [patch] Problem in "rt_check" routine.
Date: Thu, 11 Oct 2007 13:23:34 -0400

 --vkogqOf2sHV7VnPd
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 Hi,
 
 Here is a variation of the patch posted in PR 112490.
 Ivan Voras has tried testing with this, but it didn't solve
 the problem mentioned in PR 112490.
 
 -- 
 Craig Rodrigues
 rodrigc at crodrigues.org
 
 --vkogqOf2sHV7VnPd
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="a.txt"
 
 Index: route.c
 ===================================================================
 RCS file: /home/ncvs/src/sys/net/route.c,v
 retrieving revision 1.120
 diff -u -r1.120 route.c
 --- route.c	11 Jun 2007 12:19:34 -0000	1.120
 +++ route.c	11 Oct 2007 17:21:15 -0000
 @@ -1281,6 +1281,7 @@
  	int error;
  
  	KASSERT(*lrt0 != NULL, ("rt_check"));
 +try_again:
  	rt = rt0 = *lrt0;
  
  	/* NB: the locking here is tortuous... */
 @@ -1297,11 +1298,19 @@
  	}
  	/* XXX BSD/OS checks dst->sa_family != AF_NS */
  	if (rt->rt_flags & RTF_GATEWAY) {
 -		if (rt->rt_gwroute == NULL)
 +		struct rtentry *temp_rt_gwroute = rt->rt_gwroute;
 +		if (temp_rt_gwroute == NULL)
  			goto lookup;
  		rt = rt->rt_gwroute;
  		RT_LOCK(rt);		/* NB: gwroute */
 +		if(rt0->rt_flags & 0x80000000U){
 +			/*This rt is under process...*/
 +			RT_UNLOCK(rt);
 +			RT_UNLOCK(rt0);
 +			goto try_again;
 +		}
  		if ((rt->rt_flags & RTF_UP) == 0) {
 +			rt0->rt_flags |= 0x80000000U;
  			RTFREE_LOCKED(rt);	/* unlock gwroute */
  			rt = rt0;
  		lookup:
 @@ -1315,6 +1324,7 @@
  			}
  			RT_LOCK(rt0);
  			rt0->rt_gwroute = rt;
 +			rt0->rt_flags &= (~0x80000000U);
  			if (rt == NULL) {
  				RT_UNLOCK(rt0);
  				return (EHOSTUNREACH);
 
 --vkogqOf2sHV7VnPd--


More information about the freebsd-bugs mailing list