netstat / sockstat in jail don't list tcp/udp sockets

From: Florian Smeets <flo_at_smeets.xyz>
Date: Fri, 3 Jan 2020 00:33:45 +0100
Hi,

maybe all of this is related to the net.inet.tcp.pcblist error message 
further down.

What works on 12.1 (host running stable/12, jail running 12.1-RELEASE)

root_at_db21:~ # sockstat -4 -l -P tcp
USER     COMMAND    PID   FD PROTO  LOCAL ADDRESS         FOREIGN ADDRESS
root     sshd       3907  4  tcp4   *:22                  *:*
root     perl       3885  6  tcp4   *:4949                *:*
mysql    mysqld     3771  11 tcp4   *:4567                *:*
mysql    mysqld     3771  38 tcp46  *:3306                *:*
nagios   nrpe3      3465  4  tcp4   *:5666                *:*
root     master     3459  13 tcp4   *:25                  *:*

root_at_db21:~ # netstat -nl -p tcp
Active Internet connections
Proto Recv-Q Send-Q Local Address 
Foreign Address                               (state)
tcp4       0      0 172.17.2.33.4567 
172.17.1.33.22220                             ESTABLISHED
tcp4       0      0 172.17.2.33.58278 
172.17.3.33.4567                              ESTABLISHED
root_at_db21:~ # sysctl net.inet.tcp.pcblist
root_at_db21:~ # echo $?
0

doesn't work on head (r356268, host world/kernel and jail are in sync)

root_at_db31:/ # sockstat -4 -l -P tcp
USER     COMMAND    PID   FD PROTO  LOCAL ADDRESS         FOREIGN ADDRESS
root_at_db31:/ # netstat -nl -p tcp
netstat: sysctl: net.inet.tcp.pcblist: No such file or directory
root_at_db31:/ # sysctl net.inet.tcp.pcblist
root_at_db31:/ # echo $?
0
root_at_db31:/ # exit
root_at_host:~ # sockstat -4 -l -P tcp -j db31
USER     COMMAND    PID   FD PROTO  LOCAL ADDRESS         FOREIGN ADDRESS
root     sshd       40    3  tcp4   *:22                  *:*
88       mysqld     23261 11 tcp4   *:4567                *:*
88       mysqld     23261 37 tcp4   *:3306                *:*

As db31 is my only jail running head and I only set this up in December 
I cannot tell how long this has been broken.

Florian
Received on Thu Jan 02 2020 - 22:33:53 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:22 UTC