netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [nftables PATCH] Correct initial value of bytes counter in nftables rule
@ 2014-06-19 12:23 Yanchuan Nian
  2014-06-25 12:15 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Yanchuan Nian @ 2014-06-19 12:23 UTC (permalink / raw)
  To: pablo, kaber, kadlec, coreteam, netfilter-devel; +Cc: Yanchuan Nian

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [nftables PATCH] Correct initial value of bytes counter in nftables rule
  2014-06-19 12:23 [nftables PATCH] Correct initial value of bytes counter in nftables rule Yanchuan Nian
@ 2014-06-25 12:15 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2014-06-25 12:15 UTC (permalink / raw)
  To: Yanchuan Nian; +Cc: kaber, kadlec, coreteam, netfilter-devel

On Thu, Jun 19, 2014 at 08:23:47PM +0800, Yanchuan Nian wrote:
> 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.

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-06-25 12:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-19 12:23 [nftables PATCH] Correct initial value of bytes counter in nftables rule Yanchuan Nian
2014-06-25 12:15 ` Pablo Neira Ayuso

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).