On Tue, 2007-09-11 at 10:35 -0700, Rick Jones wrote: > > ss command from iproute2 package ( > > http://linux-net.osdl.org/index.php/Iproute2 ) > > > > Problem with /proc/net/tcp is its quadratic time O(N^2) to output N lines... > > I could see where that might be a problem. > > >>>Rick, could you add this part in your patch, and add my Sign-off-by ? > >> > >>My pleasure. > >> > >>I have a small test program for the tcp_info bit - where do I go to find > >>how the inet diag stuff works? > > > > > > ss state listen > > hpcpc103:~# ss --version > ss utility, iproute2-ss070313 > hpcpc103:~# ss state listen > ss: no socket states to show with such filter.
looks like 'ss state listening' or 'ss -l' is the right syntax. > hpcpc103:~# ss --all > State Recv-Q Send-Q Local Address:Port Peer > Address:Port > LISTEN 0 128 *:sunrpc *:* > > LISTEN 0 128 *:auth *:* > > LISTEN 0 128 :::ssh :::* > > LISTEN 0 20 127.0.0.1:smtp *:* > > LISTEN 0 128 *:42137 *:* > > > > > > > >>BTW, what do people think about doing the same thing with the rxqueue > >>and txqueue's of netstat output? > >> > > > > > > I dont understand this question, I thought your patch already handled this > > (for the txqueue, since rxqueue is already there), as netstat uses > > /proc/net/tcp (unfortunatly) > > Well, it doesn't seem to be the case. This is from the same system as > the ss output above: > > hpcpc103:~# netstat -an | grep LISTEN > tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN > tcp 0 0 0.0.0.0:113 0.0.0.0:* LISTEN > tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN > tcp 0 0 0.0.0.0:42137 0.0.0.0:* LISTEN > tcp6 0 0 :::22 :::* LISTEN > unix 2 [ ACC ] STREAM LISTENING 5666 /var/run/acpid.socket > > I thought I saw some other code in there when I was stumbling around. Yes. netstat code seems to have a explicit check for TCP_LISTEN state and zeroing txq and rxq. >From tcp_do_one() in netstat.c if (state == TCP_LISTEN) { time_len = 0; retr = 0L; rxq = 0L; txq = 0L; } We should fix this. Also i think it is a good idea to update netstat to use INET_DIAG_INFO instead of /proc/net/tcp. Thanks Sridhar - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html