From: Jean Delvare <jdelvare@suse.de>
To: netdev@vger.kernel.org
Subject: Identifying a network namespace
Date: Fri, 14 Dec 2018 12:19:10 +0100 [thread overview]
Message-ID: <20181214121910.5ec0fac9@endymion> (raw)
Hi all,
The question: is there any way to uniquely identify a network namespace
in the kernel?
The context: for debugging purposes, I need to log information about
network devices. netdev_info() uses the device name to identify the
device, however there can be several devices by that name in different
namespaces. To know which device the message relates to, I would need
to know the namespace in addition to the device name. For all I know,
the namespace's name is a user-space thing and the kernel has no idea.
But I would at least need some kind of unique identifier to group log
message by device.
So far I'm using the struct address returned by dev_net() as the unique
ID, but leaking kernel addresses to userspace is not recommended. So I
am wondering, is there another recommended way to uniquely identify a
network namespace in a log message?
Thanks,
--
Jean Delvare
SUSE L3 Support
next reply other threads:[~2018-12-14 11:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-14 11:19 Jean Delvare [this message]
2018-12-14 17:30 ` Identifying a network namespace Nicolas Dichtel
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=20181214121910.5ec0fac9@endymion \
--to=jdelvare@suse.de \
--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).