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
This commit is contained in:
parent
be460b9467
commit
97c6143c95
@ -27,7 +27,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd August 7, 2001
|
||||
.Dd August 25, 2004
|
||||
.Dt SOCKSTAT 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -121,6 +121,21 @@ if the endpoint could not be determined.
|
||||
The address the foreign end of the socket is bound to (see
|
||||
.Xr getpeername 2 ) .
|
||||
.El
|
||||
.Pp
|
||||
Note that TCP sockets in the
|
||||
.Dv AF_INET
|
||||
or
|
||||
.Dv AF_INET6
|
||||
domains that are not in one of the
|
||||
.Dv LISTEN ,
|
||||
.Dv SYN_SENT ,
|
||||
or
|
||||
.Dv ESTABLISHED
|
||||
states may not be shown by
|
||||
.Nm ;
|
||||
use
|
||||
.Xr netstat 1
|
||||
to examine them instead.
|
||||
.Sh SEE ALSO
|
||||
.Xr fstat 1 ,
|
||||
.Xr netstat 1 ,
|
||||
|
@ -494,6 +494,8 @@ display(void)
|
||||
"LOCAL ADDRESS", "FOREIGN ADDRESS");
|
||||
setpassent(1);
|
||||
for (xf = xfiles, n = 0; n < nxfiles; ++n, ++xf) {
|
||||
if (xf->xf_data == NULL)
|
||||
continue;
|
||||
hash = (int)((uintptr_t)xf->xf_data % HASHSIZE);
|
||||
for (s = sockhash[hash]; s != NULL; s = s->next)
|
||||
if ((void *)s->socket == xf->xf_data)
|
||||
|
Loading…
x
Reference in New Issue
Block a user