aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/netlink.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2015-01-12 16:24:39 -0500
committerDavid S. Miller <davem@davemloft.net>2015-01-12 16:24:39 -0500
commitd9fbfb94d07ff8feb1741c31a1dd80d4850b44cb (patch)
tree2c6016a7125322f3ce57402144ce7dc2c8e75c17 /net/tipc/netlink.c
parentMerge branch 'cxgb4-next' (diff)
parenttipc: make netlink support net namespace (diff)
downloadlinux-dev-d9fbfb94d07ff8feb1741c31a1dd80d4850b44cb.tar.xz
linux-dev-d9fbfb94d07ff8feb1741c31a1dd80d4850b44cb.zip
Merge branch 'tipc-namespaces'
Ying Xue says: ==================== tipc: make tipc support namespace This patchset aims to add net namespace support for TIPC stack. Currently TIPC module declares the following global resources: - TIPC network idenfication number - TIPC node table - TIPC bearer list table - TIPC broadcast link - TIPC socket reference table - TIPC name service table - TIPC node address - TIPC service subscriber server - TIPC random value - TIPC netlink In order that TIPC is aware of namespace, above each resource must be allocated, initialized and destroyed inside per namespace. Therefore, the major works of this patchset are to isolate these global resources and make them private for each namespace. However, before these changes come true, some necessary preparation works must be first done: convert socket reference table with generic rhashtable, cleanup core.c and core.h files, remove unnecessary wrapper functions for kernel timer interfaces and so on. It should be noted that commit ##1 ("tipc: fix bug in broadcast retransmit code") was already submitted to 'net' tree, so please see below link: http://patchwork.ozlabs.org/patch/426717/ Since it is prerequisite for the rest of the series to apply, I prepend them to the series. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/netlink.c')
-rw-r--r--net/tipc/netlink.c17
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 @@
static int handle_cmd(struct sk_buff *skb, struct genl_info *info)
{
+ struct net *net = genl_info_net(info);
struct sk_buff *rep_buf;
struct nlmsghdr *rep_nlh;
struct nlmsghdr *req_nlh = info->nlhdr;
@@ -53,22 +54,24 @@ static int handle_cmd(struct sk_buff *skb, struct genl_info *info)
int hdr_space = nlmsg_total_size(GENL_HDRLEN + TIPC_GENL_HDRLEN);
u16 cmd;
- if ((req_userhdr->cmd & 0xC000) && (!netlink_capable(skb, CAP_NET_ADMIN)))
+ if ((req_userhdr->cmd & 0xC000) &&
+ (!netlink_net_capable(skb, CAP_NET_ADMIN)))
cmd = TIPC_CMD_NOT_NET_ADMIN;
else
cmd = req_userhdr->cmd;
- rep_buf = tipc_cfg_do_cmd(req_userhdr->dest, cmd,
- nlmsg_data(req_nlh) + GENL_HDRLEN + TIPC_GENL_HDRLEN,
- nlmsg_attrlen(req_nlh, GENL_HDRLEN + TIPC_GENL_HDRLEN),
- hdr_space);
+ rep_buf = tipc_cfg_do_cmd(net, req_userhdr->dest, cmd,
+ nlmsg_data(req_nlh) + GENL_HDRLEN +
+ TIPC_GENL_HDRLEN,
+ nlmsg_attrlen(req_nlh, GENL_HDRLEN +
+ TIPC_GENL_HDRLEN), hdr_space);
if (rep_buf) {
skb_push(rep_buf, hdr_space);
rep_nlh = nlmsg_hdr(rep_buf);
memcpy(rep_nlh, req_nlh, hdr_space);
rep_nlh->nlmsg_len = rep_buf->len;
- genlmsg_unicast(&init_net, rep_buf, NETLINK_CB(skb).portid);
+ genlmsg_unicast(net, rep_buf, NETLINK_CB(skb).portid);
}
return 0;
@@ -93,6 +96,7 @@ static struct genl_family tipc_genl_family = {
.version = TIPC_GENL_VERSION,
.hdrsize = TIPC_GENL_HDRLEN,
.maxattr = 0,
+ .netnsok = true,
};
/* Legacy ASCII API */
@@ -112,6 +116,7 @@ struct genl_family tipc_genl_v2_family = {
.version = TIPC_GENL_V2_VERSION,
.hdrsize = 0,
.maxattr = TIPC_NLA_MAX,
+ .netnsok = true,
};
static const struct genl_ops tipc_genl_v2_ops[] = {