netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luciano Coelho <luciano.coelho@nokia.com>
To: ext Alexey Dobriyan <adobriyan@gmail.com>
Cc: Jan Engelhardt <jengelh@medozas.de>,
	Netfilter Developer Mailing List
	<netfilter-devel@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Patrick McHardy <kaber@trash.net>,
	"sameo@linux.intel.com" <sameo@linux.intel.com>
Subject: Re: [RFC 1/1] netfilter: xtables: inclusion of xt_condition
Date: Thu, 22 Jul 2010 22:30:07 +0300	[thread overview]
Message-ID: <1279827007.1630.15.camel@powerslave> (raw)
In-Reply-To: <20100722191940.GA10029@x200>

On Thu, 2010-07-22 at 21:19 +0200, ext Alexey Dobriyan wrote:
> On Thu, Jul 22, 2010 at 04:44:35PM +0200, Jan Engelhardt wrote:
> > 
> > On Thursday 2010-07-22 16:09, Luciano Coelho wrote:
> > >+static int condition_mt_check(const struct xt_mtchk_param *par)
> > >+{
> > >+	struct xt_condition_mtinfo *info = par->matchinfo;
> > >+	struct condition_variable *var;
> > >+	struct condition_net *cond_net =
> > >+		condition_pernet(current->nsproxy->net_ns);
> > 
> > Cc'ing Alexey who has done the netns support.
> > 
> > Alexey, you added par->net, but given Luciano just did it with 
> > current->nsproxy->net_ns, do we really need par->net?
> 
> In ->check, maybe, we can get away with current->nsproxy->net_ns.
> 
> But definitely not in ->destroy(), because destruction can happen
> when _no_ task is in netns, so current->nsproxy->net_ns is 100% bogus.
> 
> Steps to reproduce:
> 	iptables -A ...
> 	exit
> 
> ->destroy hook gets netns from par->net, ->checkentry does the same
> for symmetry and less confusion.

Very good point.  I guess that when Patrick suggested using
current->nsproxy->net_ns, he meant only for the module_params part.
I'll be removing that anyway.  And I'll change the code to use par->net
instead of current->nsproxy->net_ns to avoid the problem in _destroy.

Thanks for your comments!

I must admit that I was a bit insecure about this code.  That's why I
sent a RFC early enough. ;)


-- 
Cheers,
Luca.


      reply	other threads:[~2010-07-22 19:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-22 14:09 [RFC 0/1] netfilter: xtables: xt_condition inclusion with namespace fix Luciano Coelho
2010-07-22 14:09 ` [RFC 1/1] netfilter: xtables: inclusion of xt_condition Luciano Coelho
2010-07-22 14:44   ` Jan Engelhardt
2010-07-22 15:16     ` Luciano Coelho
2010-07-22 15:36       ` Jan Engelhardt
2010-07-22 19:26         ` Luciano Coelho
2010-07-22 19:19     ` Alexey Dobriyan
2010-07-22 19:30       ` Luciano Coelho [this message]

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=1279827007.1630.15.camel@powerslave \
    --to=luciano.coelho@nokia.com \
    --cc=adobriyan@gmail.com \
    --cc=jengelh@medozas.de \
    --cc=kaber@trash.net \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=sameo@linux.intel.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).