Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 2 Nov 2013 18:20:12 GMT
From:      Olivier Cochard-Labbe <olivier@cochard.me>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/183598: netstat and wrong display of humanized packets counter
Message-ID:  <201311021820.rA2IKC3q009999@oldred.freebsd.org>
Resent-Message-ID: <201311021830.rA2IU0dS065727@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201311021820.rA2IKC3q009999>