Date: Fri, 19 Jun 1998 11:14:36 +0200 (CEST) From: zgabor@zg.CoDe.hu To: freebsd.org!FreeBSD-gnats-submit@zg.CoDe.hu Subject: bin/6994: netstat -s + IPX/Appletalk Message-ID: <199806190914.LAA00678@CoDe.hu>
next in thread | raw e-mail | index | archive | help
>Number: 6994 >Category: bin >Synopsis: The netstat(1) -s generates wrong output with IPX and Appletalk >Confidential: yes >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Jun 19 04:40:01 PDT 1998 >Last-Modified: >Originator: Zahemszky Gabor >Organization: CoDe Ltd. >Release: FreeBSD 2.2.6-RELEASE i386 >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. >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199806190914.LAA00678>