From owner-freebsd-bugs Fri Jun 19 04:41:40 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id EAA22241 for freebsd-bugs-outgoing; Fri, 19 Jun 1998 04:41:40 -0700 (PDT) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id EAA22194 for ; Fri, 19 Jun 1998 04:41:19 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.8/8.8.5) id EAA19259; Fri, 19 Jun 1998 04:40:02 -0700 (PDT) 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 ; 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 X-Send-Pr-Version: 3.2 Subject: bin/6994: netstat -s + IPX/Appletalk Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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