Received: by 10.223.176.46 with SMTP id f43csp645211wra; Wed, 24 Jan 2018 03:54:53 -0800 (PST) X-Google-Smtp-Source: AH8x226jXRdVKnDYb+6AMrGytGJxkgICt3YDP4jbFvXhISJZdw1wfbzYQA314mnAQpWKzLwaXkb2 X-Received: by 2002:a17:902:3225:: with SMTP id y34-v6mr7838757plb.399.1516794893851; Wed, 24 Jan 2018 03:54:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516794893; cv=none; d=google.com; s=arc-20160816; b=k4eKKnKBYFu2+51knhN1xZKRPkxiGvy/fbZko7d7RydBiqfbasKxk7lC3OF9bGWFxu T/Eah+sGFoPVx12PpqITNMnrN0HdH1UDw4hy4JOBk3yogMtcUUq5rZpu65PGB4X7S89Q mOZOFsEb1eSKbMhD3gmADOc5NTZPaipmesSEc3E/R3e0L6wkHRBW3A9rLiqm+owpcWE7 vzHsXt2/r4h0Rm0w5WlxdMso+OBPMXX9liAJ0tFNhhIZWghnkkxhdmRMZoRxjE4EVp1n RhXxkp2TlTqhzPiR1FTkAjwQ/ETn4W27WZahImDw3LNd1dE4f3dWuvrn9dy9XTRQj0sD jf4g== 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=L8v+MMgQHo/Bh5+10ynqCwiwEd/5gMeeehudp4dc0F0H45/81a6faykAvdMC+IhTtR HEKTjTp5xcJfu3mae9m3jjVAMLS6fOPeSRTC88HTKA8+OAuhiXfGSpkkjhqK0t4A+KF/ t/RMKzufWVW5La1CDhvFfPCgLXTdoaDnOAoQbdOMSgmTLyMlJTBjoW3Knu1Ymu9ZqT5a YCgbW/fgsjwZpLo1CVuwP29TlI+i8xpvzfxc1X6tq5OM3CDxPTBK9rw1/DUxRVnok7gW ZBTeL/98WLC9sN1IG9y79qLJZ/vCdPFyvEaF5VY4Tx7t6F8u2tSYszZJOq2sKBZlncQ9 zOKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uSGCDgnh; 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 m10si43269pge.338.2018.01.24.03.54.40; Wed, 24 Jan 2018 03:54:53 -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=uSGCDgnh; 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 S933782AbeAXLxI (ORCPT + 99 others); Wed, 24 Jan 2018 06:53:08 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:42520 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933308AbeAXLxE (ORCPT ); Wed, 24 Jan 2018 06:53:04 -0500 Received: by mail-wm0-f68.google.com with SMTP id r71so8021384wmd.1; Wed, 24 Jan 2018 03:53:04 -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=uSGCDgnhoUEwOvHqGU+Rip+FcWkZgnRFLobhWs2s+jluzJHg35ne2/aNZj4K0BYN4y pDCFJiBmMDcQdPM9voQhruXwFggaZCDaj6yc13lV0xEM13TcWzTK0c0dG7f7+yof0gsA tl14HA36Fgcf+G2ja+CZXKJogz5sVh7x3DKlRRaWal32osp+Im6zFpX2/hMq1S5OBxkQ mmv/B8Fb72AlF2agITvsKMiHoH8USINwu3J+lo5OgFpYPhuKPcw8g1+kD6m1QQsBqLBK 2By64/ioHj/welRb+2rS1EJ0E9U91zHd2EYMMGgReCp8eW6wQaQSx64W4U1iHD7fJW7k J2/g== 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=L6N3H4UgfwujKJj6jciGnEDuvhcPwzJxBZEIRP9MNANdlYt9HAIacZuPyjVRRNgrpC x8pL7iQyOq3cEOiq1WcmoekAeMfS+CfGhD3+9k+lHxBbwRd5KqqbaDERoQUsSkXIq2GF ymb6DFaWAWYOb5aec5bvjDM46q0VPkip+giCvykesOO76TfP9wVPwUkvrJPPeJpn+dDm mNhVOtbETYxLZU3BZfpN/qTX86wHq5CSaDNWwAenfM1FHtsGtx/yHTFQQly42kUW0FDx H++OFAuPPw1hvGEhR1S3CJVncRnpOfejh2/6DVJA1RzEFAmQn4qi1t6URxpR7ZIFqnCG yJjQ== X-Gm-Message-State: AKwxytd80C3mzE/8GGlBm4jQArLXsVc9vAJNWUeSLmVuUH/l47rukW7W rdjnUYuOcM7b9m1l7FQntXoxQyFUMAo= X-Received: by 10.28.179.9 with SMTP id c9mr4056551wmf.99.1516794783242; Wed, 24 Jan 2018 03:53:03 -0800 (PST) Received: from localhost.localdomain (eap108107.extern.uni-tuebingen.de. [134.2.108.107]) by smtp.gmail.com with ESMTPSA id y23sm3044597wrc.24.2018.01.24.03.53.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Jan 2018 03:53:02 -0800 (PST) From: Christian Brauner X-Google-Original-From: Christian Brauner To: netdev@vger.kernel.org Cc: 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] rtnetlink: enable IFLA_IF_NETNSID for RTM_SETLINK Date: Wed, 24 Jan 2018 12:52:50 +0100 Message-Id: <20180124115250.5635-1-christian.brauner@ubuntu.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180123132233.6d77040b@redhat.com> References: <20180123132233.6d77040b@redhat.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