*BSD News Article 57682


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!nntp.coast.net!news.kei.com!news.mathworks.com!fu-berlin.de!zib-berlin.de!irz401!uriah.heep!news
From: j@uriah.heep.sax.de (J Wunsch)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: Route not deleted from route table
Date: 23 Dec 1995 13:24:53 GMT
Organization: Private BSD site, Dresden
Lines: 60
Message-ID: <4bgvv5$naq@uriah.heep.sax.de>
References: <4at2m2$g3g@homer.alpha.net>
Reply-To: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch)
NNTP-Posting-Host: localhost.heep.sax.de
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Newsreader: knews 0.9.3

Asif Bakar <asif@iss.arinet.com> writes:
> I am having problem with PPP login accounts.
> I assign ip address to a specific tty when a
> user logs in on a certain tty.  The problem
> is that when the user hangs up.  The tty
> is still busy.  The routing table does not
> show me my routes.

It will show you the route when you add the `-a' flag to netstat -r.

The bug was caused by a clone route that has been created if packets
for the (now logged out) PPP user arrived, so only the default route
applied to them.

This is supposed to fix the problem (it's part of 2.1R as well):

Index: /sys/net/route.c
===================================================================
RCS file: /home/cvs/src/sys/net/route.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- route.c	1995/07/29 11:41:02	1.25
+++ route.c	1995/10/16 19:09:40	1.26
@@ -464,6 +464,28 @@
 
 		rn = rnh->rnh_addaddr((caddr_t)ndst, (caddr_t)netmask,
 					rnh, rt->rt_nodes);
+		if (rn == 0) {
+			struct rtentry *rt2;
+			/*
+			 * Uh-oh, we already have one of these in the tree.
+			 * We do a special hack: if the route that's already
+			 * there was generated by the protocol-cloning
+			 * mechanism, then we just blow it away and retry
+			 * the insertion of the new one.
+			 */
+			rt2 = rtalloc1(dst, 0, RTF_PRCLONING);
+			if (rt2 && rt2->rt_parent) {
+				rtrequest(RTM_DELETE, 
+					  (struct sockaddr *)rt_key(rt2),
+					  rt2->rt_gateway,
+					  rt_mask(rt2), rt2->rt_flags, 0);
+				RTFREE(rt2);
+				rn = rnh->rnh_addaddr((caddr_t)ndst,
+						      (caddr_t)netmask,
+						      rnh, rt->rt_nodes);
+			}
+		}
+
 		if (rn == 0) {
 			if (rt->rt_gwroute)
 				rtfree(rt->rt_gwroute);

-- 
cheers, J"org

joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)