Subject: CVS commit: src/usr.bin/netstat
To: None <source-changes@NetBSD.org>
From: Rui Paulo <rpaulo@netbsd.org>
List: source-changes
Date: 08/04/2005 19:39:40
Module Name:	src
Committed By:	rpaulo
Date:		Thu Aug  4 19:39:40 UTC 2005

Modified Files:
	src/usr.bin/netstat: main.c netstat.h
Added Files:
	src/usr.bin/netstat: bpf.c

Log Message:
Implemented the userland part of the BPF statistics and BPF peers,
net.bpf.stats and net.bpf.peers sysctls respectively. netstat(1) now
has an additional syntax:
	netstat [-s] [-B] [-I Interface]

Only the super user can see a list of BPF peers with the following command:
# netstat -B
Active BPF peers
PID     Int     Recv     Drop     Capt     Flags  Bufsize  Comm
4941    lo0     0        0        0        I--S-  262144   tcpdump
252     ex0     19668    0        5        I-RS-  32768    dhclient

And every user can see the BPF statistics with:
$ netstat -s -B
bpf:
        19669 total packets received
        5 total packets captured
        0 total packets dropped

This idea came from FreeBSD (Christian S.J. Peron) but, currently, they
doen't have a userland utility in the base system to read the sysctls.

Reviewed by: christos@


To generate a diff of this commit:
cvs rdiff -r0 -r1.1 src/usr.bin/netstat/bpf.c
cvs rdiff -r1.48 -r1.49 src/usr.bin/netstat/main.c
cvs rdiff -r1.30 -r1.31 src/usr.bin/netstat/netstat.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.