Date: Thu, 3 May 2012 17:08:41 +0000 (UTC) From: Luigi Rizzo <luigi@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r234975 - head/tools/tools/netmap Message-ID: <201205031708.q43H8fax053623@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: luigi Date: Thu May 3 17:08:40 2012 New Revision: 234975 URL: http://svn.freebsd.org/changeset/base/234975 Log: add support for pcap receive statistics (used by net-mgmt/darkstat) Modified: head/tools/tools/netmap/README head/tools/tools/netmap/pcap.c Modified: head/tools/tools/netmap/README ============================================================================== --- head/tools/tools/netmap/README Thu May 3 16:54:32 2012 (r234974) +++ head/tools/tools/netmap/README Thu May 3 17:08:40 2012 (r234975) @@ -20,3 +20,4 @@ BSD netmap --------------------------------------------------- 0.77 3.82 ports/trafshow (version 5) 0.94 7.7 net-mgmt/ipcad (ip accounting daemon) + 0.9 5.0 net-mgmt/darkstat (ip accounting + graphing) Modified: head/tools/tools/netmap/pcap.c ============================================================================== --- head/tools/tools/netmap/pcap.c Thu May 3 16:54:32 2012 (r234974) +++ head/tools/tools/netmap/pcap.c Thu May 3 17:08:40 2012 (r234975) @@ -154,6 +154,8 @@ int pcap_setdirection(pcap_t *p, pcap_di char *pcap_lookupdev(char *errbuf); int pcap_inject(pcap_t *p, const void *buf, size_t size); int pcap_fileno(pcap_t *p); +const char *pcap_lib_version(void); + struct eproto { const char *s; @@ -318,6 +320,11 @@ struct eproto eproto_db[] = { }; +const char *pcap_lib_version(void) +{ + return pcap_version; +} + int pcap_findalldevs(pcap_if_t **alldevsp, __unused char *errbuf) { @@ -532,10 +539,8 @@ pcap_stats(pcap_t *p, struct pcap_stat * struct my_ring *me = p; ND(""); - me->st.ps_recv += 10; *ps = me->st; - sprintf(me->msg, "stats not supported"); - return -1; + return 0; /* accumulate from pcap_dispatch() */ }; char * @@ -670,6 +675,7 @@ pcap_dispatch(pcap_t *p, int cnt, pcap_h got++; } } + me->st.ps_recv += got; return got; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201205031708.q43H8fax053623>