Skip to content

Commit 7c77ab2

Browse files
jrfastabdavem330
authored andcommitted
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>
1 parent 7b9e758 commit 7c77ab2

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

‎net/dcb/dcbnl.c‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1665,9 +1665,6 @@ static int dcb_doit(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
16651665
if ((nlh->nlmsg_type == RTM_SETDCB) && !capable(CAP_NET_ADMIN))
16661666
return -EPERM;
16671667

1668-
if (!net_eq(net, &init_net))
1669-
return -EINVAL;
1670-
16711668
ret = nlmsg_parse(nlh, sizeof(*dcb), tb, DCB_ATTR_MAX,
16721669
dcbnl_rtnl_policy);
16731670
if (ret < 0)
@@ -1684,7 +1681,7 @@ static int dcb_doit(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
16841681
if (!tb[DCB_ATTR_IFNAME])
16851682
return -EINVAL;
16861683

1687-
netdev = dev_get_by_name(&init_net, nla_data(tb[DCB_ATTR_IFNAME]));
1684+
netdev = dev_get_by_name(net, nla_data(tb[DCB_ATTR_IFNAME]));
16881685
if (!netdev)
16891686
return -ENODEV;
16901687

@@ -1708,7 +1705,7 @@ static int dcb_doit(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
17081705

17091706
nlmsg_end(reply_skb, reply_nlh);
17101707

1711-
ret = rtnl_unicast(reply_skb, &init_net, portid);
1708+
ret = rtnl_unicast(reply_skb, net, portid);
17121709
out:
17131710
dev_put(netdev);
17141711
return ret;

0 commit comments

Comments
 (0)