From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (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 0C7B3409E1C for ; Mon, 18 May 2026 12:26:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779107215; cv=none; b=LMCXDBPFQ6YcjDxZToAR1Rl4qCUjAwrKwhxB+R39eJ0DtHhW+6V4LJKm5PJC2GJjXDXh7O37b6Es5TkOahmJneMoVlL45Hw18EiyM1yPVFO2/j+loY/UIW57kcVEPlb5rtW+90CIqW3E8G64CYIdAs89yX0G7QmugUXWUq7s+Hc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779107215; c=relaxed/simple; bh=aSTIccs+v3BOXNzJps3pGcZ+OSMa6U+1upRu9QgbhdM=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Vc+B5lNOySXv3D1dJLKutf62bIKXJtc3wkfSAQYMZnmRmk/apc+AZJ2bwY/zGvtQmNMfXBoRqttDn3GT9g8x1kUhU3x6yifGMV6jtgrBX6Bnh6my+glYxAt7em7XRHj/L6nZ3Qg6+4025DfQdxQva/oI4YaeBqHr9+A5jgWWazw= 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=ATutRfXn; arc=none smtp.client-ip=209.85.128.50 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="ATutRfXn" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-48fde653997so2678355e9.2 for ; Mon, 18 May 2026 05:26:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; t=1779107211; x=1779712011; 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=K7f4p9DDizh5dEM+ARpNcE58XjtZwhJ/w+0XvXwelXk=; b=ATutRfXnY+gIvP820ugX6IERpTKx8wkYMtdmDpqClNp1jpIz9cazMnQ/0394O45yV7 5UHgs0yl6y6DAIW2zlEMFhCJX6r/wpI9Ju16EmFYmZnKuDg5OiM2an9iN+66Wp62whKV WL3H1fp6jAAlVk56ZAEyOoYHdjcsRTo9ApEGofBYGN9zY08/203ZDnvfGV9zDhv4ODGC kee1dUSUzG7tdtlaX4pqYgZkzBoCx9P/9h8mV9R/MK49EkBMd6c+DMrkUKn5G3wCeqc3 7XUzH3EFmjeK+9VqzsvplyjUIFthwRGctUbORHBHTcxFN7J8Qmsp4yMaBqRo+xrSk2Jb no+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779107211; x=1779712011; 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=K7f4p9DDizh5dEM+ARpNcE58XjtZwhJ/w+0XvXwelXk=; b=V7Z+RBjGRaHLX+VSTpeMB+4p4axJhQLeh0VFmJJ7w5rsWJeB83a3VMvBZAbKdCLz3Q lupsU+Qcbmv5c04T7kA2MXHBEvJ2cFYvNyFrBgZ1ZR7xoNyOF5RiWdMgVeqCGYnipYBj 6XK2DIge+L+FWwg+fJu38DoK1zCL4DpzpvZTZejSGlAZdkw80RySn6Ama+jvrUFFY1z0 KweGkW947OD1f75iJSDsPB6zCouBOcYr1M5T0DEhdE0KNfYwF4YvbEb7V3uMsvWFKX95 A0J+AtvkW1NBgbt3vpmoXXzoCnFAjHLCJUjz/6SEyUFoNsrN03l8wRfwHy4bTWmxXju3 dfRA== X-Forwarded-Encrypted: i=1; AFNElJ/BZB/0hFc0bq1jD9uHhn+53CCbUcvcflFozuezt0zvWHfG1cyEDkgh2m4GiVxtpDN04w+bqKljo7AEbT4=@vger.kernel.org X-Gm-Message-State: AOJu0Yzr4iMZofUbpU1b6Yun5gXsr8uM/MMXzd7Fe8KeRD/AF5tyPtf7 8ksyoiK/wQxoM7lz32lA/Vi5r5H8IEWzeE96noIjYBOAlSqz6QiJtq/dp1yHH7KSB1g= X-Gm-Gg: Acq92OFCf+0/IRld7fqD7fWYWyR9tesqpv5nqu23/ikwSJWOTAaiQXJqzQpgXNuh+Ht WJ87o04J5B5s0NmIS1jJhfbnytyjiquQ9vL5YJoaRwMPhZtUzbNARTVaTLi9IY2Zsy+mx2Wm3hG UxQhfG+D0mf8aN9b86hG7V/G+ICyCpgPz7AVwgRjfw1an9dnW7A7FfQ8py9opS3OxYK5D9KECyC vwHS9W3+EPBnNlQSQr1hFQ4LP75YchI7zY9d4oKtrK3k8pEibnJluL9XMJJWJd4EDqU7l0uEZM/ S2WC76yq4b+FT+3BFcD1FGB/BiW8ucDV8Z1Wd8DOH1nV0qGm8+bETRF2TEI476IPBI8WG1/kn+4 X2D450b0xEdu7qxeHzwl/TfnQSZd1C5JNm17nyaAZIxIdJ6KcCsU+xcaAd51Z15f1pqu55LZdWw tXpXiIAqrSQV9pMMwaBX03pIJ7HmSUtxn6pI8txAObBehuhwrGVMLpmAgKgCgjPBWe0wJXmidb7 xOg X-Received: by 2002:a05:600c:3b07:b0:48e:6db5:76e6 with SMTP id 5b1f17b1804b1-48fe63099c6mr122267235e9.2.1779107211132; Mon, 18 May 2026 05:26:51 -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-48fe5cab818sm261195405e9.14.2026.05.18.05.26.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 18 May 2026 05:26:50 -0700 (PDT) Message-ID: <596094fa-4e41-4ffe-9261-47089ff92f74@6wind.com> Date: Mon, 18 May 2026 14:26:50 +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: Jiri Benc , Ilya Maximets 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> From: Nicolas Dichtel Content-Language: en-US Organization: 6WIND In-Reply-To: <20260518082138.37522db0@griffin> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Le 18/05/2026 à 08:21, Jiri Benc a écrit : > Hi Ilya, > > 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. > > 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 don't agree. The expected behavior is to have a IFLA_LINK_NETNSID if the link part is not in the same netns as the netdev, see d37512a277df ("rtnl: add link netns id to interface messages") https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d37512a277df > > 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. +1 > > I agree the side effects of the self-referential netnsid are > unfortunate. But that's an orthogonal problem merely uncovered by > IFLA_IF_NETNSID, since, as you correctly note, such netnsid can be > created also by other means. This is (AFAICS correctly) fixed by patch > 3/5. As said in my other reply, getting the self-nsid of a netns isn't complex. An application should be prepared to handle this. > > So, I would argue both the old and the proposed behavior are valid. > I agree that from the point of view you're presenting the proposed > behavior is easier to use. Double so since you're arguing from the Open > vSwitch POV. > >> 4. A seemingly read-only RTM_GETLINK request for a different namespace >> allocates a self-referential nsid for the current namespace, which >> is a little unexpected. > > I, however, don't agree with this argument. RTM_GETLINK has always > allocated netnsids, even long before the patch adding IFLA_IF_NETNSID. > There's nothing special here. You might call the netnsid allocation > unexpected but it's been part of this since the very beginning. +1 > >> A research across open-source projects doesn't show any projects that >> rely on the things that are being changed. I couldn't find any >> project that uses the reported LINK_NSID with cross-namespace requests. >> And no projects that use cross-namespace requests seem to even parse >> the reported LINK_NSID. We (6WIND) are using this behavior. It's part of the netlink API. Regards, Nicolas