aboutsummaryrefslogtreecommitdiffstats
path: root/net/netfilter
diff options
context:
space:
mode:
authorLiping Zhang <liping.zhang@spreadtrum.com>2016-07-05 11:23:00 -0400
committerPablo Neira Ayuso <pablo@netfilter.org>2016-07-11 06:16:02 -0400
commit3f8b61b7f9aea414d162821817d89a7a6aae41c3 (patch)
treebe09094d1e29f6ea8f975502592482f6f039e01d /net/netfilter
parent47c74456257d2e50ace8c473d358cf4b9c0a912f (diff)
netfilter: nft_ct: make byte/packet expr more friendly
If we want to use ct packets expr, and add a rule like follows: # nft add rule filter input ct packets gt 1 counter We will find that no packets will hit it, because nf_conntrack_acct is disabled by default. So It will not work until we enable it manually via "echo 1 > /proc/sys/net/netfilter/nf_conntrack_acct". This is not friendly, so like xt_connbytes do, if the user want to use ct byte/packet expr, enable nf_conntrack_acct automatically. Signed-off-by: Liping Zhang <liping.zhang@spreadtrum.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/netfilter')
-rw-r--r--net/netfilter/nft_ct.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/netfilter/nft_ct.c b/net/netfilter/nft_ct.c
index 137e308d5b24..7ce8fd7ace78 100644
--- a/net/netfilter/nft_ct.c
+++ b/net/netfilter/nft_ct.c
@@ -355,6 +355,9 @@ static int nft_ct_get_init(const struct nft_ctx *ctx,
355 if (err < 0) 355 if (err < 0)
356 return err; 356 return err;
357 357
358 if (priv->key == NFT_CT_BYTES || priv->key == NFT_CT_PKTS)
359 nf_ct_set_acct(ctx->net, true);
360
358 return 0; 361 return 0;
359} 362}
360 363