From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6CB7B436346 for ; Mon, 18 May 2026 12:46:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779108398; cv=none; b=UgpGW2/d34ztb7NmWQGGy8vNFgLIM7/b7QdLrt6sZEikX5aqkY2i+qzcU4ehYqycjLaYWmh+Ck48K5IVz52d61H99buv2Xp2VOKbZ+JOXvK9PsaZxlOVyyhaARWeV7bGnFa6aWvLADwh7HorUn7v4KZuu6w3PXZfbrdflD1IGTg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779108398; c=relaxed/simple; bh=WxfkEGBSDDZghQhEd8cunw4cIMQIp0QRK4UAokQx9ag=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=XAh7YWQWSeIjumRrAq3E8l6LXm0SnpzO5vtwlfx/6cE2ts9Xpwo9PW/uDTRGiTg07sHUbvK4xTCU/YNd2dT9Rf/8zTlFDhjnkM2deE6EM3o2U20ATdBl9EgZ/okV3h4DAHqaiK+HWx2wEghp46t/H3reZ4FCJw/CdQ3vAYCFUAo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=6wind.com; spf=pass smtp.mailfrom=6wind.com; dkim=pass (2048-bit key) header.d=6wind.com header.i=@6wind.com header.b=a528SPgj; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=6wind.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=6wind.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=6wind.com header.i=@6wind.com header.b="a528SPgj" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-48fe7a40e51so2203955e9.0 for ; Mon, 18 May 2026 05:46:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; t=1779108395; x=1779713195; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:organization:content-language :from:references:cc:to:subject:reply-to:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=XkbPTf87WHcjTkOIdvBF4Uyie2ELBq9sAWg2d8Lhc/w=; b=a528SPgjg5pAce01xmAki5KbGVZGe7/DMH0CNJkfn+YFCxFzVmAOheqstQ4lDHt9lS HajOEnY73LfIczgVvlgxIQXVG2gjgLXJrMkq6AF5Cmja0JChpwCDg8JKebbOLNPTD5f6 qsLd3zoR3cGBroLyvD7fuQK0ew2BljCqWR1BugqWCycwrvEDIns/vOtWgtfkHywi7kC4 G0WMIUwaXkNIN5Fn2Cr26uNDCjJwUAX+m6v2uxLrL9nnnru7ojU3LMsblNlGWf5MA7lo sPu0g+oSPjBvKn1HrPWWy+MFszfvjOcMo8T7e8ST141+hun1sJRhv+UaEsw7tXK0CmIe 6/Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779108395; x=1779713195; h=content-transfer-encoding:in-reply-to:organization:content-language :from:references:cc:to:subject:reply-to:user-agent:mime-version:date :message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=XkbPTf87WHcjTkOIdvBF4Uyie2ELBq9sAWg2d8Lhc/w=; b=su0O826/h9gJ+KdrPiGGTNh3ac8STHpnnsFVnTE+BvPylp3iwganKI7UC63/f73H0n /y8CeWk7J5jQu9ifYB7D+XKJMC/xYgvZFa4l3mYpHnfa1HwzvKnzrIcSP8sYonGRvdP3 828WHjwGApNaopT+2V34hLd8aP8r7zB+x1WcmJMv2A/ILnDDASSSqzC2lqTL+Yj2sY0h 9uy3bFHC2RFkXEUSc8XqWHiPHJ6EzLs1dP+gg3PH11MiAoZDoZBRbRrBKb314WZS54cH g7hxnt1rg9XDGdWTHDn5O+gMl82hZgJIO7syXyghQxBYuLJVPmiFc5ph92jZ3W7AYTic jPwQ== X-Forwarded-Encrypted: i=1; AFNElJ9WC7UQpDgjROugHGeORE5ggv5UwIlrBktE4VJgaxR8DuXBVCNgA0i9Asa7Pzoc8FVItdoJXCHlo7B7aYk=@vger.kernel.org X-Gm-Message-State: AOJu0YyF6FNYhue7THl80FK6tr14KL2kZbCNVebBb8N//SLSZBz2nm8O WjOIHgJf7AV5uGeANUnV616UCbKMIExOACn9awwNhIh6b6LrMnHtPfcglJXz6c2ErgY= X-Gm-Gg: Acq92OEK+4yfAH/vqPY9hkhJQbtTZj7uBd2PbKOS58BZiiyvBMuhrvWhZqR2qLw3FnW BSySLocQEHMVaGgX2MtURqtSsUYYq8RwS9Cn78OHnOl1cdrKKp90ldK8FrilFRtNLPtxG4sIQVd fSM+bQPszzG/5SrgljfZj8lkD1NEOfvRGOgqVQUOs6ogxmAcxwiYIqX7wXVKtBY9soLVysriGob VhwWWsQ9Y2DiYsHNbAc5P3p2v5BSBo1WnqMKQrcGqaWqZgR/3TiF4nh57/eFIvH5kT73BK0cTaS jwMWhdwss925Rb0FNrLpaD32n19kUzZIDrq0u/SmqYaSWp9ovnMh7+jhN+OjYtYigoboobBJOHx bqKtzY4GoEL4FPI4XBUxdgO/2ZL52Qr4iituBQhCsnMScF8BztfiwtOixBry9U4oEGx61Cwb0Us SF/dxE2dzxdchGIpx2nGvJTk81aQcXGH2jM7ipY9nXlAGWQzACznhi/+O35FshL0C4I85/Hx6Z8 5ii X-Received: by 2002:a05:600c:4455:b0:489:1fa8:b895 with SMTP id 5b1f17b1804b1-48fe5fcb2dfmr116067445e9.2.1779108394716; Mon, 18 May 2026 05:46:34 -0700 (PDT) Received: from ?IPV6:2a01:e0a:b41:c160:6a1d:efff:fe52:1959? ([2a01:e0a:b41:c160:6a1d:efff:fe52:1959]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48fe5cab7c5sm265288175e9.12.2026.05.18.05.46.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 18 May 2026 05:46:34 -0700 (PDT) Message-ID: <5d4467d5-f081-4f7e-ac3c-9134ee8ddc6e@6wind.com> Date: Mon, 18 May 2026 14:46:33 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Reply-To: nicolas.dichtel@6wind.com Subject: Re: [PATCH net 1/5] net: rtnetlink: fix link nsid reported when the link is local To: Ilya Maximets , Jiri Benc Cc: netdev@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Donald Hunter , Shuah Khan , Adrian Moreno , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Matteo Perin References: <20260515201937.2813983-1-i.maximets@ovn.org> <20260515201937.2813983-2-i.maximets@ovn.org> <20260518082138.37522db0@griffin> <8aa4e92d-0498-4335-b3b1-dabd7e507ed7@ovn.org> From: Nicolas Dichtel Content-Language: en-US Organization: 6WIND In-Reply-To: <8aa4e92d-0498-4335-b3b1-dabd7e507ed7@ovn.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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()). > >> >> 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. [snip] > If we don't consider this behavior as a bug than I'd rather just document > it and solidify in tests, i.e. drop the code change and update the tests > I made in the patch 2/5 to make it clear what is the actual behavior. > If we change the logic in the next tree only, it will not be possible for > applications to understand what is the behavior without checking the > kernel version or introduction of extra flags, i.e. we'd have to make the > new behavior opt-in. Which may be fine, I suppose, but will require > application changes to take advantage of. +1 Regards, Nicolas