summaryrefslogtreecommitdiffstats
path: root/src/conntrack/parse.c
diff options
context:
space:
mode:
author/C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org>2007-05-29 15:10:45 +0000
committer/C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org>2007-05-29 15:10:45 +0000
commit63965deb5fff9f06b72dd71abf6596d46cdfea5c (patch)
tree0c64f01376ae28fde648f8aae3ddf15057858fbf /src/conntrack/parse.c
parent11c5237ffd9e3bda5cac4c9156556e9050e6a9c8 (diff)
add support for 64 bits counters (Krzysztof Oledzki)
Diffstat (limited to 'src/conntrack/parse.c')
-rw-r--r--src/conntrack/parse.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/src/conntrack/parse.c b/src/conntrack/parse.c
index b9bc095..db04789 100644
--- a/src/conntrack/parse.c
+++ b/src/conntrack/parse.c
@@ -182,10 +182,18 @@ static void __parse_counters(const struct nfattr *attr,
struct nfattr *tb[CTA_COUNTERS_MAX];
nfnl_parse_nested(tb, CTA_COUNTERS_MAX, attr);
- if (tb[CTA_COUNTERS32_PACKETS-1]) {
- ct->counters[dir].packets
- = ntohl(*(u_int32_t *)
- NFA_DATA(tb[CTA_COUNTERS32_PACKETS-1]));
+ if (tb[CTA_COUNTERS_PACKETS-1] || tb[CTA_COUNTERS32_PACKETS-1]) {
+
+ if (tb[CTA_COUNTERS32_PACKETS-1])
+ ct->counters[dir].packets
+ = ntohl(*(u_int32_t *)
+ NFA_DATA(tb[CTA_COUNTERS32_PACKETS-1]));
+
+ if (tb[CTA_COUNTERS_PACKETS-1])
+ ct->counters[dir].packets
+ = __be64_to_cpu(*(u_int64_t *)
+ NFA_DATA(tb[CTA_COUNTERS_PACKETS-1]));
+
switch(dir) {
case __DIR_ORIG:
set_bit(ATTR_ORIG_COUNTER_PACKETS, ct->set);
@@ -195,10 +203,18 @@ static void __parse_counters(const struct nfattr *attr,
break;
}
}
- if (tb[CTA_COUNTERS32_BYTES-1]) {
- ct->counters[dir].bytes
- = ntohl(*(u_int32_t *)
- NFA_DATA(tb[CTA_COUNTERS32_BYTES-1]));
+ if (tb[CTA_COUNTERS_BYTES-1] || tb[CTA_COUNTERS32_BYTES-1]) {
+
+ if (tb[CTA_COUNTERS32_BYTES-1])
+ ct->counters[dir].bytes
+ = ntohl(*(u_int32_t *)
+ NFA_DATA(tb[CTA_COUNTERS32_BYTES-1]));
+
+ if (tb[CTA_COUNTERS_BYTES-1])
+ ct->counters[dir].bytes
+ = __be64_to_cpu(*(u_int64_t *)
+ NFA_DATA(tb[CTA_COUNTERS_BYTES-1]));
+
switch(dir) {
case __DIR_ORIG:
set_bit(ATTR_ORIG_COUNTER_BYTES, ct->set);