diff options
Diffstat (limited to 'net/tipc/netlink.c')
| -rw-r--r-- | net/tipc/netlink.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/net/tipc/netlink.c b/net/tipc/netlink.c index b891e3905bc4..fe0f5134ce15 100644 --- a/net/tipc/netlink.c +++ b/net/tipc/netlink.c | |||
| @@ -46,6 +46,7 @@ | |||
| 46 | 46 | ||
| 47 | static int handle_cmd(struct sk_buff *skb, struct genl_info *info) | 47 | static int handle_cmd(struct sk_buff *skb, struct genl_info *info) |
| 48 | { | 48 | { |
| 49 | struct net *net = genl_info_net(info); | ||
| 49 | struct sk_buff *rep_buf; | 50 | struct sk_buff *rep_buf; |
| 50 | struct nlmsghdr *rep_nlh; | 51 | struct nlmsghdr *rep_nlh; |
| 51 | struct nlmsghdr *req_nlh = info->nlhdr; | 52 | struct nlmsghdr *req_nlh = info->nlhdr; |
| @@ -53,22 +54,24 @@ static int handle_cmd(struct sk_buff *skb, struct genl_info *info) | |||
| 53 | int hdr_space = nlmsg_total_size(GENL_HDRLEN + TIPC_GENL_HDRLEN); | 54 | int hdr_space = nlmsg_total_size(GENL_HDRLEN + TIPC_GENL_HDRLEN); |
| 54 | u16 cmd; | 55 | u16 cmd; |
| 55 | 56 | ||
| 56 | if ((req_userhdr->cmd & 0xC000) && (!netlink_capable(skb, CAP_NET_ADMIN))) | 57 | if ((req_userhdr->cmd & 0xC000) && |
| 58 | (!netlink_net_capable(skb, CAP_NET_ADMIN))) | ||
| 57 | cmd = TIPC_CMD_NOT_NET_ADMIN; | 59 | cmd = TIPC_CMD_NOT_NET_ADMIN; |
| 58 | else | 60 | else |
| 59 | cmd = req_userhdr->cmd; | 61 | cmd = req_userhdr->cmd; |
| 60 | 62 | ||
| 61 | rep_buf = tipc_cfg_do_cmd(req_userhdr->dest, cmd, | 63 | rep_buf = tipc_cfg_do_cmd(net, req_userhdr->dest, cmd, |
| 62 | nlmsg_data(req_nlh) + GENL_HDRLEN + TIPC_GENL_HDRLEN, | 64 | nlmsg_data(req_nlh) + GENL_HDRLEN + |
| 63 | nlmsg_attrlen(req_nlh, GENL_HDRLEN + TIPC_GENL_HDRLEN), | 65 | TIPC_GENL_HDRLEN, |
| 64 | hdr_space); | 66 | nlmsg_attrlen(req_nlh, GENL_HDRLEN + |
| 67 | TIPC_GENL_HDRLEN), hdr_space); | ||
| 65 | 68 | ||
| 66 | if (rep_buf) { | 69 | if (rep_buf) { |
| 67 | skb_push(rep_buf, hdr_space); | 70 | skb_push(rep_buf, hdr_space); |
| 68 | rep_nlh = nlmsg_hdr(rep_buf); | 71 | rep_nlh = nlmsg_hdr(rep_buf); |
| 69 | memcpy(rep_nlh, req_nlh, hdr_space); | 72 | memcpy(rep_nlh, req_nlh, hdr_space); |
| 70 | rep_nlh->nlmsg_len = rep_buf->len; | 73 | rep_nlh->nlmsg_len = rep_buf->len; |
| 71 | genlmsg_unicast(&init_net, rep_buf, NETLINK_CB(skb).portid); | 74 | genlmsg_unicast(net, rep_buf, NETLINK_CB(skb).portid); |
| 72 | } | 75 | } |
| 73 | 76 | ||
| 74 | return 0; | 77 | return 0; |
| @@ -93,6 +96,7 @@ static struct genl_family tipc_genl_family = { | |||
| 93 | .version = TIPC_GENL_VERSION, | 96 | .version = TIPC_GENL_VERSION, |
| 94 | .hdrsize = TIPC_GENL_HDRLEN, | 97 | .hdrsize = TIPC_GENL_HDRLEN, |
| 95 | .maxattr = 0, | 98 | .maxattr = 0, |
| 99 | .netnsok = true, | ||
| 96 | }; | 100 | }; |
| 97 | 101 | ||
| 98 | /* Legacy ASCII API */ | 102 | /* Legacy ASCII API */ |
| @@ -112,6 +116,7 @@ struct genl_family tipc_genl_v2_family = { | |||
| 112 | .version = TIPC_GENL_V2_VERSION, | 116 | .version = TIPC_GENL_V2_VERSION, |
| 113 | .hdrsize = 0, | 117 | .hdrsize = 0, |
| 114 | .maxattr = TIPC_NLA_MAX, | 118 | .maxattr = TIPC_NLA_MAX, |
| 119 | .netnsok = true, | ||
| 115 | }; | 120 | }; |
| 116 | 121 | ||
| 117 | static const struct genl_ops tipc_genl_v2_ops[] = { | 122 | static const struct genl_ops tipc_genl_v2_ops[] = { |
