netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Christian Brauner <christian@brauner.io>
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	davem@davemloft.net, netdev@vger.kernel.org,
	netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
	bridge@lists.linux-foundation.org, tyhicks@canonical.com,
	kadlec@blackhole.kfki.hu, fw@strlen.de,
	roopa@cumulusnetworks.com, nikolay@cumulusnetworks.com,
	linux-kernel@vger.kernel.org, richardrose@google.com,
	vapier@chromium.org, bhthompson@google.com,
	smbarber@chromium.org, joelhockey@chromium.org,
	ueberall@themenzentrisch.de
Subject: Re: [PATCH RESEND net-next 1/2] br_netfilter: add struct netns_brnf
Date: Fri, 7 Jun 2019 16:43:43 +0200	[thread overview]
Message-ID: <20190607144343.nzdlnuo4csllcy7q@salvia> (raw)
In-Reply-To: <20190607142858.vgkljqohn34rxhe2@salvia>

On Fri, Jun 07, 2019 at 04:28:58PM +0200, Pablo Neira Ayuso wrote:
> On Fri, Jun 07, 2019 at 03:25:16PM +0200, Christian Brauner wrote:
> > On Thu, Jun 06, 2019 at 06:30:35PM +0200, Pablo Neira Ayuso wrote:
> > > On Thu, Jun 06, 2019 at 05:19:39PM +0200, Christian Brauner wrote:
> > > > On Thu, Jun 06, 2019 at 08:14:40AM -0700, Stephen Hemminger wrote:
> > > > > On Thu,  6 Jun 2019 13:41:41 +0200
> > > > > Christian Brauner <christian@brauner.io> wrote:
> > > > > 
> > > > > > +struct netns_brnf {
> > > > > > +#ifdef CONFIG_SYSCTL
> > > > > > +	struct ctl_table_header *ctl_hdr;
> > > > > > +#endif
> > > > > > +
> > > > > > +	/* default value is 1 */
> > > > > > +	int call_iptables;
> > > > > > +	int call_ip6tables;
> > > > > > +	int call_arptables;
> > > > > > +
> > > > > > +	/* default value is 0 */
> > > > > > +	int filter_vlan_tagged;
> > > > > > +	int filter_pppoe_tagged;
> > > > > > +	int pass_vlan_indev;
> > > > > > +};
> > > > > 
> > > > > Do you really need to waste four bytes for each
> > > > > flag value. If you use a u8 that would work just as well.
> > > > 
> > > > I think we had discussed something like this but the problem why we
> > > > can't do this stems from how the sysctl-table stuff is implemented.
> > > > I distinctly remember that it couldn't be done with a flag due to that.
> > > 
> > > Could you define a pernet_operations object? I mean, define the id and size
> > > fields, then pass it to register_pernet_subsys() for registration.
> > > Similar to what we do in net/ipv4/netfilter/ipt_CLUSTER.c, see
> > > clusterip_net_ops and clusterip_pernet() for instance.
> > 
> > Hm, I don't think that would work. The sysctls for br_netfilter are
> > located in /proc/sys/net/bridge under /proc/sys/net which is tightly
> > integrated with the sysctls infrastructure for all of net/ and all the
> > folder underneath it including "core", "ipv4" and "ipv6".
> > I don't think creating and managing files manually in /proc/sys/net is
> > going to fly. It also doesn't seem very wise from a consistency and
> > complexity pov. I'm also not sure if this would work at all wrt to file
> > creation and reference counting if there are two different ways of
> > managing them in the same subfolder...
> > (clusterip creates files manually underneath /proc/net which probably is
> > the reason why it gets away with it.)
> 
> br_netfilter is now a module, and br_netfilter_hooks.c is part of it
> IIRC, this file registers these sysctl entries from the module __init
> path.
> 
> It would be a matter of adding a new .init callback to the existing
> brnf_net_ops object in br_netfilter_hooks.c. Then, call
> register_net_sysctl() from this .init callback to register the sysctl
> entries per netns.

Actually, this is what you patch is doing...

> There is already a brnf_net area that you can reuse for this purpose,
> to place these pernetns flags...
> 
> struct brnf_net {
>         bool enabled;
> };
> 
> which is going to be glad to have more fields (under the #ifdef
> CONFIG_SYSCTL) there.

... except that struct brnf_net is not used to store the ctl_table.

So what I'm propose should be result in a small update to your patch 2/2.

  reply	other threads:[~2019-06-07 14:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-06 11:41 [PATCH RESEND net-next 0/2] br_netfilter: enable in non-initial netns Christian Brauner
2019-06-06 11:41 ` [PATCH RESEND net-next 1/2] br_netfilter: add struct netns_brnf Christian Brauner
2019-06-06 15:14   ` Stephen Hemminger
2019-06-06 15:19     ` Christian Brauner
2019-06-06 16:30       ` Pablo Neira Ayuso
2019-06-07 13:25         ` Christian Brauner
2019-06-07 14:28           ` Pablo Neira Ayuso
2019-06-07 14:43             ` Pablo Neira Ayuso [this message]
2019-06-09 15:44               ` Christian Brauner
2019-06-06 11:41 ` [PATCH RESEND net-next 2/2] br_netfilter: namespace bridge netfilter sysctls Christian Brauner

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=20190607144343.nzdlnuo4csllcy7q@salvia \
    --to=pablo@netfilter.org \
    --cc=bhthompson@google.com \
    --cc=bridge@lists.linux-foundation.org \
    --cc=christian@brauner.io \
    --cc=coreteam@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=fw@strlen.de \
    --cc=joelhockey@chromium.org \
    --cc=kadlec@blackhole.kfki.hu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=nikolay@cumulusnetworks.com \
    --cc=richardrose@google.com \
    --cc=roopa@cumulusnetworks.com \
    --cc=smbarber@chromium.org \
    --cc=stephen@networkplumber.org \
    --cc=tyhicks@canonical.com \
    --cc=ueberall@themenzentrisch.de \
    --cc=vapier@chromium.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;
as well as URLs for NNTP newsgroup(s).