Received: by 10.223.176.46 with SMTP id f43csp411626wra; Fri, 26 Jan 2018 00:37:18 -0800 (PST) X-Google-Smtp-Source: AH8x226ZxsP1CIGuNbTiY7RUfKyvkCrWRs2f3mV7Pad8tx6nb9YIcYAWvnLVnZ4GeJW4kJzDvAwa X-Received: by 2002:a17:902:9a8b:: with SMTP id w11-v6mr7865654plp.118.1516955838755; Fri, 26 Jan 2018 00:37:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516955838; cv=none; d=google.com; s=arc-20160816; b=V0DfxDw8BgbZL8fs/fqBcSz1kE2Mv3x5UlLWf5MCdhHWegu47pK+iB0go/F1OMSdhq ghDZy1DmDdSsaU7b9FCQ4MUBCzySEUpwuTmigZzzBCpFraXtqu3X+ABMrE6IFWiizXCn 6svNx/a3BAHvjkR1Z984TZLr80Xbi6a34A5lLvXvDoAy/HrkFwdVZoNZHygyNp6sSKhX H2gkdK0VwdoB8Zsm+XmqLARe8ZYjBMNoK5K7/6yflYqEwBcthQ9LFiKpMUDje6V39IX4 70gbLua5z5ZQPJLKhdVOV5HiDpRG5fDFFLd260y6KzlLVRTWyfM/LGG2Bker3BSzW9/u g9yg== 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:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=G+LZ5rW7o2d+cQnHIiMV25ajmSJGLlESSE+p1uatwzM=; b=jhYTbfo2hqLHitmybjrqVD2REv4p5FwZTMW3Z44gkYWkJISdPrvZSRjsh3aYOAaAoi ccxiEqGAtAFGPU3O3pRBH8KQdjMvkz0H6cVjWdEyhkmVWOGr8v3LFqz1/wrlDoSMXDNv R1oSJ1uR/KpXcDuUhQc6w5UOfEG610Nu0w0FhSl5ArJwXQBZdG6FZp3CBeQdbpsC6GWc QBGm7uTX2+7mOj2q2CuK+7MVOJyuOOAeUt5e7EMGG7D8rGa8vraHGb1xurKcu2mFYqQh H/tFloQHhjjiTh+irE6T1leXDTIfXsxVL8iMpHdRhzAbz7Cm6/mfXmENkFN176a71Ik2 P26w== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f34-v6si2989966ple.102.2018.01.26.00.37.04; Fri, 26 Jan 2018 00:37:18 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752428AbeAZIgj (ORCPT + 99 others); Fri, 26 Jan 2018 03:36:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49340 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752210AbeAZIgh (ORCPT ); Fri, 26 Jan 2018 03:36:37 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2A5AE110058; Fri, 26 Jan 2018 08:36:37 +0000 (UTC) Received: from localhost (ovpn-204-126.brq.redhat.com [10.40.204.126]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AC53F64458; Fri, 26 Jan 2018 08:36:31 +0000 (UTC) Date: Fri, 26 Jan 2018 09:36:29 +0100 From: Jiri Benc To: Nicolas Dichtel 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 Subject: Re: [PATCH net-next 0/3 V1] rtnetlink: enable IFLA_IF_NETNSID for RTM_{DEL,SET}LINK Message-ID: <20180126093629.142e2a74@redhat.com> In-Reply-To: <3b916ec7-3aca-13a7-7a48-7a7e8822e488@6wind.com> References: <20180124142634.17766-1-christian.brauner@ubuntu.com> <20180124173515.5ae2bc05@redhat.com> <20180125233043.66ff08c2@redhat.com> <3b916ec7-3aca-13a7-7a48-7a7e8822e488@6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 26 Jan 2018 08:36:37 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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. 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? > 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. 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. Jiri