Received: by 10.223.176.46 with SMTP id f43csp457443wra; Fri, 26 Jan 2018 01:29:46 -0800 (PST) X-Google-Smtp-Source: AH8x224sO8Td/xOaPrwECoUL/X2S8Ihh3sqTQC6cDkwZTYnF52ubecFyzlmSEJXPe7unwrFcJ713 X-Received: by 10.99.170.73 with SMTP id x9mr15267243pgo.393.1516958986605; Fri, 26 Jan 2018 01:29:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516958986; cv=none; d=google.com; s=arc-20160816; b=iPfIaR+puRkKZfaROeyMiujobbQ9IbRuQKdsTSJ8zvy+kSYRXgrwcDZtHqAphhQcO9 XA04dbrQRm/3aV7UCO3rOYXIfuX08N5vcm3nrkIxvECfig/oDY9VlLZi8uCby8Q+0/Pc 0M3WYirI42rl473jFxw7sAnKEO4Ppega5mYiKfdAHR+3IUPBu9iUEK9TyGG+OcwhaplJ gh2rMVEM902Og2oihSxg7KByAhs5fTmzPQeQhlNL6kPSJdBf9c2JAd3cBmaud7nzImZ+ s00NwtBZzIMb7LcBYrgCxxgkRaJmvTXNcxhbL05xEQuXq5HztqlZfNfhYJHToCWfRPtX r6xQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:cc:to:references:subject:reply-to :dkim-signature:arc-authentication-results; bh=PJ4Wgk0QDksOROJYteIk6v2mewHhm+iyD0iM3xi4vuM=; b=V+hx84TsAD2sqk4kncI8Kr3CzQiQxh3zal+v5Vtj073nX0iW5cfMI0rbKzZoelXQkw 10nDwKoc069iUKvwxcIPzeV9CRAUqT39ybxar+rOOEBa8tkiZzgpesgaBMN3GI7LwbYx Me8c8Ccabrki/+CPUSHCkTIUZC1OW0q0K6N3Qpx12PPag30TFjU04nw82IzQJIYR4xTM LVHlgUH/xChREvbgBL6JIBsDyPht2zbGXwGzJrkFURAyp/14Xw3bfYZMPwAfcdKD9sRI yDiYN9kUXGJ7ojEfqh8tXr9Caf7DfMgT4YEOT7qAJy35tsMrSxWvcZMGyr1IEYUX/xTY UqwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@6wind-com.20150623.gappssmtp.com header.s=20150623 header.b=s/JmusAD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s6si2764066pgr.775.2018.01.26.01.29.32; Fri, 26 Jan 2018 01:29:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@6wind-com.20150623.gappssmtp.com header.s=20150623 header.b=s/JmusAD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752828AbeAZJ2j (ORCPT + 99 others); Fri, 26 Jan 2018 04:28:39 -0500 Received: from mail-wr0-f169.google.com ([209.85.128.169]:40445 "EHLO mail-wr0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752521AbeAZJ2g (ORCPT ); Fri, 26 Jan 2018 04:28:36 -0500 Received: by mail-wr0-f169.google.com with SMTP id i56so1559072wra.7 for ; Fri, 26 Jan 2018 01:28:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=reply-to:subject:references:to:cc:from:organization:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=PJ4Wgk0QDksOROJYteIk6v2mewHhm+iyD0iM3xi4vuM=; b=s/JmusADpnL3Tqmh35GoKc8uRCRTaUUlN+/iRxKz1+MAfB4koMnntbfpeCzyqRdwT8 tmPzNROug5kmikawLfsWW+7f5cA0zgJicZlMk0bAUsNJTMtopm8FBkNDbKVzc9vP2PhQ Mz+Vx6FtrciRad+/VmddpeM40Tgni2LtdlV4Ry1VZ8O0GEz5rM2aAfDW/gSG/rJGC0/t egfvamqe3oALbAo+B8bYAtt5FTp5DFB7MruFYN2gag5Sa6aP9e/aVTvNG7cxJ4x/ityu rhempNyavScF0o3TzC/xOlYFUBHeBzqoALtwHGGLKm16Gtquf1v4trKo+UZCtAfV8R9D srAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:reply-to:subject:references:to:cc:from :organization:message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=PJ4Wgk0QDksOROJYteIk6v2mewHhm+iyD0iM3xi4vuM=; b=Te7KZd2/4GciiBZG84b5ZkJTjlZIYLceeRkCwRjDU4ph4w17tIFxJgkxfp/Bp/C+Rp ZQ7spop30Z76svKM3DkD9qswnsNRGDeQIcV99T0GQBbmI6NnbKdefHX0v8NyRKJkAYQ7 Q9fJTMP8o07Jy68uIZrpXNQruyRlNaxOeAYVglUx+CgKBZGt3ILaYnSGSp1gTsk5gjXj Zo3hrMnHBtBgxntlxO9zIeHy9CCLMpYFC5M4/bSV8vrOUGZRi2wuF9++Px6D52R0L8mh sFMe+aVRvyosaAGRtWjuO2gwRK+WITA2GP/Ac6KOg1dcFEWXqy2DifBN5W3EScDnFMlI DaiQ== X-Gm-Message-State: AKwxytfc1i1eC6f5feYOh3iYq7fAqQMgLwNclorwhPaMV8MXvFv6MEQ6 vzHONwJgtOalKtTxcsLDkS41aA== X-Received: by 10.223.151.143 with SMTP id s15mr11913261wrb.270.1516958914467; Fri, 26 Jan 2018 01:28:34 -0800 (PST) Received: from ?IPv6:2a01:e35:8b63:dc30:c358:2e43:4ca8:894a? ([2a01:e35:8b63:dc30:c358:2e43:4ca8:894a]) by smtp.gmail.com with ESMTPSA id e128sm3346599wmg.1.2018.01.26.01.28.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jan 2018 01:28:33 -0800 (PST) Reply-To: nicolas.dichtel@6wind.com Subject: Re: [PATCH net-next 0/3 V1] rtnetlink: enable IFLA_IF_NETNSID for RTM_{DEL,SET}LINK References: <20180124142634.17766-1-christian.brauner@ubuntu.com> <20180124173515.5ae2bc05@redhat.com> <20180125233043.66ff08c2@redhat.com> <3b916ec7-3aca-13a7-7a48-7a7e8822e488@6wind.com> <20180126093629.142e2a74@redhat.com> To: Jiri Benc Cc: Christian Brauner , netdev@vger.kernel.org, ebiederm@xmission.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, linux-kernel@vger.kernel.org, w.bumiller@proxmox.com, Christian Brauner From: Nicolas Dichtel Organization: 6WIND Message-ID: <011a90c5-03a6-14da-d12c-d3ef4316e756@6wind.com> Date: Fri, 26 Jan 2018 10:28:31 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180126093629.142e2a74@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: fr Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 26/01/2018 à 09:36, Jiri Benc a écrit : > On Fri, 26 Jan 2018 00:34:51 +0100, Nicolas Dichtel wrote: >> Why meaningful? The user knows that the answer is like if if was done in another >> netns. It enables to have only one netlink socket instead of one per netns. But >> the code using it will be the same. > > Because you can't use it to query the linked interface. You can't even > use it as an opaque value to track interfaces (netnsid+ifindex) because > netnsids are not unique across net name spaces. You can easily have two > interfaces that have all the ifindex, ifname, netnsid (and basically > everything else) identical but being completely different interfaces. Yes, the user have to map those info correctly. And this complexifies the (user) code a lot. > That's really not helpful. > >> I fear that with your approach, it will results to a lot of complexity in the >> kernel. > > The complexity is (at least partly) already there. It's an inevitable > result of the design decision to have relative identifiers. Yes, you're right. My approach moves the complexity to the user, which make this feature hard to use. > > I agree that we should think about how to make this easy to implement. > I like your idea of doing this somehow generically. Perhaps it's > possible to do while keeping the netnsids valid in the caller's netns? Yes. I agree that it will be a lot easier to use if the conversion is done in the kernel. And having a generic mechanism will also help a lot to use it. > >> What is really missing for me, is a way to get a fd from an nsid. The user >> should be able to call RTM_GETNSID with an fd and a nsid and the kernel performs >> the needed operations so that the fd points to the corresponding netns. > > That's what I was missing, too. I even looked into implementing it. But > opening a fd on behalf of the process and returning it over netlink is a > wrong thing to do. Netlink messages can get lost. Then you have a fd > leak you can do nothing about. Yes, I also looked at this ;-) > > Given that we have netnsids used for so much stuff already (like > NETLINK_LISTEN_ALL_NSID) you need to track them anyway. And if you need > to track them, why bother with another identifier? It would be better > if netnsid can be used universally for anything. Then there will be no > need for the conversion. I like this idea a lot. So the missing part is a setns() using the nsid ;-) Regards, Nicolas