diff options
author | Tim Gardner <tim.gardner@canonical.com> | 2010-06-25 08:44:07 -0400 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2010-06-25 08:44:07 -0400 |
commit | a8756201ba4189bca3ee1a6ec4e290f467ee09ab (patch) | |
tree | 309d40a10f68ffc971de4f16d26d16a0dccc0693 /include | |
parent | fe6fb552858f686f39e33d7b0a33fe56dacea0bf (diff) |
netfilter: xt_connbytes: Force CT accounting to be enabled
Check at rule install time that CT accounting is enabled. Force it
to be enabled if not while also emitting a warning since this is not
the default state.
This is in preparation for deprecating CONFIG_NF_CT_ACCT upon which
CONFIG_NETFILTER_XT_MATCH_CONNBYTES depended being set.
Added 2 CT accounting support functions:
nf_ct_acct_enabled() - Get CT accounting state.
nf_ct_set_acct() - Enable/disable CT accountuing.
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Jan Engelhardt <jengelh@medozas.de>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/net/netfilter/nf_conntrack_acct.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/net/netfilter/nf_conntrack_acct.h b/include/net/netfilter/nf_conntrack_acct.h index 03e218f0be43..4e9c63a20db2 100644 --- a/include/net/netfilter/nf_conntrack_acct.h +++ b/include/net/netfilter/nf_conntrack_acct.h | |||
@@ -45,6 +45,18 @@ struct nf_conn_counter *nf_ct_acct_ext_add(struct nf_conn *ct, gfp_t gfp) | |||
45 | extern unsigned int | 45 | extern unsigned int |
46 | seq_print_acct(struct seq_file *s, const struct nf_conn *ct, int dir); | 46 | seq_print_acct(struct seq_file *s, const struct nf_conn *ct, int dir); |
47 | 47 | ||
48 | /* Check if connection tracking accounting is enabled */ | ||
49 | static inline bool nf_ct_acct_enabled(struct net *net) | ||
50 | { | ||
51 | return net->ct.sysctl_acct != 0; | ||
52 | } | ||
53 | |||
54 | /* Enable/disable connection tracking accounting */ | ||
55 | static inline void nf_ct_set_acct(struct net *net, bool enable) | ||
56 | { | ||
57 | net->ct.sysctl_acct = enable; | ||
58 | } | ||
59 | |||
48 | extern int nf_conntrack_acct_init(struct net *net); | 60 | extern int nf_conntrack_acct_init(struct net *net); |
49 | extern void nf_conntrack_acct_fini(struct net *net); | 61 | extern void nf_conntrack_acct_fini(struct net *net); |
50 | 62 | ||