diff options
author | Richard Alpe <richard.alpe@ericsson.com> | 2015-02-09 09:50:16 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-02-09 13:20:49 -0800 |
commit | 3c26181c5b1b0b49e147bac8a8d012234f813a5e (patch) | |
tree | 5a4d880521fb884f811619c069db60df04e849ea /net/tipc/netlink_compat.c | |
parent | 964f9501c1910c0835eee3cf870ba5aa44db1241 (diff) | |
download | linux-stable-3c26181c5b1b0b49e147bac8a8d012234f813a5e.tar.gz linux-stable-3c26181c5b1b0b49e147bac8a8d012234f813a5e.tar.bz2 linux-stable-3c26181c5b1b0b49e147bac8a8d012234f813a5e.zip |
tipc: convert legacy nl net id get to nl compat
Convert TIPC_CMD_GET_NETID to compat dumpit.
Signed-off-by: Richard Alpe <richard.alpe@ericsson.com>
Reviewed-by: Erik Hugne <erik.hugne@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Reviewed-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/netlink_compat.c')
-rw-r--r-- | net/tipc/netlink_compat.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/net/tipc/netlink_compat.c b/net/tipc/netlink_compat.c index c355476a6e7c..415909054ec0 100644 --- a/net/tipc/netlink_compat.c +++ b/net/tipc/netlink_compat.c @@ -876,6 +876,18 @@ static int tipc_nl_compat_net_set(struct sk_buff *skb, return 0; } +static int tipc_nl_compat_net_dump(struct tipc_nl_compat_msg *msg, + struct nlattr **attrs) +{ + __be32 id; + struct nlattr *net[TIPC_NLA_NET_MAX + 1]; + + nla_parse_nested(net, TIPC_NLA_NET_MAX, attrs[TIPC_NLA_NET], NULL); + id = htonl(nla_get_u32(net[TIPC_NLA_NET_ID])); + + return tipc_add_tlv(msg->rep, TIPC_TLV_UNSIGNED, &id, sizeof(id)); +} + static int tipc_nl_compat_handle(struct tipc_nl_compat_msg *msg) { struct tipc_nl_compat_cmd_dump dump; @@ -959,6 +971,11 @@ static int tipc_nl_compat_handle(struct tipc_nl_compat_msg *msg) doit.doit = tipc_nl_net_set; doit.transcode = tipc_nl_compat_net_set; return tipc_nl_compat_doit(&doit, msg); + case TIPC_CMD_GET_NETID: + msg->rep_size = sizeof(u32); + dump.dumpit = tipc_nl_net_dump; + dump.format = tipc_nl_compat_net_dump; + return tipc_nl_compat_dumpit(&dump, msg); } return -EOPNOTSUPP; @@ -1070,6 +1087,7 @@ static int tipc_nl_compat_tmp_wrap(struct sk_buff *skb, struct genl_info *info) case TIPC_CMD_GET_NODES: case TIPC_CMD_SET_NODE_ADDR: case TIPC_CMD_SET_NETID: + case TIPC_CMD_GET_NETID: return tipc_nl_compat_recv(skb, info); } |