From: Tom Parkin <tparkin@katalix.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: netdev@vger.kernel.org
Subject: Re: Network namespace bugs in L2TP
Date: Thu, 20 Dec 2012 13:52:54 +0000 [thread overview]
Message-ID: <20121220135254.GA2450@raven> (raw)
In-Reply-To: <87r4mt4um7.fsf@xmission.com>
[-- Attachment #1: Type: text/plain, Size: 2955 bytes --]
Hi Eric,
On Thu, Dec 13, 2012 at 11:31:12AM -0800, Eric W. Biederman wrote:
> Tom Parkin <tparkin@katalix.com> writes:
>
> > On Wed, Dec 12, 2012 at 11:44:36AM -0800, Eric W. Biederman wrote:
> >> Tom Parkin <tparkin@katalix.com> writes:
> > I think that raises a question in the case of the L2TP tunnel sockets,
> > though. Currently l2tp_tunnel_sock_create uses the namespace of the
> > current process for the socket. The alternative is to pass in the
> > desired namespace from l2tp_tunnel_create -- and this makes sense, I
> > think.
> >
> > However, when l2tp_tunnel_create is called from the netlink code, the
> > namespace passed is that of the netlink socket. At the risk of sounding
> > silly, what's the benefit of using the netlink socket namespace over the
> > process namespace in this case?
>
> Using the netlink socket namespace ensure that if the netlink socket is
> passed between processes the semantics of sending messages down the
> netlink socket don't change.
>
> There is another thread on netdev discussing another variant of this
> right now. For some cases it is just a waste of resources to have one
> copy of a daemon per network namespace. In which case a controlling
> daemon will open one netlink socket per network namespace and send
> commands down the appropriate socket for the network namespace the
> daemon wishes to control.
Yes, I saw that other thread. Thanks for the clarification on this
point.
> > But that doesn't seem too unreasonable. A user would have to take
> > explicit action to create an L2TP tunnel socket, and it might seem
> > reasonable for that socket to keep the namespace alive until the user
> > explicitly tears it down again.
>
> Sending a netlink message to tear down the socket is not unreasonable.
>
> Having a reference counting loop such that it is possible to close all
> other sockets and all other references to a network namespace and not
> have the network namespace go away because the L2TP tunnel socket holds
> a reference to the unreachable and unuusable network namespace is
> unreasonable.
>
> We handle this with arp and icmp control sockets by not creating a
> reference count. And having a pernet cleanup routing clean up those
> sockets. Assuming I am right about the reference counting loop being
> possible this is something to look at.
Yep, OK. I hadn't appreciated the namespace could become inaccessible!
I've done some digging and I believe there is an issue with the
reference counting for the unmanaged tunnel sockets -- certainly I am
able to leak netns resources here.
I've been working on a patchset which I hope will address these issues
in l2tp_core. I'm stress testing it now and hope to post to netdev
soon for review.
Thanks again for your help.
Tom
--
Tom Parkin
Katalix Systems Ltd
http://www.katalix.com
Catalysts for your Embedded Linux software development
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
prev parent reply other threads:[~2012-12-20 13:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-12 15:51 Network namespace bugs in L2TP Tom Parkin
2012-12-12 19:44 ` Eric W. Biederman
2012-12-13 16:56 ` Tom Parkin
2012-12-13 19:31 ` Eric W. Biederman
2012-12-20 13:52 ` Tom Parkin [this message]
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=20121220135254.GA2450@raven \
--to=tparkin@katalix.com \
--cc=ebiederm@xmission.com \
--cc=netdev@vger.kernel.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).