diff options
author | Richard Alpe <richard.alpe@ericsson.com> | 2015-02-09 03:50:07 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-02-09 16:20:48 -0500 |
commit | 357ebdbfca0baa9a8d8d85307393e9ec3406affc (patch) | |
tree | e12b5c96459aad150b2e66a417634d39be0a14cd /net/tipc/netlink_compat.c | |
parent | f2b3b2d4ccbf9666f5f42a21347cd1aaa532b2fa (diff) |
tipc: convert legacy nl link dump to nl compat
Convert TIPC_CMD_GET_LINKS to compat dumpit and remove global link
counter solely used by the legacy API.
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 | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/net/tipc/netlink_compat.c b/net/tipc/netlink_compat.c index 899bd94da467..bff9403899ed 100644 --- a/net/tipc/netlink_compat.c +++ b/net/tipc/netlink_compat.c | |||
@@ -553,6 +553,22 @@ static int tipc_nl_compat_link_stat_dump(struct tipc_nl_compat_msg *msg, | |||
553 | return 0; | 553 | return 0; |
554 | } | 554 | } |
555 | 555 | ||
556 | static int tipc_nl_compat_link_dump(struct tipc_nl_compat_msg *msg, | ||
557 | struct nlattr **attrs) | ||
558 | { | ||
559 | struct nlattr *link[TIPC_NLA_LINK_MAX + 1]; | ||
560 | struct tipc_link_info link_info; | ||
561 | |||
562 | nla_parse_nested(link, TIPC_NLA_LINK_MAX, attrs[TIPC_NLA_LINK], NULL); | ||
563 | |||
564 | link_info.dest = nla_get_flag(link[TIPC_NLA_LINK_DEST]); | ||
565 | link_info.up = htonl(nla_get_flag(link[TIPC_NLA_LINK_UP])); | ||
566 | strcpy(link_info.str, nla_data(link[TIPC_NLA_LINK_NAME])); | ||
567 | |||
568 | return tipc_add_tlv(msg->rep, TIPC_TLV_LINK_INFO, | ||
569 | &link_info, sizeof(link_info)); | ||
570 | } | ||
571 | |||
556 | static int tipc_nl_compat_handle(struct tipc_nl_compat_msg *msg) | 572 | static int tipc_nl_compat_handle(struct tipc_nl_compat_msg *msg) |
557 | { | 573 | { |
558 | struct tipc_nl_compat_cmd_dump dump; | 574 | struct tipc_nl_compat_cmd_dump dump; |
@@ -584,6 +600,12 @@ static int tipc_nl_compat_handle(struct tipc_nl_compat_msg *msg) | |||
584 | dump.dumpit = tipc_nl_link_dump; | 600 | dump.dumpit = tipc_nl_link_dump; |
585 | dump.format = tipc_nl_compat_link_stat_dump; | 601 | dump.format = tipc_nl_compat_link_stat_dump; |
586 | return tipc_nl_compat_dumpit(&dump, msg); | 602 | return tipc_nl_compat_dumpit(&dump, msg); |
603 | case TIPC_CMD_GET_LINKS: | ||
604 | msg->req_type = TIPC_TLV_NET_ADDR; | ||
605 | msg->rep_size = ULTRA_STRING_MAX_LEN; | ||
606 | dump.dumpit = tipc_nl_link_dump; | ||
607 | dump.format = tipc_nl_compat_link_dump; | ||
608 | return tipc_nl_compat_dumpit(&dump, msg); | ||
587 | } | 609 | } |
588 | 610 | ||
589 | return -EOPNOTSUPP; | 611 | return -EOPNOTSUPP; |
@@ -684,6 +706,7 @@ static int tipc_nl_compat_tmp_wrap(struct sk_buff *skb, struct genl_info *info) | |||
684 | case TIPC_CMD_ENABLE_BEARER: | 706 | case TIPC_CMD_ENABLE_BEARER: |
685 | case TIPC_CMD_DISABLE_BEARER: | 707 | case TIPC_CMD_DISABLE_BEARER: |
686 | case TIPC_CMD_SHOW_LINK_STATS: | 708 | case TIPC_CMD_SHOW_LINK_STATS: |
709 | case TIPC_CMD_GET_LINKS: | ||
687 | return tipc_nl_compat_recv(skb, info); | 710 | return tipc_nl_compat_recv(skb, info); |
688 | } | 711 | } |
689 | 712 | ||