From 3e071a78f2a5c7424340b4c8b446d51e82413c13 Mon Sep 17 00:00:00 2001 From: Daniel Borkmann Date: Mon, 3 Jun 2013 23:24:18 +0200 Subject: netsniff-ng: v3: fix packet accounting on --num We need to carry frame_count through multiple calls of walk function to account correctly for --num . Also, move socket stats printing into rx ring, since it belongs there. Todo: the kernel socket seems to have a different count that what we see. This needs to be fixed one way or the other. Not yet sure what's causing this. Signed-off-by: Daniel Borkmann --- xutils.c | 22 ---------------------- 1 file changed, 22 deletions(-) (limited to 'xutils.c') diff --git a/xutils.c b/xutils.c index a5fbb3c..eea258c 100644 --- a/xutils.c +++ b/xutils.c @@ -608,28 +608,6 @@ void device_set_flags(const char *ifname, const short flags) close(sock); } -void sock_print_net_stats(int sock) -{ - int ret; - struct tpacket_stats kstats; - - socklen_t slen = sizeof(kstats); - - memset(&kstats, 0, sizeof(kstats)); - ret = getsockopt(sock, SOL_PACKET, PACKET_STATISTICS, &kstats, &slen); - if (ret > -1) { - uint64_t packets = kstats.tp_packets; - uint64_t drops = kstats.tp_drops; - - printf("\r%12ld packets incoming\n", packets); - printf("\r%12ld packets passed filter\n", packets - drops); - printf("\r%12ld packets failed filter (out of space)\n", drops); - if (kstats.tp_packets > 0) - printf("\r%12.4lf%\% packet droprate\n", - (1.0 * drops / packets) * 100.0); - } -} - void register_signal(int signal, void (*handler)(int)) { sigset_t block_mask; -- cgit v1.2.3-54-g00ecf