From owner-freebsd-net Fri May 4 8:22:16 2001 Delivered-To: freebsd-net@freebsd.org Received: from whale.sunbay.crimea.ua (whale.sunbay.crimea.ua [212.110.138.65]) by hub.freebsd.org (Postfix) with ESMTP id 032F937B422; Fri, 4 May 2001 08:22:05 -0700 (PDT) (envelope-from ru@whale.sunbay.crimea.ua) Received: (from ru@localhost) by whale.sunbay.crimea.ua (8.11.2/8.11.2) id f44FLWV09351; Fri, 4 May 2001 18:21:32 +0300 (EEST) (envelope-from ru) Date: Fri, 4 May 2001 18:21:32 +0300 From: Ruslan Ermilov To: jonathan.chen@itouch.co.nz, Dag-Erling Smorgrav , Garrett Wollman Cc: FreeBSD-gnats-submit@FreeBSD.org, net@FreeBSD.org Subject: Re: bin/26970: 4.3 netstat -r output Message-ID: <20010504182132.B6501@sunbay.com> Mail-Followup-To: jonathan.chen@itouch.co.nz, Dag-Erling Smorgrav , Garrett Wollman , FreeBSD-gnats-submit@FreeBSD.ORG, net@FreeBSD.org References: <200104292329.f3TNTBA01095@jonc.itouch> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200104292329.f3TNTBA01095@jonc.itouch>; from jonathan.chen@itouch.co.nz on Mon, Apr 30, 2001 at 11:29:11AM +1200 Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On Mon, Apr 30, 2001 at 11:29:11AM +1200, jonathan.chen@itouch.co.nz wrote: > > The output of `netstat -r' for 4.3-RELEASE onwards doesn't appear > to include info on hosts on the local network that it has recently > communicated with. > This is the documented behavior. ``netstat -r'' does not anymore show cloned routes by default unless -a is given, see manpage for details. Previously, only protocol-cloned routes were hidden from a normal output. Now both protocol-cloned and cloned routes are not shown. There was the reason for this change in -CURRENT, but for -STABLE it was certainly premature. I don't have an idea why DES did this. DES? I have a question for Garrett. Was the original idea behind -a flag is to hide protocol-cloned routes only but not RTF_CLONING generated routes, or it was simply caused by the bug that `rt_parent' was not set for routes generated from RTF_CLONING parent, as documented in rtentry(9)? If the behavior of netstat(1) is to be restored, the following patch will DTRT: Index: route.c =================================================================== RCS file: /home/ncvs/src/usr.bin/netstat/route.c,v retrieving revision 1.41.2.5 diff -u -p -r1.41.2.5 route.c --- route.c 2001/03/22 13:48:44 1.41.2.5 +++ route.c 2001/05/04 15:02:48 @@ -582,16 +582,20 @@ p_rtentry(rt) register struct rtentry *rt; { static struct ifnet ifnet, *lastif; + struct rtentry parent; static char name[16]; static char prettyname[9]; struct sockaddr *sa; sa_u addr, mask; /* - * Don't print cloned routes unless -a. + * Don't print protocol-cloned routes unless -a. */ - if (rt->rt_flags & RTF_WASCLONED && !aflag) - return; + if (rt->rt_flags & RTF_WASCLONED && !aflag) { + kget(rt->rt_parent, parent); + if (parent.rt_flags & RTF_PRCLONING) + return; + } bzero(&addr, sizeof(addr)); if ((sa = kgetsa(rt_key(rt)))) Cheers, -- Ruslan Ermilov Oracle Developer/DBA, ru@sunbay.com Sunbay Software AG, ru@FreeBSD.org FreeBSD committer, +380.652.512.251 Simferopol, Ukraine http://www.FreeBSD.org The Power To Serve http://www.oracle.com Enabling The Information Age To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message