From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
To: Ilya Maximets <i.maximets@ovn.org>, Jiri Benc <jbenc@redhat.com>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
Donald Hunter <donald.hunter@gmail.com>,
Shuah Khan <shuah@kernel.org>,
Adrian Moreno <amorenoz@redhat.com>,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
Matteo Perin <matteo.perin@canonical.com>
Subject: Re: [PATCH net 1/5] net: rtnetlink: fix link nsid reported when the link is local
Date: Mon, 18 May 2026 16:59:44 +0200 [thread overview]
Message-ID: <b88ae398-ead3-4cca-83f3-92f29891b4a1@6wind.com> (raw)
In-Reply-To: <30599c3d-66b5-4787-9ead-53ab716ba338@ovn.org>
Le 18/05/2026 à 15:55, Ilya Maximets a écrit :
> On 5/18/26 2:46 PM, Nicolas Dichtel wrote:
>> Le 18/05/2026 à 14:11, Ilya Maximets a écrit :
>>> On 5/18/26 8:21 AM, Jiri Benc wrote:
>>>> Hi Ilya,
>>>
>>> Hi, Jiri. Thanks for your thoughts on the matter!
>>>
>>>>
>>>> IIRC this was added because Open vSwitch needed it. I'd expect most
>>>> users that need to deal with cross-namespace detection to just switch
>>>> to the given netns prior to issuing RTM_GETLINK; at least, that's what
>>>> I'm doing in the tools I wrote.
>>>
>>> Yeah, that's also what other projects like FRR are doing. It's a bit
>>> of a hustle for multi-threaded applications, as AFAIK, there is no way
>>> to just move one thread into a different namespace, so if many threads
>>> are doing something with the network and you suddenly need to check
>>> something in a different namespace, you can't really do that without
>>> pausing all other threads first. But that's a separate thing, unrelated
>>> to the series. I'm just ranting. :)
>> Hmm, not sure to understand. setns() is per thread (see man setns()).
>
> Hmm, I got my wires crossed here with something else, I suppose.
> Though CAP_SYS_ADMIN requirement may be an even higher barrier.
>
>>
>>>
>>>>
>>>> On Fri, 15 May 2026 22:19:20 +0200, Ilya Maximets wrote:
>>>>> But this doesn't work for link nsid in cross-namespace RTM_GETLINK
>>>>> requests. For some reason the code checks if the original device
>>>>> and the link are in the same namespace and not if the querier's
>>>>> namespace is the same as the link's. So the logic becomes:
>>>>>
>>>>> - if NSID is not reported, then the link is in the same namespace
>>>>> as the queried device.
>>>>> - if NSID is reported, then the link is not in the same namespace
>>>>> with the queried device.
>>>>
>>>> I'm not sure I would call this a bug; the original idea was to use
>>>> IFLA_IF_NETNSID to switch to the point of view of that netns but
>>>> without actually switching to that netns. Hence, the netnsid is
>>>> relative to the caller's netns but otherwise, you get the same reply as
>>>> you would if you switched to that netns. If you think about it that
>>>> way, the current reply is consistent.
>>>
>>> It makes some sense, but the fact that all-nsid notification and the
>>> cross-namespace RTM_GETLINK provide different IDs makes it inconsistent
>>> in my brain. We have:
>>>
>>> 1. nsenter(target) + getlink(local) = target-to-link nsid.
>>> 2. getlink(target) = caller-to-target nsid + caller-to-link nsid.
>>> 3. all-nsid-notiication = cmsg(caller-to-target nsid) + target-to-link nsid.
>>
>> all-nsid-notification appears before cross-getlink.
>> The goal, for all-nsid-notification, was to be able to receive netlink messages
>> of a subset of netns in one socket. So these messages are provided as-is, ie
>> like if they were sent on a netlink socket opened in the corresponding netns.
>> It's generic, there is no need to patch every subsystem.
>>
>> cross-get*() have been added later. The chosen behavior is friendlier at the
>> cost of patching every subsystem that is supported.
>
> That's exactly my point. If we're creating a special patch for a subsystem, we
> don't need to adhere to the exact structure of the original message, since the
> data reported changes anyway.
Sure, but only for this special path then (ie cross-get). My understanding is
that you are interested by the all-nsid-notification path.
>
> IMO, not reporting nsid that is the same as the caller's nsid is more friendlier.
> But that's, again, just a difference in opinion at this point, I'll not insist.
The problem is changing the netlink API. As you said, a new flag would be needed
for this.
Regards,
Nicolas
next prev parent reply other threads:[~2026-05-18 14:59 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-15 20:19 [PATCH net 0/5] netlink: fixes for cross-namespace nsid reporting Ilya Maximets
2026-05-15 20:19 ` [PATCH net 1/5] net: rtnetlink: fix link nsid reported when the link is local Ilya Maximets
2026-05-18 6:21 ` Jiri Benc
2026-05-18 12:11 ` Ilya Maximets
2026-05-18 12:46 ` Nicolas Dichtel
2026-05-18 13:55 ` Ilya Maximets
2026-05-18 14:59 ` Nicolas Dichtel [this message]
2026-05-18 12:26 ` Nicolas Dichtel
2026-05-18 13:45 ` Ilya Maximets
2026-05-15 20:19 ` [PATCH net 2/5] selftests: net: add a test case for cross-namespace peer netns Ilya Maximets
2026-05-15 20:19 ` [PATCH net 3/5] net: netlink: don't set nsid on local notifications Ilya Maximets
2026-05-18 12:14 ` Nicolas Dichtel
2026-05-18 12:46 ` Ilya Maximets
2026-05-18 12:56 ` Nicolas Dichtel
2026-05-18 14:06 ` Ilya Maximets
2026-05-18 15:41 ` Nicolas Dichtel
2026-05-15 20:19 ` [PATCH net 4/5] tools: ynl: support listening on all nsids Ilya Maximets
2026-05-20 0:11 ` Jakub Kicinski
2026-05-15 20:19 ` [PATCH net 5/5] selftests: net: add a test case for nsid in all nsid notifications Ilya Maximets
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=b88ae398-ead3-4cca-83f3-92f29891b4a1@6wind.com \
--to=nicolas.dichtel@6wind.com \
--cc=amorenoz@redhat.com \
--cc=davem@davemloft.net \
--cc=donald.hunter@gmail.com \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=i.maximets@ovn.org \
--cc=jbenc@redhat.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=matteo.perin@canonical.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@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
all inboxes | Powered by JetHome®