Proposed patch to the kernel and to netstat...

gnn at freebsd.org gnn at freebsd.org
Thu May 15 03:15:09 UTC 2008


Howdy,

I have developed the attached patch which extends the functionality of
netstat (via the -x flag) to show us all the socket buffer
statistics.  The kernel change counts mbufs, as well as clusters (at
the moment of any size) and gives output like this:

Proto Recv-Q Send-Q  Local Address          Foreign Address       R-MBUF S-MBUF R-CLUS S-CLUS R-HIWA S-HIWA R-LOWA S-LOWA R-BCNT S-BCNT R-BMAX S-BMAX (state)
tcp4       0      0 127.0.0.1.6010         *.*                         0      0      0      0  65536  32768      1   2048      0      0 262144 262144 LISTEN
tcp6       0      0 ::1.6010               *.*                         0      0      0      0  65536  32768      1   2048      0      0 262144 262144 LISTEN
tcp4       0      0 172.16.186.130.22      172.16.186.1.53443          0      0      0      0  66608  33304      1   2048      0      0 262144 262144 ESTABLISHED
tcp4       0      0 172.16.186.130.29178   172.16.186.1.22             0      0      0      0      0      0      0      0      0      0      0      0 TIME_WAIT
tcp4       0      0 172.16.186.130.62302   69.147.83.41.22             0      0      0      0  65700  74540      1   2048      0      0 262144 262144 ESTABLISHED
tcp4       0      0 127.0.0.1.62415        127.0.0.1.6010              0      0      0      0      0      0      0      0      0      0      0      0 TIME_WAIT


Note you need a very wide screen  to read that.

The man page is also updated but the relevant bits are:

     The -x flag causes netstat to output all the information recorded about
     data stored in the socket buffers.  The fields are:

     R-MBUF    Number of mbufs in the receive queue.
     S-MBUF    Number of mbufs in the send queue.
     R-CLUS    Number of clusters, of any type, in the recieve queue.
     S-CLUS    Number of clusters, of any type, in the send queue.
     R-HIWA    Receive buffer high water mark, in bytes.
     S-HIWA    Send buffer high water mark, in bytes.
     R-LOWA    Receive buffer low water mark, in bytes.
     S-LOWA    Send buffer low water mark, in bytes.
     R-BCNT    Receive buffer byte count.
     S-BCNT    Send buffer byte count.
     R-BMAX    Maximum bytes that can be used in the receive buffer.
     S-BMAX    Maximum bytes that can be used in the send buffer.


Please email me comments.  I'd like to commit this to HEAD soon.  It
can't be put into 7 without removing the cluster and mbuf counting,
but I might do that as well if there is interest.

Best,
George

-------------- next part --------------
A non-text attachment was scrubbed...
Name: netstat.diff
Type: application/octet-stream
Size: 8920 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-net/attachments/20080515/117616e4/netstat.obj


More information about the freebsd-net mailing list