Received: by 10.223.176.46 with SMTP id f43csp3441486wra; Mon, 22 Jan 2018 14:27:06 -0800 (PST) X-Google-Smtp-Source: AH8x227uAWPdpZYIwY6+5nxDcEjA6RiIcCz2yzQ5yOcJn7X0Vxm0jjvplIR0olUJ1Pp9EaF7t9DQ X-Received: by 10.202.172.209 with SMTP id v200mr5226077oie.217.1516660026883; Mon, 22 Jan 2018 14:27:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516660026; cv=none; d=google.com; s=arc-20160816; b=rGOGnH0K9Lp0muu0tDRMLiKn+TBys8qlc/ZzUe72bFjxegNH2VGRxP2RkgaKf9Wgnv qP0L8d6VB4ZX7v37PgSOGtSXzmdGldQREAJy9N2pz3tUUNiXhFB6YUjnrgtkKV2xY3kP ztuviBAs5r4Q12+EvWBYtm/+72El59Qr1nbjKdvDoYm1cdzmU4l5A/t4HWSUBFU+sGxb j1zQEolbHIHxm6mGJSr3YQh5X+50kEwzlB+B9TxhPP3kECvFBscKR3Wsm3wc4bWSH0mP 5uIWRxtnioQnzifGjWedVwcNyFcsgCQndf66MqfMbN3BL+eHSD/pR0325QdZ8lrWkv6e LhfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=DIcgrOdHQc/94hdiOP1ZOxYDOCulqHDVclcwCcaSVEU=; b=0SrTi+wuu1pLa6buMs1Y8eAhaevFL034JQWyM2Wu9kZfyI+94TYjMbUcUDoMl7p3OE 57Gk3tAYJwFCqRLvLCgX9I1GjtfaijIDXB/aki3+V+53gbN8kC4nRQvmQsWs5KDMV0Qz qi41ikLEnOMocgQipJp5psPsZdPEgq9DZJBQN0JdLz4Gf7o99a+XyFZdRCRdBtG0rSZN zNs/SKdDBkeycMoxx1wgpvMzxSaECkMdY20Eyw9lKJ8vymkR8WCwy0MBvPcdaB6Re1K3 L5QH9df7e1HnEZXH1eSpYXzXs0gsjHcdin6n5UI1d0JYMecKzr86edfdmtXOqhkvofZi 2baQ== 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=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d15si6024663iod.145.2018.01.22.14.26.54; Mon, 22 Jan 2018 14:27:06 -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=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751174AbeAVWZq (ORCPT + 99 others); Mon, 22 Jan 2018 17:25:46 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:46122 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750996AbeAVWZp (ORCPT ); Mon, 22 Jan 2018 17:25:45 -0500 Received: from mail-wm0-f69.google.com ([74.125.82.69]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1edkX9-0001Jn-Uh for linux-kernel@vger.kernel.org; Mon, 22 Jan 2018 22:25:43 +0000 Received: by mail-wm0-f69.google.com with SMTP id b186so8225512wmf.0 for ; Mon, 22 Jan 2018 14:25:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=DIcgrOdHQc/94hdiOP1ZOxYDOCulqHDVclcwCcaSVEU=; b=lJMMooypmYs+euk+SH34mx0Cg9E9AJeZJL9H9jqeDDOYxd7ITwJt+KGeeK1g8iad0t kn7WM6HqguHOb8Psr/vRmaD8hM4tLjfq7wxBHmn6WrlylwhJtzIDCySvmEc6b0DB1OWn 9xBSHh2RlmJ7u9HPHKsHI7rZSolcEzMBgfJnL3QVN9KjaMD437Drt/T//NZ9P/+8zgcT RJSfTVTElsCZvAPwJl+KdAzUeeS+Q7V/XoOthUjT2bgB2FSBmJ/DOxKZxevZaCMovCcU T/TSHBmT50+g46hTo8+hTSo5SxKMoW4aCHrpUP15GQjWCRdX26oQ/sZPQJBl3sDXLGYq 6ynQ== X-Gm-Message-State: AKwxytdRCmM0FNI5SErYFXhkTz+/RQ3HFzOmBq0vvIFGSXfybkvE/8Wt 0Ts6lvWI6cmgzoIPsX447y2a0WrTegHgZyV2/XHBb6cdcru629o3q5YZIC2rnuBUT4QKyzd0RDH T8O/MVL8OkWnn45imswtSZc4RwAFSiim1O2RDboEbgw== X-Received: by 10.223.151.140 with SMTP id s12mr265211wrb.80.1516659943624; Mon, 22 Jan 2018 14:25:43 -0800 (PST) X-Received: by 10.223.151.140 with SMTP id s12mr265199wrb.80.1516659943432; Mon, 22 Jan 2018 14:25:43 -0800 (PST) Received: from gmail.com ([2a02:8070:8895:9700:651a:bac0:9d46:d9b2]) by smtp.gmail.com with ESMTPSA id 5sm13801745wre.35.2018.01.22.14.25.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Jan 2018 14:25:42 -0800 (PST) Date: Mon, 22 Jan 2018 23:25:41 +0100 From: Christian Brauner To: Jiri Benc Cc: Christian Brauner , 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, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, stephen@networkplumber.org Subject: Re: [PATCH net-next 1/1] rtnetlink: request RTM_GETLINK by pid or fd Message-ID: <20180122222540.oqrr3apswopavyta@gmail.com> References: <20180118202124.21616-1-christian.brauner@ubuntu.com> <20180118202124.21616-2-christian.brauner@ubuntu.com> <20180118212914.74878b82@redhat.com> <20180118205552.jm7shzcojbumax2k@gmail.com> <20180122220046.7b65a98a@redhat.com> <20180122212353.7n6lrruqedfhrwux@gmail.com> <20180122230616.0c457f55@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180122230616.0c457f55@redhat.com> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 22, 2018 at 11:06:16PM +0100, Jiri Benc wrote: > On Mon, 22 Jan 2018 22:23:54 +0100, Christian Brauner wrote: > > That is certainly a good idea and I'm happy to send a follow-up patch > > for that! > > Note that I haven't looked into that and I don't know whether it is > easily possible. I'll appreciate if you could try that. > > > But there's still value in being able to use > > IFLA_NET_NS_{FD,PID} in scenarios where the network namespace has been > > created by another process. In this case we don't know what its netnsid > > is and not even if it had been assigned one at creation time or not. In > > this case it would be useful to refer to the netns via a pid or fd. A > > more concrete and frequent example is querying a network namespace of a > > (sorry for the buzzword :)) container for all defined network > > interfaces. > > That's what spurred my original comment. If you don't know the netnsid > in such case, we're missing something in uAPI but at a different point > than RTM_GETLINK. > > When you find yourself in a need to query an interface in another > netns, you had to learn about that interface in the first place. > Meaning you got its ifindex (or ifname, perhaps) somehow. My point is, > you should have learned the netnsid at the same time. > different places. If you have a counter example, please speak up. This is not necessarily true in scenarios where I move a network device via RTM_NEWLINK + IFLA_NET_NS_PID into a network namespace I haven't created. Here is an example: nlmsghdr->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK; nlmsghdr->nlmsg_type = RTM_NEWLINK; /* move to network namespace of pid */ nla_put_u32(nlmsg, IFLA_NET_NS_PID, pid) /* give interface new name */ nla_put_string(nlmsg, IFLA_IFNAME, ifname) The only thing I have is the pid that identifies the network namespace. There's no non-syscall way to learn the netnsid. In this case I just want to be able to do the analogue to RTM_NEWLINK + IFLA_NET_NS_PID aka RTM_GETLINK + IFLA_NET_NS_PID to e.g. retrieve the list of all network devices in the network namespace identified by pid. Christian