All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yanchuan Nian <ycnian@gmail.com>
To: pablo@netfilter.org, kaber@trash.net, kadlec@blackhole.kfki.hu,
	coreteam@netfilter.org, netfilter-devel@vger.kernel.org
Cc: Yanchuan Nian <ycnian@gmail.com>
Subject: [nftables PATCH] Correct initial value of bytes counter in nftables rule
Date: Thu, 19 Jun 2014 20:23:47 +0800	[thread overview]
Message-ID: <1403180627-5631-1-git-send-email-ycnian@gmail.com> (raw)

Packages can be accounted by nftables through such command.
% nft add rule filter output ip daddr 8.8.8.8 counter

You can also give the initial values of packets and bytes.
% nft add rule filter output ip daddr 8.8.8.8 counter  packets 10 bytes 20

But packets and bytes are both initialized to 10 in above command for there is
a mistake in the program.

Signed-off-by: Yanchuan Nian <ycnian@gmail.com>
---
 src/netlink_linearize.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/netlink_linearize.c b/src/netlink_linearize.c
index b0ca241..222d102 100644
--- a/src/netlink_linearize.c
+++ b/src/netlink_linearize.c
@@ -545,7 +545,7 @@ static void netlink_gen_counter_stmt(struct netlink_linearize_ctx *ctx,
 	}
 	if (stmt->counter.bytes) {
 		nft_rule_expr_set_u64(nle, NFT_EXPR_CTR_BYTES,
-				      stmt->counter.packets);
+				      stmt->counter.bytes);
 	}
 	nft_rule_add_expr(ctx->nlr, nle);
 }
-- 
1.9.3


             reply	other threads:[~2014-06-19 12:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-19 12:23 Yanchuan Nian [this message]
2014-06-25 12:15 ` [nftables PATCH] Correct initial value of bytes counter in nftables rule Pablo Neira Ayuso

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=1403180627-5631-1-git-send-email-ycnian@gmail.com \
    --to=ycnian@gmail.com \
    --cc=coreteam@netfilter.org \
    --cc=kaber@trash.net \
    --cc=kadlec@blackhole.kfki.hu \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.