From jonc@itouch.co.nz  Sun Apr 29 16:29:15 2001
Return-Path: <jonc@itouch.co.nz>
Received: from itouch.co.nz (itouch.co.nz [203.99.66.188])
	by hub.freebsd.org (Postfix) with ESMTP id D6F0F37B424
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 29 Apr 2001 16:29:14 -0700 (PDT)
	(envelope-from jonc@itouch.co.nz)
Received: from jonc.itouch (jonc.itouch [192.168.2.21])
	by itouch.co.nz (8.11.3/8.11.1) with ESMTP id f3TNTCv01915
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 30 Apr 2001 11:29:12 +1200 (NZST)
	(envelope-from jonc@itouch.co.nz)
Received: (from jonc@localhost)
	by jonc.itouch (8.11.3/8.11.1) id f3TNTBA01095;
	Mon, 30 Apr 2001 11:29:11 +1200 (NZST)
	(envelope-from jonc)
Message-Id: <200104292329.f3TNTBA01095@jonc.itouch>
Date: Mon, 30 Apr 2001 11:29:11 +1200 (NZST)
From: jonathan.chen@itouch.co.nz
Reply-To: jonathan.chen@itouch.co.nz
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: 4.3 netstat -r output
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         26970
>Category:       bin
>Synopsis:       4.3 netstat -r output missing data
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    ru
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Apr 29 16:30:01 PDT 2001
>Closed-Date:    Thu May 10 01:26:55 PDT 2001
>Last-Modified:  Thu May 10 01:29:03 PDT 2001
>Originator:     Jonathan Chen
>Release:        FreeBSD 4.3 i386
>Organization:
iTouch NZ
>Environment:
System: FreeBSD jonc.itouch 4.3-STABLE FreeBSD 4.3-STABLE #1: Mon Apr 23 15:03:39 NZST 2001 root@jonc.itouch:/usr/obj/usr/src/sys/JONC i386


FreeBSD 4.3-RELEASE i386

>Description:

	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.

>How-To-Repeat:

	0:jonc-~,10:21am> uname -v
	FreeBSD 4.3-STABLE #1: Mon Apr 23 15:03:39 NZST 2001     root@jonc.itouch:/usr/obj/usr/src/sys/JONC 
	0:jonc-~,10:21am> ping 192.168.2.10
	PING 192.168.2.10 (192.168.2.10): 56 data bytes
	64 bytes from 192.168.2.10: icmp_seq=0 ttl=255 time=0.616 ms
	^C
	--- 192.168.2.10 ping statistics ---
	2 packets transmitted, 2 packets received, 0% packet loss
	round-trip min/avg/max/stddev = 0.616/0.788/0.961/0.172 ms
	0:jonc-~,10:21am> netstat -rn
	Routing tables

	Internet:
	Destination        Gateway            Flags     Refs     Use     Netif Expire
	default            192.168.2.1        UGSc        0        0      xl0
	127.0.0.1          127.0.0.1          UH          1        2      lo0
	192.168.2          link#1             UC          0        0      xl0 =>

	Internet6:
	[...]

	The 4.3 box doesn't have routing info for 192.168.2.10 listed.
	However, on a 4.2-STABLE machine, I get:

	pikachu-~,10:26am> netstat -rn 
	Routing tables

	Internet:
	Destination        Gateway            Flags     Refs     Use     Netif Expire
	default            XXX.XXX.XXX.XX     UGSc       48  4631786     fxp0
	192.168.2          link#6             UC          0        0      xl4 =>
	192.168.2.10       0:d0:b7:89:95:b6   UHLW        1    37061      xl4    698
	192.168.2.11       0:d0:b7:a9:56:3    UHLW        1     1685      xl4    811
	[...]


>Fix:

>Release-Note:
>Audit-Trail:

From: Ruslan Ermilov <ru@FreeBSD.org>
To: jonathan.chen@itouch.co.nz,
	Dag-Erling Smorgrav <des@FreeBSD.org>,
	Garrett Wollman <wollman@FreeBSD.org>
Cc: FreeBSD-gnats-submit@FreeBSD.org, net@FreeBSD.org
Subject: Re: bin/26970: 4.3 netstat -r output
Date: Fri, 4 May 2001 18:21:32 +0300

 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

From: Garrett Wollman <wollman@khavrinen.lcs.mit.edu>
To: Ruslan Ermilov <ru@FreeBSD.ORG>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG, net@FreeBSD.ORG
Subject: Re: bin/26970: 4.3 netstat -r output
Date: Fri, 4 May 2001 11:49:41 -0400 (EDT)

 <<On Fri, 4 May 2001 18:21:32 +0300, Ruslan Ermilov <ru@FreeBSD.ORG> said:
 
 > 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)?
 
 Let me see if I can reconstruct the history.
 
 Originally, 4.4's `netstat -r' showed cloned routes.
 Then I added the ``protocol cloning'' feature and suddenly there were
 a lot more cloned routes.
 Then people complained that this was too much information.
 Then I added the `-a' flag to hide the stuff that protocol-cloning had
 added.
 
 I'm agnostic on whether `-a' should suppress all cloned routes or just
 the protocol-cloned routes.  POLA suggests that the latter is probably
 a better choice.
 
 -GAWollman
 

From: Dag-Erling Smorgrav <des@ofug.org>
To: Ruslan Ermilov <ru@FreeBSD.org>
Cc: jonathan.chen@itouch.co.nz,
	Garrett Wollman <wollman@FreeBSD.org>,
	FreeBSD-gnats-submit@FreeBSD.org, net@FreeBSD.org
Subject: Re: bin/26970: 4.3 netstat -r output
Date: 04 May 2001 22:54:54 +0200

 Ruslan Ermilov <ru@FreeBSD.org> writes:
 > 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?
 
 Probably because it was buried in a diff that contained other fixes
 that needed MFCing.  It wasn't a conscious decision to MFC exactly
 that one change.
 
 DES
 -- 
 Dag-Erling Smorgrav - des@ofug.org
State-Changed-From-To: open->analyzed 
State-Changed-By: ru 
State-Changed-When: Mon May 7 05:29:54 PDT 2001 
State-Changed-Why:  
Old behavior of printing RTF_CLONING cloned routes restored in 5.0-CURRENT: 

src/usr.bin/netstat/route.c,v 1.48 
src/usr.bin/netstat/netstat.1,v 1.28 


Responsible-Changed-From-To: freebsd-bugs->ru 
Responsible-Changed-By: ru 
Responsible-Changed-When: Mon May 7 05:29:54 PDT 2001 
Responsible-Changed-Why:  
My change, my fix. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=26970 
State-Changed-From-To: analyzed->closed 
State-Changed-By: ru 
State-Changed-When: Thu May 10 01:26:55 PDT 2001 
State-Changed-Why:  
Fix merged into 4.3-STABLE: 

src/usr.bin/netstat/route.c,v 1.41.2.6 
src/usr.bin/netstat/netstat.1,v 1.22.2.4 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=26970 
>Unformatted:
