? .swp Index: bpf.c =================================================================== RCS file: /home/ncvs/src/sys/net/bpf.c,v retrieving revision 1.175 diff -u -p -r1.175 bpf.c --- bpf.c 28 Jan 2007 16:38:44 -0000 1.175 +++ bpf.c 2 Feb 2007 19:24:45 -0000 @@ -633,6 +633,10 @@ bpfwrite(struct cdev *dev, struct uio *u #endif NET_LOCK_GIANT(); error = (*ifp->if_output)(ifp, m, &dst, NULL); + if (error == 0) + ++d->bd_wcount; + else + ++d->bd_ecount; NET_UNLOCK_GIANT(); /* * The driver frees the mbuf. @@ -659,6 +663,8 @@ reset_d(struct bpf_d *d) d->bd_rcount = 0; d->bd_dcount = 0; d->bd_fcount = 0; + d->bd_wcount = 0; + d->bd_ecount = 0; } /* @@ -1690,6 +1696,7 @@ bpfstats_fill_xbpf(struct xbpf_d *d, str bzero(d, sizeof(*d)); BPFD_LOCK_ASSERT(bd); + d->bd_size = sizeof(*d); d->bd_immediate = bd->bd_immediate; d->bd_promisc = bd->bd_promisc; d->bd_hdrcmplt = bd->bd_hdrcmplt; @@ -1698,6 +1705,8 @@ bpfstats_fill_xbpf(struct xbpf_d *d, str d->bd_rcount = bd->bd_rcount; d->bd_dcount = bd->bd_dcount; d->bd_fcount = bd->bd_fcount; + d->bd_wcount = bd->bd_wcount; + d->bd_ecount = bd->bd_ecount; d->bd_sig = bd->bd_sig; d->bd_slen = bd->bd_slen; d->bd_hlen = bd->bd_hlen; Index: bpfdesc.h =================================================================== RCS file: /home/ncvs/src/sys/net/bpfdesc.h,v retrieving revision 1.36 diff -u -p -r1.36 bpfdesc.h --- bpfdesc.h 29 Jan 2007 14:41:03 -0000 1.36 +++ bpfdesc.h 2 Feb 2007 19:24:45 -0000 @@ -92,6 +92,8 @@ struct bpf_d { u_long bd_fcount; /* number of packets which matched filter */ pid_t bd_pid; /* PID which created descriptor */ int bd_locked; /* true if descriptor is locked */ + u_long bd_wcount; /* # of packets written ok */ + u_long bd_ecount; /* # of packet written with errors */ }; /* Values for bd_state */ @@ -116,6 +118,7 @@ struct bpf_d { * External representation of the bpf descriptor */ struct xbpf_d { + size_t bd_size; /* size of this instance */ u_char bd_promisc; u_char bd_immediate; int bd_hdrcmplt; @@ -131,6 +134,9 @@ struct xbpf_d { pid_t bd_pid; char bd_ifname[IFNAMSIZ]; int bd_locked; + /* fields introduced in the 7.0+ ABI */ + u_long bd_wcount; + u_long bd_ecount; }; #define BPFIF_LOCK(bif) mtx_lock(&(bif)->bif_mtx)