netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luciano Coelho <luciano.coelho@nokia.com>
To: ext Jan Engelhardt <jengelh@medozas.de>
Cc: 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>,
	Alexey Dobriyan <adobriyan@gmail.com>
Subject: Re: [RFC 1/1] netfilter: xtables: inclusion of xt_condition
Date: Thu, 22 Jul 2010 22:26:51 +0300	[thread overview]
Message-ID: <1279826811.1630.11.camel@powerslave> (raw)
In-Reply-To: <alpine.LSU.2.01.1007221733360.12308@obet.zrqbmnf.qr>

On Thu, 2010-07-22 at 17:36 +0200, ext Jan Engelhardt wrote:
> On Thursday 2010-07-22 17:16, Luciano Coelho wrote:
> >> >+	ret = strict_strtoul(val, 0, &l);
> >> >+	if (ret == -EINVAL || ((uint)l != l))
> >> >+		return -EINVAL;
> >> 
> >> >+	*((u32 *) ((u8 *) cond_net + (size_t) kp->arg)) = l;
> >> 
> >> I don't think we need this level of granularity; let the options be 
> >> global, similar to what xt_hashlimit does.
> >
> >I did this according to Patrick's comment:
> >> > proc_net_condition is a global variable, so this won't work for
> >> > namespaces. What the code does is reinitialize it when instantiating
> >> > a new namespace, so it will always point to the last instantiated
> >> > namespace.
> >> > 
> >> > The same problem exists for the condition_list, each namespace
> >> > should only be able to access its own conditions.
> >> 
> >> This also applies to the permission variables. Basically, we shouldn't
> >> be having any globals except perhaps the mutex. You probably need a
> >> module_param_call function to set them for the correct namespace (you
> >> can access that through current->nsproxy->net_ns).
> >
> >I found it a bit strange to be able to change the module params in a
> >per-netns basis, but it is actually possible if you're changing the
> >parameters via sysfs.  I tried it and it even seems to work. ;)
> >
> >I can't see any module parameters in the xt_hashlimit.c file.  Am I
> >looking in the wrong place?
> 
> Oops, xt_recent.c.
> 
> >I would be fine with making the module params global (as they were
> >before), if that's fine with Patrick too.
> 
> "When was the last time you needed to change the default ownership
> when you _also_ have the possibility to chown each procfs file
> individually?"
> 
> >> (I am not even sure if kp->arg can be non-multiples-of-4, in which case 
> >> this would be an alignment violation even.)
> >
> >I'm passing size_t in kp->arg.  It looks quite ugly, because usually
> >kp->arg is a pointer to some data.  But at least this way, using
> >offsetof(), I could avoid lots of repeated code for the options...
> 
> if kp->arg is 1, ((u8*)cond_net + kp->arg) yields a pointer that's
> usually not aligned for u32. (And C pedants would probably argue
> that is should be char* not u8*, even if the one is a typedef
> of another.)

Oh, I see.  In the current case it works because all the parameters are
32-bit.

In any case, I'll just remove the per-net module parameters code.  It is
indeed over-fine-grained as you said earlier.


-- 
Cheers,
Luca.


  reply	other threads:[~2010-07-22 19:26 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 [this message]
2010-07-22 19:19     ` Alexey Dobriyan
2010-07-22 19:30       ` Luciano Coelho

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=1279826811.1630.11.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).