From: Christian Brauner <christian.brauner@ubuntu.com>
To: netdev@vger.kernel.org
Cc: ebiederm@xmission.com, 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 <christian.brauner@ubuntu.com>
Subject: [PATCH net-next 1/1] rtnetlink: enable IFLA_IF_NETNSID for RTM_NEWLINK
Date: Mon, 29 Jan 2018 18:07:20 +0100 [thread overview]
Message-ID: <20180129170720.29724-2-christian.brauner@ubuntu.com> (raw)
In-Reply-To: <20180129170720.29724-1-christian.brauner@ubuntu.com>
- Backwards Compatibility:
If userspace wants to determine whether RTM_NEWLINK 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_NEWLINK with a IFLA_IF_NETNSID property. If they receive
EOPNOTSUPP then the kernel does not support the IFLA_IF_NETNSID property
with RTM_NEWLINK. Userpace should then fallback to other means.
- Security:
Callers must have CAP_NET_ADMIN in the owning user namespace of the
target network namespace.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
---
net/core/rtnetlink.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index f111557958bb..889b34f78a44 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -2954,14 +2954,10 @@ static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh,
name_assign_type = NET_NAME_ENUM;
}
- dest_net = rtnl_link_get_net(net, tb);
+ dest_net = rtnl_link_get_net_capable(skb, net, tb, CAP_NET_ADMIN);
if (IS_ERR(dest_net))
return PTR_ERR(dest_net);
- err = -EPERM;
- if (!netlink_ns_capable(skb, dest_net->user_ns, CAP_NET_ADMIN))
- goto out;
-
if (tb[IFLA_LINK_NETNSID]) {
int id = nla_get_s32(tb[IFLA_LINK_NETNSID]);
--
2.14.1
next prev parent reply other threads:[~2018-01-29 17:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-29 17:07 [PATCH net-next 0/1] " Christian Brauner
2018-01-29 17:07 ` Christian Brauner [this message]
2018-01-30 15:49 ` [PATCH net-next 1/1] " kbuild test robot
2018-01-30 16:13 ` kbuild test robot
2018-01-30 16:26 ` Christian Brauner
2018-01-31 15:30 ` David Miller
2018-01-31 16:20 ` Christian Brauner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180129170720.29724-2-christian.brauner@ubuntu.com \
--to=christian.brauner@ubuntu.com \
--cc=daniel@iogearbox.net \
--cc=dsahern@gmail.com \
--cc=ebiederm@xmission.com \
--cc=fw@strlen.de \
--cc=jakub.kicinski@netronome.com \
--cc=jbenc@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lucien.xin@gmail.com \
--cc=mschiffer@universe-factory.net \
--cc=netdev@vger.kernel.org \
--cc=nicolas.dichtel@6wind.com \
--cc=vyasevich@gmail.com \
--cc=w.bumiller@proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®