From 4f245b484aa903b545768532edbdc3efffb949c2 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Fri, 7 Jun 2013 19:54:53 +0200 Subject: main: account dropped packets Signed-off-by: Pablo Neira Ayuso --- main.c | 9 +++++++-- test.h | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index fcffbad..7f8221d 100755 --- a/main.c +++ b/main.c @@ -13,6 +13,7 @@ #include "include/helper.h" #include "test.h" +#include #include struct cthelper_test_stats cthelper_test_stats; @@ -132,6 +133,9 @@ cthelper_process_packet(const uint8_t *pkt, uint32_t pktlen, } else ret = h->cb(pktb, dataoff, ct->myct, ctinfo); + if (ret == NF_DROP) + cthelper_test_stats.pkts_dropped++; + pktb_free(pktb); return ret; @@ -211,11 +215,12 @@ int main(int argc, char *argv[]) ret = EXIT_SUCCESS; printf("\e[1;34mTest results: expect_created=%d packets=%d " - "packets_skipped=%d\e[0m\n", + "packets_skipped=%d packets_dropped=%d\e[0m\n", cthelper_test_stats.ct_expect_created, cthelper_test_stats.pkts, cthelper_test_stats.pkt_mismatch_proto + - cthelper_test_stats.pkt_mismatch_port); + cthelper_test_stats.pkt_mismatch_port, + cthelper_test_stats.pkts_dropped); return ret; } diff --git a/test.h b/test.h index 4f5a6b6..ebcdd53 100644 --- a/test.h +++ b/test.h @@ -6,6 +6,7 @@ struct cthelper_test_stats { int pkt_mismatch_proto; int pkt_mismatch_port; int ct_expect_created; + int pkts_dropped; }; extern struct cthelper_test_stats cthelper_test_stats; -- cgit v1.2.3