From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
To: Wolfgang Bumiller <w.bumiller@proxmox.com>, Jiri Benc <jbenc@redhat.com>
Cc: Christian Brauner <christian.brauner@canonical.com>,
Christian Brauner <christian.brauner@ubuntu.com>,
davem@davemloft.net, dsahern@gmail.com, fw@strlen.de,
daniel@iogearbox.net, lucien.xin@gmail.com,
mschiffer@universe-factory.net, jakub.kicinski@netronome.com,
vyasevich@gmail.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, stephen@networkplumber.org
Subject: Re: [PATCH net-next 1/1] rtnetlink: request RTM_GETLINK by pid or fd
Date: Tue, 23 Jan 2018 17:50:31 +0100 [thread overview]
Message-ID: <64deff27-258e-3849-f835-ff854478a196@6wind.com> (raw)
In-Reply-To: <20180123102658.wll4xb7ewjjy5x55@olga.proxmox.com>
Le 23/01/2018 à 11:26, Wolfgang Bumiller a écrit :
> On Tue, Jan 23, 2018 at 10:30:09AM +0100, Jiri Benc wrote:
>> On Mon, 22 Jan 2018 23:25:41 +0100, Christian Brauner wrote:
>>> This is not necessarily true in scenarios where I move a network device
>>> via RTM_NEWLINK + IFLA_NET_NS_PID into a network namespace I haven't
>>> created. Here is an example:
>>>
>>> nlmsghdr->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
>>> nlmsghdr->nlmsg_type = RTM_NEWLINK;
>>> /* move to network namespace of pid */
>>> nla_put_u32(nlmsg, IFLA_NET_NS_PID, pid)
>>> /* give interface new name */
>>> nla_put_string(nlmsg, IFLA_IFNAME, ifname)
>>>
>>> The only thing I have is the pid that identifies the network namespace.
>>
>> How do you know the interface did not get renamed in the new netns?
>>
>> This is racy and won't work reliably. You really need to know the
>> netnsid before moving the interface to the netns to be able to do
>> meaningful queries.
>
> Even if you know the netnsid, do the mentioned watches work for
> nested/child namespaces if eg. a container creates new namespace before
> and/or after the watch was established and moves interfaces to these
> child namespaces, would you just see them disappear, or can you keep
> track of them later on as well?
nsid can be monitored (see ip monitor nsid).
>
> Even if that works, from what the documentation tells me netlink is an
> unreliable protocol, so if my watcher's socket buffer is full, wouldn't
> I be losing important tracking information?
You can track socket error statistics. In case of error, you can start a dump to
ensure that you have the right view of the system.
>
> I think one possible solution to tracking interfaces would be to have a
> unique identifier that never changes (even if it's just a simple
> uint64_t incremented whenever an interface is created). But since
> they're not local to the current namespace that may require a lot of
> extra permission checks (but I'm just speculating here...).
It's not possible to have unique identifiers. With CRIU, you need to be able to
reassign all existing ids.
next prev parent reply other threads:[~2018-01-23 16:50 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-18 20:21 [PATCH net-next 0/1] " Christian Brauner
2018-01-18 20:21 ` [PATCH net-next 1/1] " Christian Brauner
2018-01-18 20:29 ` Jiri Benc
2018-01-18 20:55 ` Christian Brauner
2018-01-22 21:00 ` Jiri Benc
2018-01-22 21:23 ` Christian Brauner
2018-01-22 22:06 ` Jiri Benc
2018-01-22 22:25 ` Christian Brauner
2018-01-23 9:30 ` Jiri Benc
2018-01-23 10:26 ` Wolfgang Bumiller
2018-01-23 10:42 ` Jiri Benc
2018-01-23 16:50 ` Nicolas Dichtel [this message]
2018-01-23 16:37 ` Nicolas Dichtel
2018-01-23 17:08 ` Jiri Benc
2018-01-24 10:53 ` Nicolas Dichtel
2018-01-24 11:03 ` Jiri Benc
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=64deff27-258e-3849-f835-ff854478a196@6wind.com \
--to=nicolas.dichtel@6wind.com \
--cc=christian.brauner@canonical.com \
--cc=christian.brauner@ubuntu.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=dsahern@gmail.com \
--cc=fw@strlen.de \
--cc=jakub.kicinski@netronome.com \
--cc=jbenc@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lucien.xin@gmail.com \
--cc=mschiffer@universe-factory.net \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
--cc=vyasevich@gmail.com \
--cc=w.bumiller@proxmox.com \
/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
all inboxes | Powered by JetHome®