Received: by 10.223.148.5 with SMTP id 5csp8006503wrq; Thu, 18 Jan 2018 12:22:37 -0800 (PST) X-Google-Smtp-Source: ACJfBotTxyFoQalrOzYQEdxEemPdDBoI+7yVmQfL+sKDYhskGzzqPCzsQWsFFlXDCRjh3fOiNR/D X-Received: by 10.101.81.141 with SMTP id h13mr22974603pgq.241.1516306957250; Thu, 18 Jan 2018 12:22:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516306957; cv=none; d=google.com; s=arc-20160816; b=vU9NdbfADIEVMUeRxkssJAm4im/TYlPXl/pJfLxK5+YuH0Z5S/KbByZKRque23wV45 X/OvCY7F1Q5uoNbmR6AC4A/CaHAsQYQlki8RBwrz+25okpYd3qclcDRTgUalCfBMKhT+ pxCq+ZOGg7lbv46TaOxz1StdmO2EmQyAr47ICajB6Nj2nDxu92KRA4TB4uX7i8CmpCPy j8cixOLFt2paVq4hoV1MMNOMDt8bbzRAf6cE0b8+kX56OasnFrXmuE/O/Ogab+7+QU77 8F5DyebImXW+v5sjWjTY3NwmBmxwrU4Pe+t/neP5kM+wJ4L1Ga7I7Liqj/717+JblP4b 6zyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=EwsYqcae8/1rzt+KwWALhVdQIpSaJM21QCpmpG45/U4=; b=EC+wPQJC5zsjqB2aKakSiB1zI0K9JHbWJQGDhyM1dK2ARnm4jEXD9rbhRBR/J0fesm +9MolNZjOaS+a9qldWNcDZ9++1u8ZOzzQfJgyIIQZ+gcxC5d+3dyc5rjqi4eervMZ3aW DqAjG7AryRxiBigLOs8/YR3J6WviOPmOrwGgIyNceXcfJyN5skebttzyd7cfj4zPGx2Y f53TZYxi8L2GEvEC908q3N3uTMR3oF/4finEuTCwOdHEEu2oetlFDFSrOkCvmgHwG+Ho 23t5K5Aol6kVQozdqprke1B4DFUSand7AO4MVcH39+XBtk997v5F2Co5bhuA/cc5LcqL zgkQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o8si2806755pgv.113.2018.01.18.12.22.22; Thu, 18 Jan 2018 12:22:37 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932852AbeARUVw (ORCPT + 99 others); Thu, 18 Jan 2018 15:21:52 -0500 Received: from mx1.mailbox.org ([80.241.60.212]:56990 "EHLO mx1.mailbox.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932384AbeARUVu (ORCPT ); Thu, 18 Jan 2018 15:21:50 -0500 Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.mailbox.org (Postfix) with ESMTPS id F33F142B1B; Thu, 18 Jan 2018 21:21:47 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter01.heinlein-hosting.de (spamfilter01.heinlein-hosting.de [80.241.56.115]) (amavisd-new, port 10030) with ESMTP id 0Z4eYLkVStLH; Thu, 18 Jan 2018 21:21:46 +0100 (CET) From: Christian Brauner To: 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, jbenc@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Christian Brauner Subject: [PATCH net-next 0/1] rtnetlink: request RTM_GETLINK by pid or fd Date: Thu, 18 Jan 2018 21:21:23 +0100 Message-Id: <20180118202124.21616-1-christian.brauner@ubuntu.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hey everyone, This makes it possible to identify the target network namespace of a RTM_GETLINK message by pid or fd. Often userspace tools that make heavy use of network namespaces need a simple and cheap way of querying network devices and network device properties. This becomes even more crucial when the network namespaces in question are transient. In such scenarios setting a netns id property is not really wanted and it is preferable to avoid the hit of (possibly multiple) setns() syscalls (e.g. attaching to the target network namespace and back to the original network namespace.). This commit lets userspace set the IFLA_NET_NS_{FD,PID} property to identify a target network namespace where the device in question is to be queried. I couldn't find any obvious reason why this shouldn't be allowed but I haven't done a deep dive into the possible security implications. So if I missed a very obvious point why this wasn't possible so far, I'm sorry. Christian Christian Brauner (1): rtnetlink: request RTM_GETLINK by pid or fd net/core/rtnetlink.c | 63 +++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 50 insertions(+), 13 deletions(-) -- 2.14.1