From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) (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 A75C1480DDF for ; Mon, 18 May 2026 13:55:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.66 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779112527; cv=none; b=iYx4ptXgaDnavvI/mXNKPbP6V/RG3KFuYlXJFLeqcQo0galLa7cWZUcWohDvIpyaYPKweJmXGeYWdc2wkxQmuMEjiWYCHoBcnjK8D8npj44ZPkLTlmyA9OKfsmlt9nbsU84Efni6tDAZMm+M5hqCB240ID/33PxyTAja++0/eQA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779112527; c=relaxed/simple; bh=VMOptizGQ70e+J7xxlCbq9mgAizi8a4WRjYduTd5ZK4=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=vDG7Iznj4Ru4BrGyF02ZFUHJhm1IEzn54PXow3STo4RAG6rFlBGluFyKrjUHYDHeiobzErcq+WZzwWYUdXnAhsqRzl43405goWUCgxKLqdWpi9VF+N7ssys4NB34IG0WFTtmItKaRtKueR/j9J8FZ2mAlvGlNxvFaUwA58LYOs8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ovn.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.128.66 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ovn.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f66.google.com with SMTP id 5b1f17b1804b1-48e56c1bf5dso11068035e9.3 for ; Mon, 18 May 2026 06:55:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779112524; x=1779717324; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:to:subject:cc:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Tizt3kVJ9HgwVYO0PwgdSdfIFIk0uWpRihhV5cyqjVQ=; b=YtO0QO9dFlJUCajWuQfD0S1DPgfFV+KeRMIbfk2cVCPlnn3ku39kuhfZDofOmYVLwZ CCiOKb6Jy6lCsP+IYc/6AtBTVS4zepD0OiBCxifLB4E7TaK/kgX87c3xhpKzQF8S9RPE V3fRcH751cgLP+uuv7srN1C/CjVmugvwUEYTCqSweFXBDk1uXEbqD7EYOvz/bQQDvGRL WUEUN8b7LFminB2p5AgSgFPYUJoAVFvKBXHdPzCSwPrk/ZAngGZ6E6+9wLeyptXDag4Z nJTK3dYIwK5kavX53sNTUHxUMfkpJ5hwyjMVqhHqrARL7ZGiCkDZ8uP6spVimgVTH3Vg nrTw== X-Forwarded-Encrypted: i=1; AFNElJ8TFWCUUGzMi/S598e25kQyp5fOefFY32snCMqKgQR6fBk5F4x0jOafiP8nYjGgzBZ7FH1EXCeYE3NAvQM=@vger.kernel.org X-Gm-Message-State: AOJu0Yw3PoLppZYMGHfyH9grG8Rn42BsY8WtJqouCPhtk+HC+SxjoQim b+rQWRt8Xh/ssXsIP7bAuPbsM96/nIIlt/SPn1d6+ndb4+n7PuPrq0Vh X-Gm-Gg: Acq92OGqG1HD8ffWcyDYO2DrrH64gdjGYTmrIlIUrfEgaroaUECNPD8uupwwB0b3ajE XxXwgsVh2jzeT5nVgsxX7M1vw3Gd/ddSOxUfh1eG1/UtMLhHSp/HFSK3NtAL4CsoZlvUmrT3ihF mIbbw3qNJB0XOo9apXHj7GGfsUpiFfg2GB27xHpHNFFlN/QIzOA685A9Uk+GwJi3qnhEGOqaaBT bhemch9+gwVuknKG8A4SMywFfBXvCRadSRT3QYrwOi/qgLDwMKTG+5yadO0ERVoT8zDBqVC6xSk B2QD2e0msuANbpHVdo/O6tK9dYcLdciP+COeAf9o1CAnZFUPEpejTAcmxS1SPMAYpxowyqN8dll SeN02f9jT22YOWbPwrN8D3IPoBmdDmNYYy+U5xtS67co1ymDXXY4zLNQ+hHTNICA2e4P+S3D9Hx /xp+RZ6A+QVecuztipKwItMDarwdlF+JcZqDPYx3zfh2VuEOskNPOCU1k= X-Received: by 2002:a05:600c:3b12:b0:488:a824:fdff with SMTP id 5b1f17b1804b1-48fe61ed2cfmr223048385e9.22.1779112523670; Mon, 18 May 2026 06:55:23 -0700 (PDT) Received: from [192.168.88.241] (89-24-32-159.nat.epc.tmcz.cz. [89.24.32.159]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48febe79ce3sm85711065e9.31.2026.05.18.06.55.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 18 May 2026 06:55:23 -0700 (PDT) Message-ID: <30599c3d-66b5-4787-9ead-53ab716ba338@ovn.org> Date: Mon, 18 May 2026 15:55:18 +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 Cc: i.maximets@ovn.org, 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 Subject: Re: [PATCH net 1/5] net: rtnetlink: fix link nsid reported when the link is local To: nicolas.dichtel@6wind.com, Jiri Benc 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> <5d4467d5-f081-4f7e-ac3c-9134ee8ddc6e@6wind.com> Content-Language: en-US From: Ilya Maximets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faZqPtrdm1C+e5gZa2gkmEzG+WEsS0MKtJyOFnuglGl1ZBxR1uFvbU VXhewCNoviXxkkPk/DanIgYB1nUtkPC+BHkJJYCyf9Kfl33s/bai34aaxkGXqpKv+CInARg3 fCikcHzYYWKaXS6HABEBAAHCwXwEGAEIACYCGwwWIQSH6ZrVEpascJjzbVq59+x3yCm/lgUC Z8H0qQUJDIjuxgAKCRC59+x3yCm/loAdD/wJCOhPp9711J18B9c4f+eNAk5vrC9Cj3RyOusH Hebb9HtSFm155Zz3xiizw70MSyOVikjbTocFAJo5VhkyuN0QJIP678SWzriwym+EG0B5P97h FSLBlRsTi4KD8f1Ll3OT03lD3o/5Qt37zFgD4mCD6OxAShPxhI3gkVHBuA0GxF01MadJEjMu jWgZoj75rCLG9sC6L4r28GEGqUFlTKjseYehLw0s3iR53LxS7HfJVHcFBX3rUcKFJBhuO6Ha /GggRvTbn3PXxR5UIgiBMjUlqxzYH4fe7pYR7z1m4nQcaFWW+JhY/BYHJyMGLfnqTn1FsIwP dbhEjYbFnJE9Vzvf+RJcRQVyLDn/TfWbETf0bLGHeF2GUPvNXYEu7oKddvnUvJK5U/BuwQXy TRFbae4Ie96QMcPBL9ZLX8M2K4XUydZBeHw+9lP1J6NJrQiX7MzexpkKNy4ukDzPrRE/ruui yWOKeCw9bCZX4a/uFw77TZMEq3upjeq21oi6NMTwvvWWMYuEKNi0340yZRrBdcDhbXkl9x/o skB2IbnvSB8iikbPng1ihCTXpA2yxioUQ96Akb+WEGopPWzlxTTK+T03G2ljOtspjZXKuywV Wu/eHyqHMyTu8UVcMRR44ki8wam0LMs+fH4dRxw5ck69AkV+JsYQVfI7tdOu7+r465LUfg== In-Reply-To: <5d4467d5-f081-4f7e-ac3c-9134ee8ddc6e@6wind.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. 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. Best regards, Ilya Maximets.