Using either one of the two would result in an empty protos[]
array, and no sockets were actually listed:
% sockstat -4
USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS
% sockstat -6
USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS
%
Fix this bug by tweaking appropriately the logic of handling opt_4,
opt_6, opt_u and protos_defined.
Submitted by: des
Pointy hat: keramida
behavior of sockstat(1) will still be to show "udp", "tcp" and
"divert" protocols, but we can now provide a (comma-separated)
list of protocols, as in:
% sockstat -P tcp
to list only TCP sockets, or we can filter more than one protocol
by separating the protocol names with a comma:
% sockstat -P tcp,udp
Protocol names are parsed with getprotobyname(3), so any protocol
whose name is listed in `/etc/protocols' should work fine.
Submitted by: Josh Carroll <josh.carroll@psualum.com>
Approved by: des
states that no longer have a corresponding file descriptor - until now,
sockstat would mostly randomly match null kern.file.*.xf_data fields
with the first mostly-closed socket.
This bugfix is a RELENG_5 candidate.
Approved by: andre
65536 / (sizeof(int) * CHAR_BITS) `int's instead of
65536 / (sizeof(int) * CHAR_BITS) bytes to avoid a possible
segmentation fault if ports above 16383 are specified via the
-p option on a platform with 4 byte wide ints.
Approved by: re (bmah)
Reported by: Marco Wertejuk <wertejuk@mwcis.com>
pointer types, and remove a huge number of casts from code using it.
Change struct xfile xf_data to xun_data (ABI is still compatible).
If we need to add a #define for f_data and xf_data we can, but I don't
think it will be necessary. There are no operational changes in this
commit.
wrote, and as such was not very pretty.
Changes that may cause problems for people who use sockstat in scripts:
- sockstat(8) now displays Unix domain sockets in addition to IPv4 and IPv6
- the last period in local and foreign addresses is changed to a colon to
make the port number easier to spot
- IPv4 and IPv6 sockets are listed separately (IPv4 first, then IPv6, then
Unix)
Sockstat use netstat tcp/udp socket print, and fstat tcp/udp
socket print, but it just specify all of IPPROTO_IP and
IPPROTO_IPV6 sockets for fstat.
Now IPv6 socket also use raw socket, but only netstat don't print it,
so now they are printed as empty entries in sockstat output.
Approved by: jkh