From hu006co@mail.euroweb.hu  Fri Jun 19 04:36:59 1998
Received: from mail.euroweb.hu (mail.euroweb.hu [193.226.220.4])
          by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id EAA21532
          for <FreeBSD-gnats-submit@freebsd.org>; Fri, 19 Jun 1998 04:36:55 -0700 (PDT)
          (envelope-from hu006co@mail.euroweb.hu)
Received: (from hu006co@localhost)
	by mail.euroweb.hu (8.8.5/8.8.5) id NAA24753
	for freebsd.org!FreeBSD-gnats-submit; Fri, 19 Jun 1998 13:34:12 +0200 (MET DST)
Received: (from zgabor@localhost)
	by CoDe.hu (8.8.8/8.8.8) id LAA00678;
	Fri, 19 Jun 1998 11:14:36 +0200 (CEST)
	(envelope-from zgabor)
Message-Id: <199806190914.LAA00678@CoDe.hu>
Date: Fri, 19 Jun 1998 11:14:36 +0200 (CEST)
From: zgabor@zg.CoDe.hu
Reply-To: zgabor@zg.CoDe.hu
To: freebsd.org!FreeBSD-gnats-submit@zg.CoDe.hu
Subject: netstat -s + IPX/Appletalk
X-Send-Pr-Version: 3.2

>Number:         6994
>Category:       bin
>Synopsis:       The netstat(1) -s generates wrong output with IPX and Appletalk
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    ru
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jun 19 04:40:01 PDT 1998
>Closed-Date:    Tue Jun 12 07:00:57 PDT 2001
>Last-Modified:  Tue Jun 12 07:03:33 PDT 2001
>Originator:     Zahemszky Gabor
>Release:        FreeBSD 2.2.6-RELEASE i386
>Organization:
CoDe Ltd.
>Environment:

	A 2.2.6 with in-kernel IPX and ATALK

>Description:

	The netstat(1) manual says:
	-s: Show per-protocol statistics.  If this option is repeated,
	counters with a value of zero are supressed.
	But the ipx/atalk version is buggy:
	$ netstat -s -s
	....
	ipx:
		generate the whole output, doesn't matter the 0 values
	spx:
		generate the whole output, doesn't matter the 0 values
	....

	$ netstat -s
	....
	ddp:
		doesn't generate statistics with zero values (as it need
		netstat -s -s)
	....

>How-To-Repeat:

	Generate a kernel with option IPX and option ATALK, and type:
	netstat -s -s, and netstat -s

>Fix:
	
	In ipx.c and atalk.c, change the definitionS(!) of the ANY macro from:

/* atalk.c: */
#define ANY(x,y,z) \
	((x) ? printf("\t%d %s%s%s\n",x,y,plural(x),z) : 0)

/* ipx.c: */
#define ANY(x,y,z)	(printf("\t%u %s%s%s\n",x,y,plural(x),z))

	to the next:
#define ANY(x,y,z) \
	if ( (x) || ( sflag <= 1 ) ) printf("\t%u %s%s%s\n",x,y,plural(x),z)

	By the way, in inet.c, the statistic-printing routines use the
	corresponding p, p2, and the absolutely unnecessary p3 (it isn't
	used in inet.c) macro, and in the format string, there is: %ld.
	In ipx.c, the ANY macro uses %u, and in atalk.c, %d.  I don't know
	the current implementation, but %u (maybe %lu) looks better to me.
	And maybe it would be better, to use the same printing macros
	(defined in only one place, eg. netstat.h) in all of the supported
	protocols statistic-printing routines.
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: ru 
State-Changed-When: Tue Jun 12 07:00:57 PDT 2001 
State-Changed-Why:  
Fixed, thanks! 

The IPX part was already fixed in ipx.c,v 1.12 as part of the PR 14168. 


Responsible-Changed-From-To: freebsd-bugs->ru 
Responsible-Changed-By: ru 
Responsible-Changed-When: Tue Jun 12 07:00:57 PDT 2001 
Responsible-Changed-Why:  
Increment counter. 

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