Sockstat simply runs netstat and fstat and merges the results. It looks
like the netstat part isn't working. See if running "netstat -Aan
-finet" prints anything at all.
--
Dan Nelson
dne...@emsphone.com
To Unsubscribe: send mail to majo...@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message
team7# sockstat
USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS
root sshd1 13864 5
root sshd1 13744 5
nobody httpd 13684 16
nobody httpd 403 16
nobody httpd 166 16
nobody httpd 165 16
nobody httpd 164 16
nobody httpd 163 16
nobody httpd 162 16
root sshd1 149 3
root httpd 143 16
root sendmail 97 4
root inetd 92 4
root inetd 92 5
root inetd 92 6
root syslogd 74 4
team7# uname -a
FreeBSD team7.cba.ualr.edu 4.0-CURRENT FreeBSD 4.0-CURRENT #6: Wed Mar 1
13:01:
14 CST 2000 j...@team7.cba.ualr.edu:/usr/src/sys/compile/LOKI alpha
-joe
> Date: Sat, 4 Mar 2000 16:34:42 -0600
> From: Dan Nelson <dne...@emsphone.com>
> To: Joe <j...@team7.cba.ualr.edu>
> Cc: freebsd-...@FreeBSD.ORG
> Subject: Re: sockstat not reporting all
>
> In the last episode (Mar 04), Joe said:
> >
> > Should sockstat be reporting more info?
> >
> >
> > team7# sockstat
> > USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS
> > root sshd1 13864 5
> > root sshd1 13744 5
> [etc]
>
> Sockstat simply runs netstat and fstat and merges the results. It looks
> like the netstat part isn't working. See if running "netstat -Aan
> -finet" prints anything at all.
>
> --
> Dan Nelson
> dne...@emsphone.com
>
bash-2.03$ netstat -Aan -finet
Active Internet connections (including servers)
Socket Proto Recv-Q Send-Q Local Address Foreign Address (state)
fffffe00062547e0 tcp4 0 0 144.167.120.24.22 144.167.120.221.10 ESTABLISHED
fffffe000624dc20 tcp4 0 0 144.167.120.24.22 144.167.120.221.10 ESTABLISHED
fffffe000624eb40 tcp4 0 0 *.22 *.* LISTEN
fffffe000624eea0 tcp4 0 0 *.80 *.* LISTEN
fffffe000624f200 tcp4 0 0 *.25 *.* LISTEN
fffffe000624f560 tcp4 0 0 *.110 *.* LISTEN
fffffe000624f8c0 tcp4 0 0 *.79 *.* LISTEN
fffffe000624fc20 tcp4 0 0 *.21 *.* LISTEN
fffffe00061bbe60 udp4 0 0 *.514 *.*
Well...looks like its working to me.
On Sat, 4 Mar 2000, Dan Nelson wrote:
>
> Hm. The socket address looks real funny for a 32-bit pointer. Whoops.
> You're on an alpha :) The next step would be to run "fstat | grep
> internet" and see if the last column looks anything like the first
> column in the netstat output above. sockstat ties the two sets of
> output together with those columns.
>
bash-2.03$ netstat -Aan -finet
Active Internet connections (including servers)
Socket Proto Recv-Q Send-Q Local Address Foreign Address
(state)
fffffe00062547e0 tcp4 0 20 144.167.120.24.22 144.167.7.92.1022
ESTABLISHED
fffffe0006271200 tcp4 0 0 144.167.120.24.22 144.167.7.92.1023
ESTABLISHED
team7# fstat | grep internet
root sshd1 14580 5* internet stream tcp 62547e0
root sshd1 14552 5* internet stream tcp 6271200
Well, they match except, as you pointed out, that netstat shows a 64-bit
pointer and fstat shows as 32-bit. Just for grins I ran "perl -w
sockstat.pl" and I got the following messages:
bash-2.03$ perl -w sockstat.pl
USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS
Use of uninitialized value at sockstat.pl line 40, <FSTAT> chunk 34.
Use of uninitialized value at sockstat.pl line 40, <FSTAT> chunk 34.
Use of uninitialized value at sockstat.pl line 40, <FSTAT> chunk 34.
root sshd1 14580 5
Do you think I found the problem?
-Joe
Hm. The socket address looks real funny for a 32-bit pointer. Whoops.
You're on an alpha :) The next step would be to run "fstat | grep
internet" and see if the last column looks anything like the first
column in the netstat output above. sockstat ties the two sets of
output together with those columns.
--
Dan Nelson
dne...@emsphone.com
Hi, I tried to fix it on an alpha machine,
and the following patch seemd to fix it.
(And as far as the compile warning showed, there seems to be
also other several part where pointer printing format need to
be fixed.)
Cheers,
Yoshinobu Inoue
--- fstat.c.orig Mon Feb 21 03:06:01 2000
+++ fstat.c Sun Mar 5 14:57:50 2000
@@ -696,11 +696,11 @@
(void *)so.so_pcb);
goto bad;
}
- printf(" %x", (int)inpcb.inp_ppcb);
+ printf(" %8lx", (u_long)inpcb.inp_ppcb);
}
}
else if (so.so_pcb)
- printf(" %x", (int)so.so_pcb);
+ printf(" %8lx", (u_long)so.so_pcb);
break;
case AF_UNIX:
/* print address of pcb and connected pcb */