Received: by 10.223.176.46 with SMTP id f43csp820150wra; Wed, 24 Jan 2018 06:28:50 -0800 (PST) X-Google-Smtp-Source: AH8x226Oj1qG+AODXifPb0DdqdcK3880Lqkv9oX6UswrMSJzsFc0tLlncv7Os4pdQPTCzDdkRyn+ X-Received: by 2002:a17:902:9895:: with SMTP id s21-v6mr8270992plp.297.1516804129998; Wed, 24 Jan 2018 06:28:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516804129; cv=none; d=google.com; s=arc-20160816; b=iuwgC6Im0D2jUvumNuZDHBoNzp7naNEHSEx2p1jD/DAKyhM+v6rMsF/Oy7o+eTvzo4 lBFiA4qfe5xv7iPT6tQGhFpev5YfSnGCkGQoqX6g70pqZNrz9AyQJjtGLCLDJuwRC1b2 RruD/IoHOlOrNMjdiq3tKbBzpz+/1fW+/CGCJXsrKFSkl1NljQOij1RY/NYlo+ZXxApp G+ErS8vu7toenBcMGB/Qne3PmXkUO1kOl3zmjx1I49zteuIRXcchJ2PfwHiMVDp63SHg +bDnn8oGbV0EoPud2mYjWvlTlTlZya8/0XmspVGzFU8fJ7cjrZ/p4q6b56chAQpB9GYS oYJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=HE4ld6KWGCwbmbk6QGEYzaTdNr4uQ8XLtHpFMGiCRY0=; b=scZlgq8K3iHVNybob1xvD13bqhP0xD+oACw5OFA39dtH20eu+pvwhl/cqMXqUO7rCj YIf7ka1qI8+MpxmBtQTv2QFcrkb1mS73YF9wFLrWjyyMyJhmgTqDkMLGYAdIgpHDIFFi wO/8YnfAg1KwBgyP+LQ6JNdrGj/LuxFx9oZ6kMSymHOEIC3xnGRQ0nCYeANpksu9U3tz zjkUdrgzGaeqcpmVwz0ITCZ/qkvY7GMEuAeb+N5FectjuR73AYhD7YwbBUIeuZE6N1ly nLi8pn2WJIFKN6DK96zR5gQ7YKhImAJb5hYuFQ8L3rmAdDj/eRl00GUS9dYr18CtNMv/ fU3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RkFe4a5V; 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=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c14si202217pgu.645.2018.01.24.06.28.35; Wed, 24 Jan 2018 06:28:49 -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=@gmail.com header.s=20161025 header.b=RkFe4a5V; 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=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934081AbeAXO1T (ORCPT + 99 others); Wed, 24 Jan 2018 09:27:19 -0500 Received: from mail-wr0-f193.google.com ([209.85.128.193]:42046 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933993AbeAXO0u (ORCPT ); Wed, 24 Jan 2018 09:26:50 -0500 Received: by mail-wr0-f193.google.com with SMTP id e41so4223435wre.9; Wed, 24 Jan 2018 06:26:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=HE4ld6KWGCwbmbk6QGEYzaTdNr4uQ8XLtHpFMGiCRY0=; b=RkFe4a5V3U8fpCjYwXMxZ+3YrxLssPsW6elW4H1tW5cOK5TovTb4aJR9lnjWr681FI PZZ4fkRgc80tlEoSCELJkW8fpmSisb4UCH4rit5QfXwdP5+IlyrhvRO38c3fQBjGGQv8 qOBDJmo7gwv4syeOw1Rn4IZ4fKukPRFxJEzK+py6nFzW3lo3+/nCVABzvtCk1xXVu4BX 6kMBc7n6ZMorQRAOvAtqVeT9ntqVUcOfoMvrhQCSpkJ4jw/g2aAz3Uf8zbdU262pMFVg prB5GAOKi7Bx5XPcol0uVPlqveWGym47J51n3rTDEQD5Glvvu7aJGAQWea169mdNTEqf JdKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=HE4ld6KWGCwbmbk6QGEYzaTdNr4uQ8XLtHpFMGiCRY0=; b=efaBBo2HldyGc4/E6Daiwj1JvP/AXkOn7kvH44JbBuAavGkojxZiJv1zOzrAc1Oyrr LrWc6Hg1XOXVusWl7wEWZi9QJmeojoYKs3rEyTQy29EfzV5R65cxJyyFCoILdaP5YYcA 4LkITChqZQ5MtGTm22/1/2F/JOq1Jn9zXBGdHAg7s8nnU18XP4MpJMmd6TYj+d1SODOF brKF1mTYrSVDQOJvCv+nAxdUQFTl79dnZ0OP5LxQAhdo0sO+4naqVS3DJfDKxtXnofaO 0AThLHbsNKM36iBOI9ZCm4DCozLNSJ/+qCUawQl8nkedysromC0W8A5nEIDYQ7jC09jU EhHw== X-Gm-Message-State: AKwxytcoQaTUzsdAmIW7WXkHV2IrKCRkf3Qpc/CkFBUEaKXSlKh5sZQk AfSE4wXzBzkcZHOtD/4nDq7w1jbSTIo= X-Received: by 10.223.185.42 with SMTP id k39mr5259536wrf.245.1516804008793; Wed, 24 Jan 2018 06:26:48 -0800 (PST) Received: from localhost.localdomain (eap108107.extern.uni-tuebingen.de. [134.2.108.107]) by smtp.gmail.com with ESMTPSA id q48sm3992178wrb.31.2018.01.24.06.26.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Jan 2018 06:26:48 -0800 (PST) From: Christian Brauner X-Google-Original-From: Christian Brauner To: netdev@vger.kernel.org Cc: 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, jbenc@redhat.com, w.bumiller@proxmox.com, nicolas.dichtel@6wind.com, Christian Brauner Subject: [PATCH net-next 2/3 V1] rtnetlink: enable IFLA_IF_NETNSID for RTM_SETLINK Date: Wed, 24 Jan 2018 15:26:33 +0100 Message-Id: <20180124142634.17766-3-christian.brauner@ubuntu.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180124142634.17766-1-christian.brauner@ubuntu.com> References: <20180124142634.17766-1-christian.brauner@ubuntu.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org - Backwards Compatibility: If userspace wants to determine whether RTM_SETLINK supports the IFLA_IF_NETNSID property they should first send an RTM_GETLINK request with IFLA_IF_NETNSID on lo. If either EACCESS is returned or the reply does not include IFLA_IF_NETNSID userspace should assume that IFLA_IF_NETNSID is not supported on this kernel. If the reply does contain an IFLA_IF_NETNSID property userspace can send an RTM_SETLINK with a IFLA_IF_NETNSID property. If they receive EOPNOTSUPP then the kernel does not support the IFLA_IF_NETNSID property with RTM_SETLINK. Userpace should then fallback to other means. To retain backwards compatibility the kernel will first check whether a IFLA_NET_NS_PID or IFLA_NET_NS_FD property has been passed. If either one is found it will be used to identify the target network namespace. This implies that users who do not care whether their running kernel supports IFLA_IF_NETNSID with RTM_SETLINK can pass both IFLA_NET_NS_{FD,PID} and IFLA_IF_NETNSID referring to the same network namespace. - Security: Callers must have CAP_NET_ADMIN in the owning user namespace of the target network namespace. Signed-off-by: Christian Brauner --- net/core/rtnetlink.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 54134187485b..a4d4409685e3 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -2546,9 +2546,6 @@ static int rtnl_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, if (err < 0) goto errout; - if (tb[IFLA_IF_NETNSID]) - return -EOPNOTSUPP; - if (tb[IFLA_IFNAME]) nla_strlcpy(ifname, tb[IFLA_IFNAME], IFNAMSIZ); else -- 2.14.1