Эх сурвалжийг харах

net: Allow DCBnl to use other namespaces besides init_net

Allow DCB and net namespace to work together. This is useful if you
have containers that are bound to 'phys' interfaces that want to
also manage their DCB attributes.

The net namespace is taken from sock_net(skb->sk) of the netlink skb.

CC: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
John Fastabend 13 жил өмнө
parent
commit
7c77ab24e3
1 өөрчлөгдсөн 2 нэмэгдсэн , 5 устгасан
  1. 2 5
      net/dcb/dcbnl.c

+ 2 - 5
net/dcb/dcbnl.c

@@ -1665,9 +1665,6 @@ static int dcb_doit(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
 	if ((nlh->nlmsg_type == RTM_SETDCB) && !capable(CAP_NET_ADMIN))
 	if ((nlh->nlmsg_type == RTM_SETDCB) && !capable(CAP_NET_ADMIN))
 		return -EPERM;
 		return -EPERM;
 
 
-	if (!net_eq(net, &init_net))
-		return -EINVAL;
-
 	ret = nlmsg_parse(nlh, sizeof(*dcb), tb, DCB_ATTR_MAX,
 	ret = nlmsg_parse(nlh, sizeof(*dcb), tb, DCB_ATTR_MAX,
 			  dcbnl_rtnl_policy);
 			  dcbnl_rtnl_policy);
 	if (ret < 0)
 	if (ret < 0)
@@ -1684,7 +1681,7 @@ static int dcb_doit(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
 	if (!tb[DCB_ATTR_IFNAME])
 	if (!tb[DCB_ATTR_IFNAME])
 		return -EINVAL;
 		return -EINVAL;
 
 
-	netdev = dev_get_by_name(&init_net, nla_data(tb[DCB_ATTR_IFNAME]));
+	netdev = dev_get_by_name(net, nla_data(tb[DCB_ATTR_IFNAME]));
 	if (!netdev)
 	if (!netdev)
 		return -ENODEV;
 		return -ENODEV;
 
 
@@ -1708,7 +1705,7 @@ static int dcb_doit(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
 
 
 	nlmsg_end(reply_skb, reply_nlh);
 	nlmsg_end(reply_skb, reply_nlh);
 
 
-	ret = rtnl_unicast(reply_skb, &init_net, portid);
+	ret = rtnl_unicast(reply_skb, net, portid);
 out:
 out:
 	dev_put(netdev);
 	dev_put(netdev);
 	return ret;
 	return ret;