Commit 057af707 authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller

net: tipc: have genetlink code to parse the attrs during dumpit

Benefit from the fact that the generic netlink code can parse the attrs
for dumpit op and avoid need to parse it in the op callback.
Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4495af31
...@@ -176,7 +176,8 @@ static const struct genl_ops tipc_genl_v2_ops[] = { ...@@ -176,7 +176,8 @@ static const struct genl_ops tipc_genl_v2_ops[] = {
}, },
{ {
.cmd = TIPC_NL_PUBL_GET, .cmd = TIPC_NL_PUBL_GET,
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, .validate = GENL_DONT_VALIDATE_STRICT |
GENL_DONT_VALIDATE_DUMP_STRICT,
.dumpit = tipc_nl_publ_dump, .dumpit = tipc_nl_publ_dump,
}, },
{ {
...@@ -239,7 +240,8 @@ static const struct genl_ops tipc_genl_v2_ops[] = { ...@@ -239,7 +240,8 @@ static const struct genl_ops tipc_genl_v2_ops[] = {
}, },
{ {
.cmd = TIPC_NL_MON_PEER_GET, .cmd = TIPC_NL_MON_PEER_GET,
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, .validate = GENL_DONT_VALIDATE_STRICT |
GENL_DONT_VALIDATE_DUMP_STRICT,
.dumpit = tipc_nl_node_dump_monitor_peer, .dumpit = tipc_nl_node_dump_monitor_peer,
}, },
{ {
...@@ -250,7 +252,8 @@ static const struct genl_ops tipc_genl_v2_ops[] = { ...@@ -250,7 +252,8 @@ static const struct genl_ops tipc_genl_v2_ops[] = {
#ifdef CONFIG_TIPC_MEDIA_UDP #ifdef CONFIG_TIPC_MEDIA_UDP
{ {
.cmd = TIPC_NL_UDP_GET_REMOTEIP, .cmd = TIPC_NL_UDP_GET_REMOTEIP,
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, .validate = GENL_DONT_VALIDATE_STRICT |
GENL_DONT_VALIDATE_DUMP_STRICT,
.dumpit = tipc_udp_nl_dump_remoteip, .dumpit = tipc_udp_nl_dump_remoteip,
}, },
#endif #endif
......
...@@ -2484,13 +2484,9 @@ int tipc_nl_node_dump_monitor_peer(struct sk_buff *skb, ...@@ -2484,13 +2484,9 @@ int tipc_nl_node_dump_monitor_peer(struct sk_buff *skb,
int err; int err;
if (!prev_node) { if (!prev_node) {
struct nlattr **attrs; struct nlattr **attrs = genl_dumpit_info(cb)->attrs;
struct nlattr *mon[TIPC_NLA_MON_MAX + 1]; struct nlattr *mon[TIPC_NLA_MON_MAX + 1];
err = tipc_nlmsg_parse(cb->nlh, &attrs);
if (err)
return err;
if (!attrs[TIPC_NLA_MON]) if (!attrs[TIPC_NLA_MON])
return -EINVAL; return -EINVAL;
......
...@@ -3588,13 +3588,9 @@ int tipc_nl_publ_dump(struct sk_buff *skb, struct netlink_callback *cb) ...@@ -3588,13 +3588,9 @@ int tipc_nl_publ_dump(struct sk_buff *skb, struct netlink_callback *cb)
struct tipc_sock *tsk; struct tipc_sock *tsk;
if (!tsk_portid) { if (!tsk_portid) {
struct nlattr **attrs; struct nlattr **attrs = genl_dumpit_info(cb)->attrs;
struct nlattr *sock[TIPC_NLA_SOCK_MAX + 1]; struct nlattr *sock[TIPC_NLA_SOCK_MAX + 1];
err = tipc_nlmsg_parse(cb->nlh, &attrs);
if (err)
return err;
if (!attrs[TIPC_NLA_SOCK]) if (!attrs[TIPC_NLA_SOCK])
return -EINVAL; return -EINVAL;
......
...@@ -448,15 +448,11 @@ int tipc_udp_nl_dump_remoteip(struct sk_buff *skb, struct netlink_callback *cb) ...@@ -448,15 +448,11 @@ int tipc_udp_nl_dump_remoteip(struct sk_buff *skb, struct netlink_callback *cb)
int i; int i;
if (!bid && !skip_cnt) { if (!bid && !skip_cnt) {
struct nlattr **attrs = genl_dumpit_info(cb)->attrs;
struct net *net = sock_net(skb->sk); struct net *net = sock_net(skb->sk);
struct nlattr *battrs[TIPC_NLA_BEARER_MAX + 1]; struct nlattr *battrs[TIPC_NLA_BEARER_MAX + 1];
struct nlattr **attrs;
char *bname; char *bname;
err = tipc_nlmsg_parse(cb->nlh, &attrs);
if (err)
return err;
if (!attrs[TIPC_NLA_BEARER]) if (!attrs[TIPC_NLA_BEARER])
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment