aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
Diffstat (limited to 'net/tipc')
-rw-r--r--net/tipc/config.c4
-rw-r--r--net/tipc/link.c35
-rw-r--r--net/tipc/link.h3
-rw-r--r--net/tipc/netlink_compat.c26
4 files changed, 27 insertions, 41 deletions
diff --git a/net/tipc/config.c b/net/tipc/config.c
index 75a130e493f5..11c16d191fa2 100644
--- a/net/tipc/config.c
+++ b/net/tipc/config.c
@@ -209,10 +209,6 @@ struct sk_buff *tipc_cfg_do_cmd(struct net *net, u32 orig_node, u16 cmd,
209 rep_tlv_buf = tipc_node_get_nodes(net, req_tlv_area, 209 rep_tlv_buf = tipc_node_get_nodes(net, req_tlv_area,
210 req_tlv_space); 210 req_tlv_space);
211 break; 211 break;
212 case TIPC_CMD_RESET_LINK_STATS:
213 rep_tlv_buf = tipc_link_cmd_reset_stats(net, req_tlv_area,
214 req_tlv_space);
215 break;
216 case TIPC_CMD_SHOW_NAME_TABLE: 212 case TIPC_CMD_SHOW_NAME_TABLE:
217 rep_tlv_buf = tipc_nametbl_get(net, req_tlv_area, 213 rep_tlv_buf = tipc_nametbl_get(net, req_tlv_area,
218 req_tlv_space); 214 req_tlv_space);
diff --git a/net/tipc/link.c b/net/tipc/link.c
index ec136b5cc339..dfe6f4d0b402 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -1969,39 +1969,6 @@ static void link_reset_statistics(struct tipc_link *l_ptr)
1969 l_ptr->stats.recv_info = l_ptr->next_in_no; 1969 l_ptr->stats.recv_info = l_ptr->next_in_no;
1970} 1970}
1971 1971
1972struct sk_buff *tipc_link_cmd_reset_stats(struct net *net,
1973 const void *req_tlv_area,
1974 int req_tlv_space)
1975{
1976 char *link_name;
1977 struct tipc_link *l_ptr;
1978 struct tipc_node *node;
1979 unsigned int bearer_id;
1980
1981 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_NAME))
1982 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
1983
1984 link_name = (char *)TLV_DATA(req_tlv_area);
1985 if (!strcmp(link_name, tipc_bclink_name)) {
1986 if (tipc_bclink_reset_stats(net))
1987 return tipc_cfg_reply_error_string("link not found");
1988 return tipc_cfg_reply_none();
1989 }
1990 node = tipc_link_find_owner(net, link_name, &bearer_id);
1991 if (!node)
1992 return tipc_cfg_reply_error_string("link not found");
1993
1994 tipc_node_lock(node);
1995 l_ptr = node->links[bearer_id];
1996 if (!l_ptr) {
1997 tipc_node_unlock(node);
1998 return tipc_cfg_reply_error_string("link not found");
1999 }
2000 link_reset_statistics(l_ptr);
2001 tipc_node_unlock(node);
2002 return tipc_cfg_reply_none();
2003}
2004
2005static void link_print(struct tipc_link *l_ptr, const char *str) 1972static void link_print(struct tipc_link *l_ptr, const char *str)
2006{ 1973{
2007 struct tipc_net *tn = net_generic(l_ptr->owner->net, tipc_net_id); 1974 struct tipc_net *tn = net_generic(l_ptr->owner->net, tipc_net_id);
@@ -2424,7 +2391,7 @@ int tipc_nl_link_reset_stats(struct sk_buff *skb, struct genl_info *info)
2424 struct tipc_link *link; 2391 struct tipc_link *link;
2425 struct tipc_node *node; 2392 struct tipc_node *node;
2426 struct nlattr *attrs[TIPC_NLA_LINK_MAX + 1]; 2393 struct nlattr *attrs[TIPC_NLA_LINK_MAX + 1];
2427 struct net *net = genl_info_net(info); 2394 struct net *net = sock_net(skb->sk);
2428 2395
2429 if (!info->attrs[TIPC_NLA_LINK]) 2396 if (!info->attrs[TIPC_NLA_LINK])
2430 return -EINVAL; 2397 return -EINVAL;
diff --git a/net/tipc/link.h b/net/tipc/link.h
index 6eb9d606063b..7aeb52092bf3 100644
--- a/net/tipc/link.h
+++ b/net/tipc/link.h
@@ -215,9 +215,6 @@ void tipc_link_reset_fragments(struct tipc_link *l_ptr);
215int tipc_link_is_up(struct tipc_link *l_ptr); 215int tipc_link_is_up(struct tipc_link *l_ptr);
216int tipc_link_is_active(struct tipc_link *l_ptr); 216int tipc_link_is_active(struct tipc_link *l_ptr);
217void tipc_link_purge_queues(struct tipc_link *l_ptr); 217void tipc_link_purge_queues(struct tipc_link *l_ptr);
218struct sk_buff *tipc_link_cmd_reset_stats(struct net *net,
219 const void *req_tlv_area,
220 int req_tlv_space);
221void tipc_link_reset_all(struct tipc_node *node); 218void tipc_link_reset_all(struct tipc_node *node);
222void tipc_link_reset(struct tipc_link *l_ptr); 219void tipc_link_reset(struct tipc_link *l_ptr);
223void tipc_link_reset_list(struct net *net, unsigned int bearer_id); 220void tipc_link_reset_list(struct net *net, unsigned int bearer_id);
diff --git a/net/tipc/netlink_compat.c b/net/tipc/netlink_compat.c
index 056532b41e7e..02461233b6d8 100644
--- a/net/tipc/netlink_compat.c
+++ b/net/tipc/netlink_compat.c
@@ -606,6 +606,26 @@ static int tipc_nl_compat_link_set(struct sk_buff *skb,
606 return 0; 606 return 0;
607} 607}
608 608
609static int tipc_nl_compat_link_reset_stats(struct sk_buff *skb,
610 struct tipc_nl_compat_msg *msg)
611{
612 char *name;
613 struct nlattr *link;
614
615 name = (char *)TLV_DATA(msg->req);
616
617 link = nla_nest_start(skb, TIPC_NLA_LINK);
618 if (!link)
619 return -EMSGSIZE;
620
621 if (nla_put_string(skb, TIPC_NLA_LINK_NAME, name))
622 return -EMSGSIZE;
623
624 nla_nest_end(skb, link);
625
626 return 0;
627}
628
609static int tipc_nl_compat_handle(struct tipc_nl_compat_msg *msg) 629static int tipc_nl_compat_handle(struct tipc_nl_compat_msg *msg)
610{ 630{
611 struct tipc_nl_compat_cmd_dump dump; 631 struct tipc_nl_compat_cmd_dump dump;
@@ -650,6 +670,11 @@ static int tipc_nl_compat_handle(struct tipc_nl_compat_msg *msg)
650 doit.doit = tipc_nl_link_set; 670 doit.doit = tipc_nl_link_set;
651 doit.transcode = tipc_nl_compat_link_set; 671 doit.transcode = tipc_nl_compat_link_set;
652 return tipc_nl_compat_doit(&doit, msg); 672 return tipc_nl_compat_doit(&doit, msg);
673 case TIPC_CMD_RESET_LINK_STATS:
674 msg->req_type = TIPC_TLV_LINK_NAME;
675 doit.doit = tipc_nl_link_reset_stats;
676 doit.transcode = tipc_nl_compat_link_reset_stats;
677 return tipc_nl_compat_doit(&doit, msg);
653 } 678 }
654 679
655 return -EOPNOTSUPP; 680 return -EOPNOTSUPP;
@@ -754,6 +779,7 @@ static int tipc_nl_compat_tmp_wrap(struct sk_buff *skb, struct genl_info *info)
754 case TIPC_CMD_SET_LINK_TOL: 779 case TIPC_CMD_SET_LINK_TOL:
755 case TIPC_CMD_SET_LINK_PRI: 780 case TIPC_CMD_SET_LINK_PRI:
756 case TIPC_CMD_SET_LINK_WINDOW: 781 case TIPC_CMD_SET_LINK_WINDOW:
782 case TIPC_CMD_RESET_LINK_STATS:
757 return tipc_nl_compat_recv(skb, info); 783 return tipc_nl_compat_recv(skb, info);
758 } 784 }
759 785