Bug 251541 - libxo json output for `netstat -Lan` misses statistics
Summary: libxo json output for `netstat -Lan` misses statistics
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 12.1-RELEASE
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-02 19:04 UTC by Yann Kerherve
Modified: 2020-12-02 19:04 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yann Kerherve 2020-12-02 19:04:03 UTC
# /usr/bin/netstat -Lan --libxo json | jq .
{
  "statistics": {
    "socket": [
      {
        "queue-length": 0,
        "incomplete-queue-length": 0,
        "queue-limit": 128,
        "path": "/tmp/ssh-NZBPhqvAB7/agent.66959"
      },
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {
        "queue-length": 0,
        "incomplete-queue-length": 0,
        "queue-limit": 65535,
        "path": "/var/run/some.sock"
      },
      {
        "queue-length": 0,
        "incomplete-queue-length": 0,
        "queue-limit": 255,
        "path": "/var/db/syslog-ng.ctl"
      },
      {
        "queue-length": 0,
        "incomplete-queue-length": 0,
        "queue-limit": 65535,
        "path": "/var/run/other.sock"
      },
      {},
      {},
      {
        "queue-length": 0,
        "incomplete-queue-length": 0,
        "queue-limit": 5,
        "path": "/var/run/lldpd.socket"
      },
      {},
      {},
      {
        "queue-length": 0,
        "incomplete-queue-length": 0,
        "queue-limit": 100,
        "path": "/var/run/mdnsd"
      },
      {
        "queue-length": 0,
        "incomplete-queue-length": 0,
        "queue-limit": 4,
        "path": "/var/run/devd.pipe"
      },
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {
        "queue-length": 0,
        "incomplete-queue-length": 0,
        "queue-limit": 4,
        "path": "/var/run/devd.seqpacket.pipe"
      }
    ]
  }
}

Compared to: 

# /usr/bin/netstat -Lan
Current listen queue sizes (qlen/incqlen/maxqlen)
Proto Listen                           Local Address
tcp4  0/0/65535                        127.0.0.1.9465
tcp4  0/0/65535                        *.443
tcp6  0/0/65535                        *.443
tcp4  0/0/5                            127.0.0.1.8083
tcp4  0/0/5                            127.0.0.1.5199
tcp46 0/0/65535                        *.8888
tcp6  0/0/256                          ::1.8954
tcp4  0/0/256                          127.0.0.1.8954
tcp6  0/0/256                          1000:a9:a6:300.80
tcp6  0/0/256                          ::1.53
tcp4  0/0/256                          192.212.30.87.80
tcp4  0/0/256                          127.0.0.1.80
tcp4  0/0/65535                        127.0.0.1.9100
tcp4  0/0/65535                        127.0.0.1.9970
tcp4  0/0/65535                        127.0.0.1.9123
tcp4  0/0/65535                        127.0.0.1.9289
tcp4  0/0/65535                        127.0.0.1.9119
tcp46 0/0/65535                        *.9324
tcp46 0/0/65535                        *.8000
tcp4  0/0/65535                        127.0.0.1.4444
tcp4  0/0/128                          *.22
tcp6  0/0/128                          *.22
Some tcp sockets may have been created.
unix  0/0/128                          /tmp/ssh-NZBPhqvAB7/agent.66959
unix  0/0/65535                        /var/run/some.sock
unix  0/0/255                          /var/db/syslog-ng.ctl
unix  0/0/65535                        /var/run/other.sock
unix  0/0/5                            /var/run/lldpd.socket
unix  0/0/100                          /var/run/mdnsd
unix  0/0/4                            /var/run/devd.pipe
unix  0/0/4                            /var/run/devd.seqpacket.pipe


It seems like the empty dictionaries tend to show up most of the time anyway, but in this particular output the interesting statistics are completely missing.