nf-next-2.6 pull request, Complete deprecation of CONFIG_NF_CT_ACCT (V2)
Subsystems (3)
cover nf-next-2.6 pull request, Complete deprecation of CONFIG_NF_CT_ACCT (V2)
The following changes since commit fe6fb552858f686f39e33d7b0a33fe56dacea0bf:
Arnd Hannemann (1):
netfilter: fix simple typo in KConfig for netfiltert xt_TEE
are available in the git repository at:
git://kernel.ubuntu.com/rtg/nf-next-2.6 CONFIG_NF_CT_ACCT
Tim Gardner (3):
netfilter: Expose connection tracking accounting toggles
netfilter: xt_connbytes: Force CT accounting to be enabled
netfilter: Complete the deprecation of CONFIG_NF_CT_ACCT
Documentation/feature-removal-schedule.txt | 9 --------- Documentation/kernel-parameters.txt | 3 +-- include/net/netfilter/nf_conntrack.h | 12 ++++++++++++ net/netfilter/Kconfig | 22 ---------------------- net/netfilter/nf_conntrack_acct.c | 10 ---------- net/netfilter/xt_connbytes.c | 13 ++++++++++++- 6 files changed, 25 insertions(+), 44 deletions(-)
PATCH 1/3 netfilter: Expose connection tracking accounting toggles
From: Tim Gardner <[email protected]>
--- include/net/netfilter/nf_conntrack.h | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)
include/net/netfilter/nf_conntrack.h +12 -0
@@ -232,6 +232,18 @@ static inline void nf_ct_refresh(struct nf_conn *ct,__nf_ct_refresh_acct (ct,0 , skb, extra_jiffies,0 ); } +/* Check if connection tracking accounting is enabled */ +static inline bool nf_ct_acct_enabled (struct nf_conn *ct) +{ +return ct->ct_net->ct.sysctl_acct ==0 ? false : true; +} + +/* Enable/disable connection tracking accounting */ +static inline void nf_ct_set_acct (struct nf_conn *ct,bool enable) +{ + ct->ct_net->ct.sysctl_acct = enable == true ?1 :0 ; +} + extern bool __nf_ct_kill_acct(struct nf_conn *ct, enum ip_conntrack_info ctinfo, const struct sk_buff *skb,
Signature · 1 line
1.7.0.4
Re: [PATCH 1/3] netfilter: Expose connection tracking accounting toggles
Quoted 17 lines · [email protected] wrote:
From: Tim Gardner <[email protected]>
Signed-off-by Tim Gardner <[email protected]>--- include/net/netfilter/nf_conntrack.h | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)include/net/netfilter/nf_conntrack.h +2
-0@@ -232,6 +232,18 @@ static inline void nf_ct_refresh(struct nf_conn *ct,__nf_ct_refresh_acct (ct,0 , skb, extra_jiffies,0 ); } +/* Check if connection tracking accounting is enabled */ +static inline bool nf_ct_acct_enabled (struct nf_conn *ct)
include/net/netfilter/nf_conntrack.h static inline void nf_ct_refresh(struct nf_conn *ct, · line 246
Quoted 10 lines
include/net/netfilter/nf_conntrack.h +10
-0+{ +return ct->ct_net->ct.sysctl_acct ==0 ? false : true; +} + +/* Enable/disable connection tracking accounting */ +static inline void nf_ct_set_acct (struct nf_conn *ct,bool enable) +{ + ct->ct_net->ct.sysctl_acct = enable == true ?1 :0 ; +} +
This looks strangely indented, please use a single tab. You also need to take care of the CONFIG_NET_NS=n case where the ct_net pointer is #ifdef'ed out. I'd suggest to simply pass the net pointer from xt_mtchk_param, which is available unconditionally.
PATCH 2/3 netfilter: xt_connbytes: Force CT tracking to be enabled
In reply to [email protected]From: Tim Gardner <[email protected]>
Check at runtime that CT tracking is enabled, and force it to be enabled if not.
This is in preparation for deprecating CONFIG_NF_CT_ACCT.
--- net/netfilter/xt_connbytes.c | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-)
net/netfilter/xt_connbytes.c +12 -1
@@ -21,7 +21,7 @@ static bool connbytes_mt(const struct sk_buff *skb, struct xt_action_param *par) { const struct xt_connbytes_info *sinfo = par->matchinfo; -const struct nf_conn *ct; +struct nf_conn *ct;enum ip_conntrack_info ctinfo;u_int64_t what =0 ;/* initialize to make gcc happy */ u_int64_t bytes =0 ;
@@ -32,6 +32,17 @@ connbytes_mt(const struct sk_buff *skb, struct xt_action_param *par)if (!ct)return false; +/* +* This filter cannot function correctly unless connection tracking +* accounting is enabled, so complain about it until someone notices. +* It _should_ only print one warning message. +*/ +if (unlikely (nf_ct_acct_enabled (ct) == false)) { +if (net_ratelimit ()) +pr_warning ("ipt_connbytes: Force enabling CT accounting\n" ); +nf_ct_set_acct (ct, true); + } + counters =nf_conn_acct_find (ct);if (!counters)return false;
Signature · 1 line
1.7.0.4
Re: [PATCH 2/3] netfilter: xt_connbytes: Force CT tracking to be enabled
net/netfilter/xt_connbytes.c connbytes_mt(const struct sk_buff *skb, struct xt_action_param *par) · line 44
Quoted 11 lines · On Tuesday 2010-06-22 18:44, [email protected] wrote:
net/netfilter/xt_connbytes.c| 13 ++++++++++++-1 files changed, 12 insertions(+), 1 deletions(-)net/netfilter/xt_connbytes.c +8
-0+* accounting is enabled, so complain about it until someone notices. +* It _should_ only print one warning message. +*/ +if (unlikely (nf_ct_acct_enabled (ct) == false)) { +if (net_ratelimit ()) +pr_warning ("ipt_connbytes: Force enabling CT accounting\n" ); +nf_ct_set_acct (ct, true); + }
Am I in a timewarp vortex? It's xt_connbytes, not ipt_connbytes. Better yet, use KBUILD_MODNAME together with pr_fmt.
Re: [PATCH 2/3] netfilter: xt_connbytes: Force CT tracking to be enabled
Quoted 6 lines · Jan Engelhardt
Quoted 3 lines · On Tuesday 2010-06-22 18:44, [email protected] wrote:
net/netfilter/xt_connbytes.c| 13 ++++++++++++-1 files changed, 12 insertions(+), 1 deletions(-)
Quoted 12 lines
Review
Quoted 8 lines
(quoted diff) +8
-0+ * accounting is enabled, so complain about it until someone notices. + * It _should_ only print one warning message. + */ + if (unlikely(nf_ct_acct_enabled(ct) == false)) { + if (net_ratelimit()) + pr_warning("ipt_connbytes: Force enabling CT accounting\n"); + nf_ct_set_acct(ct, true); + }Am I in a timewarp vortex? It's
xt_connbytes, notipt_connbytes. Better yet, useKBUILD_MODNAMEtogether withpr_fmt. --
It turns out that pr_warning() already uses pr_fmt(). Change pushed.
rtg
Signature · 1 line
Tim Gardner [email protected]
Quoted 1 line
From
5b47470d916e85bfc5df835580c5898997fdeb81Mon Sep 17 00:00:00 2001
From: Tim Gardner <[email protected]>
Date: Tue, 22 Jun 2010 09:27:30 -0600
Subject: [PATCH 2/3] netfilter: xt_connbytes: Force CT accounting to be enabled
Check at runtime that CT accounting is enabled, and force it to be enabled if not.
This is in preparation for deprecating CONFIG_NF_CT_ACCT.
--- net/netfilter/xt_connbytes.c | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-)
net/netfilter/xt_connbytes.c +12 -1
@@ -21,7 +21,7 @@ static bool connbytes_mt(const struct sk_buff *skb, struct xt_action_param *par) { const struct xt_connbytes_info *sinfo = par->matchinfo; -const struct nf_conn *ct; +struct nf_conn *ct;enum ip_conntrack_info ctinfo;u_int64_t what =0 ;/* initialize to make gcc happy */ u_int64_t bytes =0 ;
@@ -32,6 +32,17 @@ connbytes_mt(const struct sk_buff *skb, struct xt_action_param *par)if (!ct)return false; +/* +* This filter cannot function correctly unless connection tracking +* accounting is enabled, so complain about it until someone notices. +* It _should_ only print one warning message. +*/ +if (unlikely (nf_ct_acct_enabled (ct) == false)) { +if (net_ratelimit ()) +pr_warning ("Force enabling CT accounting\n" ); +nf_ct_set_acct (ct, true); + } + counters =nf_conn_acct_find (ct);if (!counters)return false;
Signature · 1 line
1.7.0.4
Re: [PATCH 2/3] netfilter: xt_connbytes: Force CT tracking to be enabled
In reply to [email protected]Bah! This should be 'CT accounting', not 'CT tracking'. The commit in the git repo is correct, I'd just forgotten to regen the patches that I emailed.
rtg
Signature · 1 line
Tim Gardner [email protected]
Quoted 1 line
From
5836a019e4d267d78ba2b33db2d77cd03cd83fb2Mon Sep 17 00:00:00 2001
From: Tim Gardner <[email protected]>
Date: Tue, 22 Jun 2010 09:27:30 -0600
Subject: [PATCH 2/3] netfilter: xt_connbytes: Force CT accounting to be enabled
Check at runtime that CT accounting is enabled, and force it to be enabled if not.
This is in preparation for deprecating CONFIG_NF_CT_ACCT.
--- net/netfilter/xt_connbytes.c | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-)
net/netfilter/xt_connbytes.c +12 -1
@@ -21,7 +21,7 @@ static bool connbytes_mt(const struct sk_buff *skb, struct xt_action_param *par) { const struct xt_connbytes_info *sinfo = par->matchinfo; -const struct nf_conn *ct; +struct nf_conn *ct;enum ip_conntrack_info ctinfo;u_int64_t what =0 ;/* initialize to make gcc happy */ u_int64_t bytes =0 ;
@@ -32,6 +32,17 @@ connbytes_mt(const struct sk_buff *skb, struct xt_action_param *par)if (!ct)return false; +/* +* This filter cannot function correctly unless connection tracking +* accounting is enabled, so complain about it until someone notices. +* It _should_ only print one warning message. +*/ +if (unlikely (nf_ct_acct_enabled (ct) == false)) { +if (net_ratelimit ()) +pr_warning ("ipt_connbytes: Force enabling CT accounting\n" ); +nf_ct_set_acct (ct, true); + } + counters =nf_conn_acct_find (ct);if (!counters)return false;
Signature · 1 line
1.7.0.4
Re: [PATCH 2/3] netfilter: xt_connbytes: Force CT tracking to be enabled
In reply to [email protected]Quoted 29 lines · [email protected] wrote:
From: Tim Gardner <[email protected]>
Check at runtime that CT tracking is enabled, and force it to be enabled if not.
This is in preparation for deprecating
CONFIG_NF_CT_ACCT.Signed-off-by Tim Gardner <[email protected]>--- net/netfilter/xt_connbytes.c | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-)net/netfilter/xt_connbytes.c +1
-1@@ -21,7 +21,7 @@ static bool connbytes_mt(const struct sk_buff *skb, struct xt_action_param *par) { const struct xt_connbytes_info *sinfo = par->matchinfo; -const struct nf_conn *ct; +struct nf_conn *ct;enum ip_conntrack_info ctinfo;u_int64_t what =0 ;/* initialize to make gcc happy */ u_int64_t bytes =0 ;@@ -32,6 +32,17 @@ connbytes_mt(const struct sk_buff *skb, struct xt_action_param *par)if (!ct)return false;
net/netfilter/xt_connbytes.c connbytes_mt(const struct sk_buff *skb, struct xt_action_param *par) · line 44
Quoted 10 lines
net/netfilter/xt_connbytes.c +10
-0+/* +* This filter cannot function correctly unless connection tracking +* accounting is enabled, so complain about it until someone notices. +* It _should_ only print one warning message. +*/ +if (unlikely (nf_ct_acct_enabled (ct) == false)) { +if (net_ratelimit ()) +pr_warning ("ipt_connbytes: Force enabling CT accounting\n" ); +nf_ct_set_acct (ct, true); + }
This should be checked once the rule is added in ->checkentry(), not once for every packet.
PATCH 3/3 netfilter: Complete the deprecation of CONFIG_NF_CT_ACCT
In reply to [email protected]From: Tim Gardner <[email protected]>
CONFIG_NF_CT_ACCT has been deprecated for awhile and was originally scheduled for removal by 2.6.29.
Removing support for this config option also stops this deprecation warning message in the kernel log.
[ 61.669627] nf_conntrack version 0.5.0 (16384 buckets, 65536 max) [ 61.669850] CONFIG_NF_CT_ACCT is deprecated and will be removed soon. Please use [ 61.669852] nf_conntrack.acct=1 kernel parameter, acct=1 nf_conntrack module option or [ 61.669853] sysctl net.netfilter.nf_conntrack_acct=1 to enable it.
--- Documentation/feature-removal-schedule.txt | 9 --------- Documentation/kernel-parameters.txt | 3 +-- net/netfilter/Kconfig | 22 ---------------------- net/netfilter/nf_conntrack_acct.c | 10 ---------- 4 files changed, 1 insertions(+), 43 deletions(-)
Documentation/feature-removal-schedule.txt +0 -9
@@ -303,15 +303,6 @@ Who: Johannes Berg <[email protected]> --------------------------- -What: CONFIG_NF_CT_ACCT -When: 2.6.29 -Why: Accounting can now be enabled/disabled without kernel recompilation. - Currently used only to set a default value for a feature that is also - controlled by a kernel/module/sysfs/sysctl parameter. -Who: Krzysztof Piotr Oledzki <[email protected]> - ---------------------------- - What: sysfs ui for changing p4-clockmod parameters When: September 2009 Why: See commits 129f8ae9b1b5be94517da76009ea956e89104ce8 and
Documentation/kernel-parameters.txt +1 -2
@@ -1597,8 +1597,7 @@ and is between 256 and 4096 characters. It is defined in the file [NETFILTER] Enable connection tracking flow accounting 0 to disable accounting 1 to enable accounting - Default value depends on CONFIG_NF_CT_ACCT that is - going to be removed in 2.6.29. + Default value is 1 nfsaddrs= [NFS] See Documentation/filesystems/nfs/nfsroot.txt.
net/netfilter/Kconfig +0 -22
@@ -40,27 +40,6 @@ config NF_CONNTRACK if NF_CONNTRACK -config NF_CT_ACCT - bool "Connection tracking flow accounting" - depends on NETFILTER_ADVANCED - help - If this option is enabled, the connection tracking code will - keep per-flow packet and byte counters. - - Those counters can be used for flow-based accounting or the - `connbytes' match. - - Please note that currently this option only sets a default state. - You may change it at boot time with nf_conntrack.acct=0/1 kernel - parameter or by loading the nf_conntrack module with acct=0/1. - - You may also disable/enable it on a running system with: - sysctl net.netfilter.nf_conntrack_acct=0/1 - - This option will be removed in 2.6.29. - - If unsure, say `N'. - config NF_CONNTRACK_MARK bool 'Connection mark tracking support' depends on NETFILTER_ADVANCED
@@ -630,7 +609,6 @@ config NETFILTER_XT_MATCH_CONNBYTES tristate '"connbytes" per-connection counter match support' depends on NF_CONNTRACK depends on NETFILTER_ADVANCED - select NF_CT_ACCT help This option adds a `connbytes' match, which allows you to match the number of bytes and/or packets for each direction within a connection.
net/netfilter/nf_conntrack_acct.c +0 -10
@@ -17,11 +17,7 @@#include <net/netfilter/nf_conntrack_extend.h> #include <net/netfilter/nf_conntrack_acct.h> -#ifdef CONFIG_NF_CT_ACCT #define NF_CT_ACCT_DEFAULT 1 -#else -#define NF_CT_ACCT_DEFAULT 0 -#endif static int nf_ct_acct__read_mostly =NF_CT_ACCT_DEFAULT ;
@@ -114,12 +110,6 @@ int nf_conntrack_acct_init(struct net *net) net->ct.sysctl_acct = nf_ct_acct;if (net_eq (net, &init_net)) { -#ifdef CONFIG_NF_CT_ACCT -printk (KERN_WARNING "CONFIG_NF_CT_ACCT is deprecated and will be removed soon. Please use\n" ); -printk (KERN_WARNING "nf_conntrack.acct=1 kernel parameter, acct=1 nf_conntrack module option or\n" ); -printk (KERN_WARNING "sysctl net.netfilter.nf_conntrack_acct=1 to enable it.\n" ); -#endif - ret =nf_ct_extend_register (&acct_extend);if (ret <0 ) {printk (KERN_ERR "nf_conntrack_acct: Unable to register extension\n" );
Signature · 1 line
1.7.0.4