[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150917114059.33431bbc@griffin>
Date: Thu, 17 Sep 2015 11:40:59 +0200
From: Jiri Benc <jbenc@...hat.com>
To: Rick Jones <rick.jones2@...com>
Cc: Ani Sinha <ani@...sta.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: list of all network namespaces
On Wed, 16 Sep 2015 17:54:34 -0700, Rick Jones wrote:
> On 09/16/2015 05:46 PM, Ani Sinha wrote:
> > just a stupid question. Is it possible to get a list of all active
> > network namespaces in the kernel through /proc or some other
> > interface?
Not reliably and not efficiently. You can look at what plotnetcfg does:
https://github.com/jbenc/plotnetcfg/blob/master/netns.c
> Presumably you could copy what "ip netns" does, which appears to be to
> look in /var/run/netns . At least that is what an strace of that
> command suggests.
That only works for namespaces added by the ip tool (and presumably a
few other tools which leave a symlink in /var/run/netns as a courtesy).
Depending on what you need, it may be enough. Be aware that you won't
find all net namespaces in the system this way, though.
Jiri
--
Jiri Benc
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists