From: Eric Leblond <eric@regit.org>
To: netfilter-devel <netfilter-devel@vger.kernel.org>
Cc: Eric Leblond <eric@regit.org>
Subject: [libnetfilter_acct PATCH] Fix packets and bytes inversion.
Date: Wed, 26 Dec 2012 23:30:52 +0100 [thread overview]
Message-ID: <1356561052-32655-1-git-send-email-eric@regit.org> (raw)
Pkts and bytes are inversed in some part of the code. This patch
fixes most of the occurence of this problem.
Signed-off-by: Eric Leblond <eric@regit.org>
---
src/libnetfilter_acct.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/libnetfilter_acct.c b/src/libnetfilter_acct.c
index 6a3a839..0abaeac 100644
--- a/src/libnetfilter_acct.c
+++ b/src/libnetfilter_acct.c
@@ -106,11 +106,11 @@ nfacct_attr_set(struct nfacct *nfacct, enum nfacct_attr_type type,
nfacct->bitset |= (1 << NFACCT_ATTR_NAME);
break;
case NFACCT_ATTR_PKTS:
- nfacct->bytes = *((uint64_t *) data);
+ nfacct->pkts = *((uint64_t *) data);
nfacct->bitset |= (1 << NFACCT_ATTR_PKTS);
break;
case NFACCT_ATTR_BYTES:
- nfacct->pkts = *((uint64_t *) data);
+ nfacct->bytes = *((uint64_t *) data);
nfacct->bitset |= (1 << NFACCT_ATTR_BYTES);
break;
}
@@ -237,9 +237,9 @@ nfacct_snprintf_plain(char *buf, size_t rem, struct nfacct *nfacct,
ret = snprintf(buf, rem,
"{ pkts = %.20llu, bytes = %.20llu } = %s;",
(unsigned long long)
- nfacct_attr_get_u64(nfacct, NFACCT_ATTR_BYTES),
- (unsigned long long)
nfacct_attr_get_u64(nfacct, NFACCT_ATTR_PKTS),
+ (unsigned long long)
+ nfacct_attr_get_u64(nfacct, NFACCT_ATTR_BYTES),
nfacct_attr_get_str(nfacct, NFACCT_ATTR_NAME));
} else {
ret = snprintf(buf, rem, "%s\n",
@@ -426,7 +426,7 @@ void nfacct_nlmsg_build_payload(struct nlmsghdr *nlh, struct nfacct *nfacct)
mnl_attr_put_u64(nlh, NFACCT_PKTS, htobe64(nfacct->pkts));
if (nfacct->bitset & (1 << NFACCT_ATTR_BYTES))
- mnl_attr_put_u64(nlh, NFACCT_PKTS, htobe64(nfacct->bytes));
+ mnl_attr_put_u64(nlh, NFACCT_BYTES, htobe64(nfacct->bytes));
}
EXPORT_SYMBOL(nfacct_nlmsg_build_payload);
--
1.7.10.4
next reply other threads:[~2012-12-26 22:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-26 22:30 Eric Leblond [this message]
2012-12-27 8:18 ` [libnetfilter_acct PATCH] Fix packets and bytes inversion Eric Leblond
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1356561052-32655-1-git-send-email-eric@regit.org \
--to=eric@regit.org \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).