Correct initial value of bytes counter in nftables rule
PATCH 1/1 Correct initial value of bytes counter in nftables rule
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.
--- src/netlink_linearize.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
src/netlink_linearize.c +1 -1
@@ -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); }
Signature · 1 line
1.9.3
Quoted 8 lines · 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 20But packets and bytes are both initialized to 10 in above command for there is a mistake in the program.
Applied, thanks.