From: Patrick McHardy <kaber@trash.net>
To: tim.gardner@canonical.com
Cc: netfilter-devel@vger.kernel.org, ole@ans.pl
Subject: Re: [PATCH 2/3] netfilter: xt_connbytes: Force CT tracking to be enabled
Date: Wed, 23 Jun 2010 08:05:47 +0200 [thread overview]
Message-ID: <4C21A43B.40700@trash.net> (raw)
In-Reply-To: <1277225075-30428-3-git-send-email-tim.gardner@canonical.com>
tim.gardner@canonical.com wrote:
> From: Tim Gardner <tim.gardner@canonical.com>
>
> 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 <tim.gardner@canonical.com>
> ---
> net/netfilter/xt_connbytes.c | 13 ++++++++++++-
> 1 files changed, 12 insertions(+), 1 deletions(-)
>
> diff --git a/net/netfilter/xt_connbytes.c b/net/netfilter/xt_connbytes.c
> index 7351783..d703355 100644
> --- a/net/netfilter/xt_connbytes.c
> +++ b/net/netfilter/xt_connbytes.c
> @@ -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);
> + }
This should be checked once the rule is added in ->checkentry(),
not once for every packet.
next prev parent reply other threads:[~2010-06-23 6:05 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-22 16:44 [PATCH 0/3] nf-next-2.6 pull request, Complete deprecation of CONFIG_NF_CT_ACCT (V2) tim.gardner
2010-06-22 16:44 ` [PATCH 1/3] netfilter: Expose connection tracking accounting toggles tim.gardner
2010-06-23 6:05 ` Patrick McHardy
2010-06-22 16:44 ` [PATCH 2/3] netfilter: xt_connbytes: Force CT tracking to be enabled tim.gardner
2010-06-22 16:49 ` Jan Engelhardt
2010-06-22 17:55 ` Tim Gardner
2010-06-22 17:02 ` Tim Gardner
2010-06-23 6:05 ` Patrick McHardy [this message]
2010-06-22 16:44 ` [PATCH 3/3] netfilter: Complete the deprecation of CONFIG_NF_CT_ACCT tim.gardner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C21A43B.40700@trash.net \
--to=kaber@trash.net \
--cc=netfilter-devel@vger.kernel.org \
--cc=ole@ans.pl \
--cc=tim.gardner@canonical.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).