*/
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/libpcap/pcap-bpf.c,v 1.45 2001-04-30 16:10:51 fenner Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/pcap-bpf.c,v 1.46 2001-07-29 01:22:40 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
{
struct bpf_stat s;
+ /*
+ * "ps_recv" counts packets handed to the filter, not packets
+ * that passed the filter.
+ *
+ * "ps_drop" counts packets dropped inside the BPF device
+ * because we ran out of buffer space. It doesn't count
+ * packets dropped by the interface driver. It counts
+ * only packets that passed the filter.
+ */
if (ioctl(p->fd, BIOCGSTATS, (caddr_t)&s) < 0) {
snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "BIOCGSTATS: %s",
pcap_strerror(errno));
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/libpcap/pcap-dlpi.c,v 1.69 2001-07-28 23:12:48 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/pcap-dlpi.c,v 1.70 2001-07-29 01:22:40 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
pcap_stats(pcap_t *p, struct pcap_stat *ps)
{
+ /*
+ * "ps_recv" counts packets handed to the filter, not packets
+ * that passed the filter.
+ *
+ * "ps_drop" counts packets dropped inside the DLPI service
+ * provider device device because of flow control requirements
+ * or resource exhaustion; it doesn't count packets dropped by
+ * the interface driver, or packets dropped upstream. As
+ * filtering is done in userland, it counts packets regardless
+ * of whether they would've passed the filter.
+ */
*ps = p->md.stat;
return (0);
}
*/
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/libpcap/pcap-linux.c,v 1.59 2001-06-18 08:46:30 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/pcap-linux.c,v 1.60 2001-07-29 01:22:41 guy Exp $ (LBL)";
#endif
/*
int
pcap_stats(pcap_t *handle, struct pcap_stat *stats)
{
+ /*
+ * "ps_recv" counts only packets that passed the filter.
+ *
+ * "ps_drop" isn't maintained.
+ */
*stats = handle->md.stat;
return 0;
}
*/
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/libpcap/pcap-nit.c,v 1.39 2000-10-28 00:01:29 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/pcap-nit.c,v 1.40 2001-07-29 01:22:41 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
pcap_stats(pcap_t *p, struct pcap_stat *ps)
{
+ /*
+ * "ps_recv" counts packets handed to the filter, not packets
+ * that passed the filter.
+ *
+ * "ps_drop" presumably counts packets dropped by the socket
+ * because of flow control requirements or resource exhaustion;
+ * it doesn't count packets dropped by the interface driver.
+ * As filtering is done in userland, it counts packets regardless
+ * of whether they would've passed the filter.
+ */
*ps = p->md.stat;
return (0);
}
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/libpcap/pcap-pf.c,v 1.63 2001-07-28 22:53:07 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/pcap-pf.c,v 1.64 2001-07-29 01:22:42 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
pcap_stats(pcap_t *p, struct pcap_stat *ps)
{
+ /*
+ * "ps_recv" counts only packets that passed the filter.
+ *
+ * "ps_drop" counts packets that passed the kernel filter
+ * (if any) but were dropped because the input queue was
+ * full. It counts packets regardless of whether they would
+ * have passed a userland filter.
+ *
+ * "ps_ifdrop" counts packets dropped by the network
+ * inteface (regardless of whether they would have passed
+ * the input filter, of course).
+ */
ps->ps_recv = p->md.TotAccepted;
ps->ps_drop = p->md.TotDrops;
ps->ps_ifdrop = p->md.TotMissed - p->md.OrigMissed;
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/libpcap/pcap-snit.c,v 1.54 2000-10-28 00:01:30 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/pcap-snit.c,v 1.55 2001-07-29 01:22:42 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
pcap_stats(pcap_t *p, struct pcap_stat *ps)
{
+ /*
+ * "ps_recv" counts packets handed to the filter, not packets
+ * that passed the filter.
+ *
+ * "ps_drop" counts packets dropped inside the "/dev/nit"
+ * device because of flow control requirements or resource
+ * exhaustion; it doesn't count packets dropped by the
+ * interface driver, or packets dropped upstream. As filtering
+ * is done in userland, it counts packets regardless of whether
+ * they would've passed the filter.
+ */
*ps = p->md.stat;
return (0);
}
*/
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/libpcap/pcap-snoop.c,v 1.31 2001-06-05 03:48:41 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/pcap-snoop.c,v 1.32 2001-07-29 01:22:43 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
return (-1);
}
+ /*
+ * "ifdrops" are those dropped by the network interface
+ * due to resource shortages or hardware errors.
+ *
+ * "sbdrops" are those dropped due to socket buffer limits.
+ *
+ * As filter is done in userland, "sbdrops" counts packets
+ * regardless of whether they would've passed the filter.
+ *
+ * XXX - does this count *all* Snoop or Drain sockets,
+ * rather than just this socket? If not, why does it have
+ * both Snoop and Drain statistics?
+ */
p->md.stat.ps_drop =
rs->rs_snoop.ss_ifdrops + rs->rs_snoop.ss_sbdrops +
rs->rs_drain.ds_ifdrops + rs->rs_drain.ds_sbdrops;
+ /*
+ * "ps_recv" counts only packets that passed the filter.
+ */
*ps = p->md.stat;
return (0);
}