]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
netlink: Correct initial value of bytes counter in nftables rule
authorYanchuan Nian <ycnian@gmail.com>
Thu, 19 Jun 2014 12:23:47 +0000 (20:23 +0800)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 25 Jun 2014 12:13:03 +0000 (14:13 +0200)
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>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/netlink_linearize.c

index 8db333cc33642098263b35bbb116ca003123a474..5c1b46dd19f89b47f09db1341ffa372b55af5e0d 100644 (file)
@@ -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);
 }