Bug 244589 - netstat -i -d --libxo json mentions "dropped-packets" twice
Summary: netstat -i -d --libxo json mentions "dropped-packets" twice
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 12.1-RELEASE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-04 07:56 UTC by Rudolph
Modified: 2024-09-27 06:28 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rudolph 2020-03-04 07:56:53 UTC
Example output of netstat -i -d --libxo json:

{"statistics": {"interface: [{"name":"em0","flags":"0x8843","mtu":1500,"network":"<Link#1>","address":"xx:xx:xx:xx:xx:xx","received-packets":13445,"received-errors":0,"dropped-packets":0,"sent-packets":7580,"send-errors":0,"collisions":0,"dropped-packets":0}, etc. etc.

"dropped-packets" is used twice. One is probably for "in" and the other for "out". Output without libxo:

Name    Mtu Network       Address              Ipkts Ierrs Idrop    Opkts Oerrs  Coll  Drop
em0    1500 <Link#1>      xx:xx:xx:xx:xx:xx    14803     0     0     8191     0     0     0
etc.
Comment 1 Phil Shafer freebsd_committer freebsd_triage 2020-05-27 14:48:34 UTC
Yes, this should be "dropped-packets-input" and "dropped-packets-output" to make this clear and useful.

Thanks,
 Phil
Comment 2 commit-hook freebsd_committer freebsd_triage 2024-09-20 15:58:44 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=94567c8641e235763b5b2926416d89d36654cde1

commit 94567c8641e235763b5b2926416d89d36654cde1
Author:     Bram <bram@cbbg.nl>
AuthorDate: 2024-07-23 08:57:42 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-09-20 15:06:26 +0000

    netstat: Resolve duplicate "dropped-packets" key from libxo output

    The current libxo output uses the "dropped-packets" key for both incoming and
    outgoing packets. This commit distinguishes between the two by adding an "in"
    and "out" suffix. The original "dropped-packets" key is kept for backwards
    compatibility for now.

    PR: 244589
    Reviewed by: imp, zlei
    Pull Request: https://github.com/freebsd/freebsd-src/pull/1331

 usr.bin/netstat/if.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
Comment 3 Rudolph 2024-09-27 06:28:10 UTC
Thanks for resolving this issue!