summaryrefslogtreecommitdiff
path: root/src/traffic_stats.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2009-02-20 18:33:52 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2009-02-20 18:33:52 +0100
commit9d67451ca43b0a469f16d0d139e014b9a5fee33d (patch)
tree3b66d739972ee36f471e22a85eff09771beb9a87 /src/traffic_stats.c
parent1606369707325e2f68ffe225917d7ea637ddb9de (diff)
downloadconntrack-tools-9d67451ca43b0a469f16d0d139e014b9a5fee33d.tar.gz
conntrack-tools-9d67451ca43b0a469f16d0d139e014b9a5fee33d.zip
headers: don't use NFCT_DIR_MAX in statistics structure
This patch removes the use of NFCT_DIR_MAX. This constant is part of the old libnetfilter_conntrack API which has been removed from the git tree. It was introduced in the early days of conntrackd, thus, the use of this constant. Unfortunately, I did not notice until now. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/traffic_stats.c')
-rw-r--r--src/traffic_stats.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/traffic_stats.c b/src/traffic_stats.c
index 52ca09a..6535527 100644
--- a/src/traffic_stats.c
+++ b/src/traffic_stats.c
@@ -21,13 +21,13 @@
void update_traffic_stats(struct nf_conntrack *ct)
{
- STATE(stats).bytes[NFCT_DIR_ORIGINAL] +=
+ STATE(stats).bytes_orig +=
nfct_get_attr_u32(ct, ATTR_ORIG_COUNTER_BYTES);
- STATE(stats).bytes[NFCT_DIR_REPLY] +=
+ STATE(stats).bytes_repl +=
nfct_get_attr_u32(ct, ATTR_REPL_COUNTER_BYTES);
- STATE(stats).packets[NFCT_DIR_ORIGINAL] +=
+ STATE(stats).packets_orig +=
nfct_get_attr_u32(ct, ATTR_ORIG_COUNTER_PACKETS);
- STATE(stats).packets[NFCT_DIR_REPLY] +=
+ STATE(stats).packets_repl +=
nfct_get_attr_u32(ct, ATTR_REPL_COUNTER_PACKETS);
}
@@ -35,10 +35,9 @@ void dump_traffic_stats(int fd)
{
char buf[512];
int size;
- uint64_t bytes = STATE(stats).bytes[NFCT_DIR_ORIGINAL] +
- STATE(stats).bytes[NFCT_DIR_REPLY];
- uint64_t packets = STATE(stats).packets[NFCT_DIR_ORIGINAL] +
- STATE(stats).packets[NFCT_DIR_REPLY];
+ uint64_t bytes = STATE(stats).bytes_orig + STATE(stats).bytes_repl;
+ uint64_t packets = STATE(stats).packets_orig +
+ STATE(stats).packets_repl;
size = sprintf(buf, "traffic processed:\n");
size += sprintf(buf+size, "%20llu Bytes ", (unsigned long long)bytes);