public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Sven Eckelmann <sven@narfation.org>
Cc: b.a.t.m.a.n@lists.open-mesh.org
Subject: Re: [B.A.T.M.A.N.] [PATCH v3 6/6] batman-adv: debugfs: Add netns support
Date: Mon, 14 Mar 2016 20:20:38 +0100	[thread overview]
Message-ID: <20160314192038.GB10040@lunn.ch> (raw)
In-Reply-To: <58321025.0PBgHVCilp@bentobox>

On Mon, Mar 14, 2016 at 04:56:57PM +0100, Sven Eckelmann wrote:
> On Monday 14 March 2016 15:06:24 Andrew Lunn wrote:
> > > Matthias is against applying [1] patch 6 because it would require that
> > > batman-adv supports this interface for a long(tm) time. He proposes to use
> > > netlink instead.
> > > 
> > > Andrew, do you want to change patch 6 to avoid creating the debugfs stuff in
> > > non-init_net netns?
> > 
> > I'm not sure how well that is going to work, from the user space side
> > of things.
> > 
> > In the kernel, we know if we are in init_net, or some other netns.
> > 
> > In user space, it is not so simple. Ideally, when in some other netns
> > than the default, we need all reads/writes to debugfs to fail.
> 
> Hm, this would require some checks via the the current pid on open:
> 
>     net = get_net_ns_by_pid(current->pid);
>     ... checky check via neteq(net, &init_net)...
>     put_net(pd->net);

I suppose this could be made to work. Not sure what error code to
return, maybe ENXIO if batctl is not in the default netns.
 
> > What we
> > don't want is it seeing the default name spaces files, because it is
> > going to get very confusing. These files refer to something which does
> > not exist in the current netns.
> 
> Wait, but thats exactly what you are doing already with your default behavior
> (which only creates a symlink to netns/${FUNNY_ID}/. Legacy tools will still
> read the wrong information because they don't know about the new netns paths.

Correct. And this is unfixable, as far as i can see. You need the
contents of debugfs to be dependent on the observer. The requires core
debugfs support to calls like readdir() and open().

> I thought that the debugfs stuff will be replaced with netlink  and that the
> current debugfs files are only there for non-namespace setups with legacy tools.

Legacy tools are always going to be broken when they are used in the
non-default netns. Probably the best we can do is have the kernel
return ENXIO or whatever when they access files from a different
netns.

We have two options for non-default netns debugfs

1) Extend debugfs and the tools as i suggested patches for.

2) Only support default netns in debugfs, and use netlink for full
   netns aware tools.

   Andrew

  reply	other threads:[~2016-03-14 19:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-13 18:48 [B.A.T.M.A.N.] [PATCH v3 0/6] batman-adv: Add network name space support Sven Eckelmann
2016-03-13 18:50 ` [B.A.T.M.A.N.] [PATCH v3 1/6] batman-adv: Introduce compat-patches support Sven Eckelmann
2016-03-13 18:50 ` [B.A.T.M.A.N.] [PATCH v3 2/6] batman-adv: NETIF_F_NETNS_LOCAL feature to prevent netns moves Sven Eckelmann
2016-03-13 18:50 ` [B.A.T.M.A.N.] [PATCH v3 3/6] batman-adv: Create batman soft interfaces within correct netns Sven Eckelmann
2016-03-13 18:50 ` [B.A.T.M.A.N.] [PATCH v3 4/6] batman-adv: Handle parent interfaces in a different netns Sven Eckelmann
2016-03-13 18:50 ` [B.A.T.M.A.N.] [PATCH v3 5/6] batman-adv: Add compatibility header for linux/ns_common.h Sven Eckelmann
2016-03-13 18:50 ` [B.A.T.M.A.N.] [PATCH v3 6/6] batman-adv: debugfs: Add netns support Sven Eckelmann
2016-03-14 10:57   ` Sven Eckelmann
2016-03-14 14:06     ` Andrew Lunn
2016-03-14 15:56       ` Sven Eckelmann
2016-03-14 19:20         ` Andrew Lunn [this message]
2016-03-13 22:40 ` [B.A.T.M.A.N.] [PATCH v3 0/6] batman-adv: Add network name space support Andrew Lunn
2016-03-14  7:17   ` Sven Eckelmann

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=20160314192038.GB10040@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=sven@narfation.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