Currently in receive_to_xmit() pkts_seen is incremented before
after 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 move the accunting after the check, as is currently
done in both walk_t3_block() and recv_only_or_dump().

Signed-off-by: Paolo Abeni <>
 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);

You received this message because you are subscribed to the Google Groups 
"netsniff-ng" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
For more options, visit

Reply via email to