From 4434db4bed874548cc5f3a28578d7b4758502d68 Mon Sep 17 00:00:00 2001 From: Paolo Abeni Date: Thu, 21 Jul 2016 16:42:22 +0200 Subject: netsniff-ng: Increment pkts_seen after packet type check Currently in receive_to_xmit() pkts_seen is incremented before the packet type check, but failing the latter will cause the packet to be ignored, pretty much as if it failed to pass the filter. This change moves the accunting after the check, as is currently done in both walk_t3_block() and recv_only_or_dump(). Signed-off-by: Paolo Abeni Signed-off-by: Tobias Klauser --- netsniff-ng.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/netsniff-ng.c b/netsniff-ng.c index 4cfabc1..ab99bb1 100644 --- a/netsniff-ng.c +++ b/netsniff-ng.c @@ -480,11 +480,11 @@ static void receive_to_xmit(struct ctx *ctx) hdr_in = rx_ring.frames[it_in].iov_base; in = ((uint8_t *) hdr_in) + hdr_in->tp_h.tp_mac; - ctx->pkts_seen++; - if (skip_packet(ctx, &hdr_in->s_ll)) goto next; + ctx->pkts_seen++; + hdr_out = tx_ring.frames[it_out].iov_base; out = ((uint8_t *) hdr_out) + TPACKET2_HDRLEN - sizeof(struct sockaddr_ll); -- cgit v1.2.3-54-g00ecf