[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180126093629.142e2a74@redhat.com>
Date: Fri, 26 Jan 2018 09:36:29 +0100
From: Jiri Benc <jbenc@...hat.com>
To: Nicolas Dichtel <nicolas.dichtel@...nd.com>
Cc: Christian Brauner <christianvanbrauner@...il.com>,
netdev@...r.kernel.org, ebiederm@...ssion.com, davem@...emloft.net,
dsahern@...il.com, fw@...len.de, daniel@...earbox.net,
lucien.xin@...il.com, mschiffer@...verse-factory.net,
jakub.kicinski@...ronome.com, vyasevich@...il.com,
linux-kernel@...r.kernel.org, w.bumiller@...xmox.com,
Christian Brauner <christian.brauner@...ntu.com>
Subject: Re: [PATCH net-next 0/3 V1] rtnetlink: enable IFLA_IF_NETNSID for
RTM_{DEL,SET}LINK
On Fri, 26 Jan 2018 00:34:51 +0100, Nicolas Dichtel wrote:
> Why meaningful? The user knows that the answer is like if if was done in another
> netns. It enables to have only one netlink socket instead of one per netns. But
> the code using it will be the same.
Because you can't use it to query the linked interface. You can't even
use it as an opaque value to track interfaces (netnsid+ifindex) because
netnsids are not unique across net name spaces. You can easily have two
interfaces that have all the ifindex, ifname, netnsid (and basically
everything else) identical but being completely different interfaces.
That's really not helpful.
> I fear that with your approach, it will results to a lot of complexity in the
> kernel.
The complexity is (at least partly) already there. It's an inevitable
result of the design decision to have relative identifiers.
I agree that we should think about how to make this easy to implement.
I like your idea of doing this somehow generically. Perhaps it's
possible to do while keeping the netnsids valid in the caller's netns?
> What is really missing for me, is a way to get a fd from an nsid. The user
> should be able to call RTM_GETNSID with an fd and a nsid and the kernel performs
> the needed operations so that the fd points to the corresponding netns.
That's what I was missing, too. I even looked into implementing it. But
opening a fd on behalf of the process and returning it over netlink is a
wrong thing to do. Netlink messages can get lost. Then you have a fd
leak you can do nothing about.
Given that we have netnsids used for so much stuff already (like
NETLINK_LISTEN_ALL_NSID) you need to track them anyway. And if you need
to track them, why bother with another identifier? It would be better
if netnsid can be used universally for anything. Then there will be no
need for the conversion.
Jiri
Powered by blists - more mailing lists