Linux Netfilter development
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: "Alin Năstac" <alin.nastac@gmail.com>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [helper PATCH] Preserve conntrack helper bound through CT rule
Date: Wed, 26 Mar 2014 14:04:45 +0100	[thread overview]
Message-ID: <20140326130445.GD21741@breakpoint.cc> (raw)
In-Reply-To: <CAF1oqRC4LDjjq2X1EjRSJr0g0oQk45UMZBviLz0mziTwM8WbRQ@mail.gmail.com>

Alin Năstac <alin.nastac@gmail.com> wrote:
> Hi,
> 
> I've discovered that MASQUERADE target overwrites the CT --helper settings.
> The setup I used is the following:
>   iptables -t raw -A PREROUTING -i lan -p tcp --dport 2121 -j CT --helper ftp
>   iptables -t nat -A POSTROUTING -o wan -s 192.168.1.0/24 -j MASQUERADE
> 
> I found out the problem, the helper set in the conntrack template is
> overwritten by MASQUERADE target.
> This patch fixes the issue:
> 
> diff --git a/net/netfilter/nf_conntrack_core.c
> b/net/netfilter/nf_conntrack_core.c
> index bba14a7..ab7cd3e 100644
> --- a/net/netfilter/nf_conntrack_core.c
> +++ b/net/netfilter/nf_conntrack_core.c
> @@ -1445,7 +1445,7 @@ void nf_conntrack_alter_reply(struct nf_conn *ct,
>         nf_ct_dump_tuple(newreply);
> 
>         ct->tuplehash[IP_CT_DIR_REPLY].tuple = *newreply;
> -       if (ct->master || (help && !hlist_empty(&help->expectations)))
> +       if (ct->master || help)

This is confusing.  This forces re-ookup of helper even if
expectations have been setup (i.e., helper is being used).

IOW, this increases __nf_ct_try_assign_helper() call count...

Would you mind letting us know what kernel version is having problems,
and wheter helper autoassignments are enabled?
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2014-03-26 13:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-26 12:34 [helper PATCH] Preserve conntrack helper bound through CT rule Alin Năstac
2014-03-26 13:04 ` Florian Westphal [this message]
2014-03-26 13:18   ` Alin Năstac
2014-03-26 16:57     ` Florian Westphal
2014-03-26 20:59       ` Alin Năstac

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=20140326130445.GD21741@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=alin.nastac@gmail.com \
    --cc=netfilter-devel@vger.kernel.org \
    /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