Re: [B.A.T.M.A.N.] [PATCH v3 6/6] batman-adv: debugfs: Add netns support

Sven Eckelmann
2016-03-14T15:56:57Z

[-- Attachment #1: Type: text/plain, Size: 1473 bytes --]

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);

> 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.

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.

Kind regards,
Sven

[1] https://patchwork.open-mesh.org/patch/4965/

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 819 bytes --]