mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-29 22:02:02 +00:00
net: Allow tc changes in user namespaces
This switches a few remaining capable(CAP_NET_ADMIN) to ns_capable so that root in a user namespace may set tc rules inside that namespace. Signed-off-by: Stéphane Graber <stgraber@ubuntu.com> Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Jamal Hadi Salim <jhs@mojatatu.com> Cc: "David S. Miller" <davem@davemloft.net> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
3c4de5a0a3
commit
4e8bbb819d
2 changed files with 7 additions and 4 deletions
|
@ -134,7 +134,8 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n)
|
||||||
int err;
|
int err;
|
||||||
int tp_created = 0;
|
int tp_created = 0;
|
||||||
|
|
||||||
if ((n->nlmsg_type != RTM_GETTFILTER) && !capable(CAP_NET_ADMIN))
|
if ((n->nlmsg_type != RTM_GETTFILTER) &&
|
||||||
|
!ns_capable(net->user_ns, CAP_NET_ADMIN))
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
|
|
||||||
replay:
|
replay:
|
||||||
|
|
|
@ -1084,7 +1084,8 @@ static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n)
|
||||||
struct Qdisc *p = NULL;
|
struct Qdisc *p = NULL;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if ((n->nlmsg_type != RTM_GETQDISC) && !capable(CAP_NET_ADMIN))
|
if ((n->nlmsg_type != RTM_GETQDISC) &&
|
||||||
|
!ns_capable(net->user_ns, CAP_NET_ADMIN))
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
|
|
||||||
err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, NULL);
|
err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, NULL);
|
||||||
|
@ -1151,7 +1152,7 @@ static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n)
|
||||||
struct Qdisc *q, *p;
|
struct Qdisc *q, *p;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (!capable(CAP_NET_ADMIN))
|
if (!ns_capable(net->user_ns, CAP_NET_ADMIN))
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
|
|
||||||
replay:
|
replay:
|
||||||
|
@ -1490,7 +1491,8 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n)
|
||||||
u32 qid;
|
u32 qid;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if ((n->nlmsg_type != RTM_GETTCLASS) && !capable(CAP_NET_ADMIN))
|
if ((n->nlmsg_type != RTM_GETTCLASS) &&
|
||||||
|
!ns_capable(net->user_ns, CAP_NET_ADMIN))
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
|
|
||||||
err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, NULL);
|
err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, NULL);
|
||||||
|
|
Loading…
Reference in a new issue