Commit Graph

21 Commits

Author SHA1 Message Date
Robert Watson
4cf172fd65 Remove unused v6 macro aliases for inpcb fields:
in6p_ip6_nxt
        in6p_vflag
        in6p_flags
        in6p_socket
        in6p_lport
        in6p_fport
        in6p_ppcb

Remove unused v6 macro aliases for inpcb flags:

        IN6P_HIGHPORT
        IN6P_LOWPORT
        IN6P_ANONPORT
        IN6P_RECVIF
        IN6P_MTUDISC
        IN6P_FAITH
        IN6P_CONTROLOPTS

References to in6p_lport and in6_fport in sockstat are also replaced with
normal inp_lport and inp_fport references.

MFC after:	3 days
Reviewed by:	bz
2009-03-10 17:57:41 +00:00
Dag-Erling Smørgrav
1ccdc84fdd Make sure the entries don't run into each other when they're longer than
the allotted space.

PR:		bin/129318
Submitted by:	Ighighi <ighighi@gmail.com>
MFC after:	3 weeks
2009-01-30 14:28:50 +00:00
Bruce M Simpson
f7916f9caf Add -L to usage(). 2008-05-19 11:35:11 +00:00
Bruce M Simpson
9b6ca89250 Add an -L option to ignore loopback Internet sockets.
MFC after:	2 weeks
2008-05-19 11:32:44 +00:00
Maxim Konovalov
48c513e07f o Do not warn if the process exits before we get its name.
PR:		bin/113777
Submitted by:	Dmitrij Tejblum
MFC after:	1 week
2007-06-16 20:24:55 +00:00
Ed Maste
f487a6a811 Use proc name (ki_comm) instead of thread name (ki_ocomm) as these may now
be different.
2007-03-22 17:47:58 +00:00
Giorgos Keramidas
d2d77d2aee In revision 1.14 I broke the -4 and -6 options of sockstat(1).
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
2006-11-12 19:03:39 +00:00
Giorgos Keramidas
1f3d67aade Add support for filtering sockets by protocol type. The default
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
2006-11-11 22:11:54 +00:00
Dag-Erling Smørgrav
fd0cba238e Don't free(sock) before it's even allocated.
Submitted by:	Joerg Sonnenberger <joerg@britannica.bec.de>
MFC after:	1 week
2005-06-10 06:36:03 +00:00
Ruslan Ermilov
4b2a3d41da Unbreak sockstat(1) on systems without the divert protocol. 2004-12-06 09:28:05 +00:00
Ruslan Ermilov
2cfbdf89b7 Show divert(4) sockets as well. 2004-12-05 14:17:14 +00:00
Peter Pentchev
97c6143c95 Do not display bogus entries for sockets in the TIME_WAIT or similar
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
2004-08-25 16:36:17 +00:00
John-Mark Gurney
b4eb37c63d make sockstat not print wierd addresses on not connected unix domain sockets
Pointed out by:	rwatson
Reviewed by:	peter
2003-07-19 06:23:56 +00:00
Maxime Henrion
ae94787d6d Finish the implementation of the -p switch so that it
actually works.  I have no idea why this wasn't finished
and happened to try to use it.
2003-06-07 14:36:49 +00:00
Robert Drehmel
9efed1e6e2 To reserve space for 65536 bits, allocate
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>
2003-05-09 09:11:27 +00:00
Matthew Dillon
48e3128b34 Bow to the whining masses and change a union back into void *. Retain
removal of unnecessary casts and throw in some minor cleanups to see if
anyone complains, just for the hell of it.
2003-01-13 00:33:17 +00:00
Matthew Dillon
cd72f2180b Change struct file f_data to un_data, a union of the correct struct
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.
2003-01-12 01:37:13 +00:00
Robert Drehmel
6dbe8d53a5 Use a cast to `void *' before casting to a pointer to a structure
to stop GCC emitting warnings about increased alignment requirements
which broke the build for sparc64.

Approved by:	des
2002-08-02 11:57:59 +00:00
Dag-Erling Smørgrav
02bd9db045 Don't depend on namespace pollution from <netinet/in_pcb.h>.
Submitted by:	bde
2002-08-01 16:49:31 +00:00
Dag-Erling Smørgrav
1e6690e5db Implement the -l and -c options, which I'd forgotten. 2002-08-01 11:02:30 +00:00
Dag-Erling Smørgrav
ca007d9172 Rewrite sockstat(1) in C.
Sponsored by:	DARPA, NAI Labs
2002-07-31 12:32:03 +00:00