summaryrefslogtreecommitdiff
path: root/net/tipc/netlink.c
diff options
context:
space:
mode:
authorRichard Alpe <richard.alpe@ericsson.com>2014-11-20 12:29:11 +0300
committerDavid S. Miller <davem@davemloft.net>2014-11-21 23:01:30 +0300
commit1a1a143daf84db95dd7212086042004a3abb7bc2 (patch)
treeac69d87fa4ab8434bf69f0121a51d83a48cf728d /net/tipc/netlink.c
parent34b78a127c4fd57cf3d5c64031693d10a8e0fae1 (diff)
downloadlinux-1a1a143daf84db95dd7212086042004a3abb7bc2.tar.xz
tipc: add publication dump to new netlink api
Add TIPC_NL_PUBL_GET command to the new tipc netlink API. This command supports dumping of all publications for a specific socket. Netlink logical layout of request message: -> socket -> reference Netlink logical layout of response message: -> publication -> type -> lower -> upper Signed-off-by: Richard Alpe <richard.alpe@ericsson.com> Reviewed-by: Erik Hugne <erik.hugne@ericsson.com> Reviewed-by: Jon Maloy <jon.maloy@ericsson.com> Acked-by: Ying Xue <ying.xue@windriver.com> 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, 17 insertions, 0 deletions
diff --git a/net/tipc/netlink.c b/net/tipc/netlink.c
index 951fabeec8b7..9bc64aaff466 100644
--- a/net/tipc/netlink.c
+++ b/net/tipc/netlink.c
@@ -74,6 +74,7 @@ static const struct nla_policy tipc_nl_policy[TIPC_NLA_MAX + 1] = {
[TIPC_NLA_UNSPEC] = { .type = NLA_UNSPEC, },
[TIPC_NLA_BEARER] = { .type = NLA_NESTED, },
[TIPC_NLA_SOCK] = { .type = NLA_NESTED, },
+ [TIPC_NLA_PUBL] = { .type = NLA_NESTED, }
};
/* Legacy ASCII API */
@@ -130,9 +131,25 @@ static const struct genl_ops tipc_genl_v2_ops[] = {
.cmd = TIPC_NL_SOCK_GET,
.dumpit = tipc_nl_sk_dump,
.policy = tipc_nl_policy,
+ },
+ {
+ .cmd = TIPC_NL_PUBL_GET,
+ .dumpit = tipc_nl_publ_dump,
+ .policy = tipc_nl_policy,
}
};
+int tipc_nlmsg_parse(const struct nlmsghdr *nlh, struct nlattr ***attr)
+{
+ u32 maxattr = tipc_genl_v2_family.maxattr;
+
+ *attr = tipc_genl_v2_family.attrbuf;
+ if (!*attr)
+ return -EOPNOTSUPP;
+
+ return nlmsg_parse(nlh, GENL_HDRLEN, *attr, maxattr, tipc_nl_policy);
+}
+
int tipc_netlink_start(void)
{
int res;