From owner-freebsd-bugs@FreeBSD.ORG Sat Nov 2 18:30:00 2013 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id D0ED35EA for ; Sat, 2 Nov 2013 18:30:00 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B151A221F for ; Sat, 2 Nov 2013 18:30:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id rA2IU06P065728 for ; Sat, 2 Nov 2013 18:30:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.7/8.14.7/Submit) id rA2IU0dS065727; Sat, 2 Nov 2013 18:30:00 GMT (envelope-from gnats) Resent-Date: Sat, 2 Nov 2013 18:30:00 GMT Resent-Message-Id: <201311021830.rA2IU0dS065727@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Olivier Cochard-Labbe Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 884BF32D for ; Sat, 2 Nov 2013 18:20:13 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from oldred.freebsd.org (oldred.freebsd.org [8.8.178.121]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5C0BA21CD for ; Sat, 2 Nov 2013 18:20:13 +0000 (UTC) Received: from oldred.freebsd.org ([127.0.1.6]) by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id rA2IKCEE010018 for ; Sat, 2 Nov 2013 18:20:12 GMT (envelope-from nobody@oldred.freebsd.org) Received: (from nobody@localhost) by oldred.freebsd.org (8.14.5/8.14.5/Submit) id rA2IKC3q009999; Sat, 2 Nov 2013 18:20:12 GMT (envelope-from nobody) Message-Id: <201311021820.rA2IKC3q009999@oldred.freebsd.org> Date: Sat, 2 Nov 2013 18:20:12 GMT From: Olivier Cochard-Labbe To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: misc/183598: netstat and wrong display of humanized packets counter X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Nov 2013 18:30:01 -0000 >Number: 183598 >Category: misc >Synopsis: netstat and wrong display of humanized packets counter >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Nov 02 18:30:00 UTC 2013 >Closed-Date: >Last-Modified: >Originator: Olivier Cochard-Labbe >Release: 9.2 >Organization: BSD Router Project >Environment: FreeBSD bsdrp1.orange.bsdrp.net 9.2-RELEASE FreeBSD 9.2-RELEASE #0 r255918M: Sat Oct 26 22:41:39 CEST 2013 root@orange.bsdrp.net:/usr/obj/BSDRP.amd64/usr/local/BSDRP/BSDRP/FreeBSD/src/sys/amd64 amd64 >Description: 1K packets = 1000 packets and not 1024 packets. But netstat "-h" option convert 1024 packets to 1k packets. In usr.bin/netstat/if.c, function show_stat() should call humanize_number() with the flag HN_DIVISOR_1000 for the packet counters. >How-To-Repeat: Here is the netstat output without and with the "h" option during receiving the same network load: [root@bsdrp2]~# netstat -iw 1 input (Total) output packets errs idrops bytes packets errs bytes colls 499963 244305 0 50996154 3 0 690 0 500346 214356 0 51035256 1 0 214 0 500937 257107 0 51095538 2 0 280 0 500167 187844 0 51016890 4 0 2744 0 499605 208954 0 50959638 3 0 546 0 499915 203059 0 50991258 2 0 2188 0 499355 183496 0 50934174 1 0 214 0 499843 197301 0 50983950 1 0 214 0 500193 211267 0 51020086 1 0 214 0 500233 243838 0 51023730 1 0 214 0 499386 238562 0 50937336 1 0 214 0 499577 235335 0 50956818 1 0 214 0 [root@bsdrp2]~# netstat -ihw 1 input (Total) output packets errs idrops bytes packets errs bytes colls 489k 185k 0 48M 1 0 262 0 488k 196k 0 48M 1 0 214 0 489k 200k 0 48M 1 0 214 0 489k 193k 0 48M 1 0 214 0 488k 200k 0 48M 1 0 214 0 489k 196k 0 48M 1 0 214 0 487k 189k 0 48M 1 0 214 0 489k 195k 0 48M 1 0 214 0 488k 191k 0 48M 1 0 214 0 488k 192k 0 48M 5 0 2.8k 0 >Fix: >Release-Note: >Audit-Trail: >Unformatted: