summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Abeni <pabeni@redhat.com>2016-07-21 16:42:22 +0200
committerTobias Klauser <tklauser@distanz.ch>2016-07-21 17:08:16 +0200
commit4434db4bed874548cc5f3a28578d7b4758502d68 (patch)
tree326c09a4cb0046603e3e741162cb8e8e9d59e1da
parente864a07a07f3aeea2444b00ffc343523fecbab31 (diff)
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 <pabeni@redhat.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
-rw-r--r--netsniff-ng.c4
1 files 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);