aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/link.c
diff options
context:
space:
mode:
authorYing Xue <ying.xue@windriver.com>2015-01-09 02:27:05 -0500
committerDavid S. Miller <davem@davemloft.net>2015-01-12 16:24:32 -0500
commitf2f9800d4955a96d92896841d8ba9b04201deaa1 (patch)
tree3b817800cfd8fcb2de6d5a3d7eb4fff972fba681 /net/tipc/link.c
parentc93d3baa24095887005647984cff5de8c63d3611 (diff)
tipc: make tipc node table aware of net namespace
Global variables associated with node table are below: - node table list (node_htable) - node hash table list (tipc_node_list) - node table lock (node_list_lock) - node number counter (tipc_num_nodes) - node link number counter (tipc_num_links) To make node table support namespace, above global variables must be moved to tipc_net structure in order to keep secret for different namespaces. As a consequence, these variables are allocated and initialized when namespace is created, and deallocated when namespace is destroyed. After the change, functions associated with these variables have to utilize a namespace pointer to access them. So adding namespace pointer as a parameter of these functions is the major change made in the commit. Signed-off-by: Ying Xue <ying.xue@windriver.com> Tested-by: Tero Aho <Tero.Aho@coriant.com> Reviewed-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/link.c')
-rw-r--r--net/tipc/link.c107
1 files changed, 66 insertions, 41 deletions
diff --git a/net/tipc/link.c b/net/tipc/link.c
index 248813cb6d68..f6505652742e 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -114,7 +114,8 @@ static void link_reset_statistics(struct tipc_link *l_ptr);
114static void link_print(struct tipc_link *l_ptr, const char *str); 114static void link_print(struct tipc_link *l_ptr, const char *str);
115static void tipc_link_sync_xmit(struct tipc_link *l); 115static void tipc_link_sync_xmit(struct tipc_link *l);
116static void tipc_link_sync_rcv(struct tipc_node *n, struct sk_buff *buf); 116static void tipc_link_sync_rcv(struct tipc_node *n, struct sk_buff *buf);
117static int tipc_link_input(struct tipc_link *l, struct sk_buff *buf); 117static int tipc_link_input(struct net *net, struct tipc_link *l,
118 struct sk_buff *buf);
118static int tipc_link_prepare_input(struct net *net, struct tipc_link *l, 119static int tipc_link_prepare_input(struct net *net, struct tipc_link *l,
119 struct sk_buff **buf); 120 struct sk_buff **buf);
120 121
@@ -310,13 +311,15 @@ struct tipc_link *tipc_link_create(struct tipc_node *n_ptr,
310 return l_ptr; 311 return l_ptr;
311} 312}
312 313
313void tipc_link_delete_list(unsigned int bearer_id, bool shutting_down) 314void tipc_link_delete_list(struct net *net, unsigned int bearer_id,
315 bool shutting_down)
314{ 316{
317 struct tipc_net *tn = net_generic(net, tipc_net_id);
315 struct tipc_link *l_ptr; 318 struct tipc_link *l_ptr;
316 struct tipc_node *n_ptr; 319 struct tipc_node *n_ptr;
317 320
318 rcu_read_lock(); 321 rcu_read_lock();
319 list_for_each_entry_rcu(n_ptr, &tipc_node_list, list) { 322 list_for_each_entry_rcu(n_ptr, &tn->node_list, list) {
320 tipc_node_lock(n_ptr); 323 tipc_node_lock(n_ptr);
321 l_ptr = n_ptr->links[bearer_id]; 324 l_ptr = n_ptr->links[bearer_id];
322 if (l_ptr) { 325 if (l_ptr) {
@@ -451,13 +454,14 @@ void tipc_link_reset(struct tipc_link *l_ptr)
451 link_reset_statistics(l_ptr); 454 link_reset_statistics(l_ptr);
452} 455}
453 456
454void tipc_link_reset_list(unsigned int bearer_id) 457void tipc_link_reset_list(struct net *net, unsigned int bearer_id)
455{ 458{
459 struct tipc_net *tn = net_generic(net, tipc_net_id);
456 struct tipc_link *l_ptr; 460 struct tipc_link *l_ptr;
457 struct tipc_node *n_ptr; 461 struct tipc_node *n_ptr;
458 462
459 rcu_read_lock(); 463 rcu_read_lock();
460 list_for_each_entry_rcu(n_ptr, &tipc_node_list, list) { 464 list_for_each_entry_rcu(n_ptr, &tn->node_list, list) {
461 tipc_node_lock(n_ptr); 465 tipc_node_lock(n_ptr);
462 l_ptr = n_ptr->links[bearer_id]; 466 l_ptr = n_ptr->links[bearer_id];
463 if (l_ptr) 467 if (l_ptr)
@@ -773,16 +777,18 @@ static int __tipc_link_xmit_skb(struct tipc_link *link, struct sk_buff *skb)
773 return __tipc_link_xmit(link, &head); 777 return __tipc_link_xmit(link, &head);
774} 778}
775 779
776int tipc_link_xmit_skb(struct sk_buff *skb, u32 dnode, u32 selector) 780int tipc_link_xmit_skb(struct net *net, struct sk_buff *skb, u32 dnode,
781 u32 selector)
777{ 782{
778 struct sk_buff_head head; 783 struct sk_buff_head head;
779 784
780 skb2list(skb, &head); 785 skb2list(skb, &head);
781 return tipc_link_xmit(&head, dnode, selector); 786 return tipc_link_xmit(net, &head, dnode, selector);
782} 787}
783 788
784/** 789/**
785 * tipc_link_xmit() is the general link level function for message sending 790 * tipc_link_xmit() is the general link level function for message sending
791 * @net: the applicable net namespace
786 * @list: chain of buffers containing message 792 * @list: chain of buffers containing message
787 * @dsz: amount of user data to be sent 793 * @dsz: amount of user data to be sent
788 * @dnode: address of destination node 794 * @dnode: address of destination node
@@ -790,13 +796,14 @@ int tipc_link_xmit_skb(struct sk_buff *skb, u32 dnode, u32 selector)
790 * Consumes the buffer chain, except when returning -ELINKCONG 796 * Consumes the buffer chain, except when returning -ELINKCONG
791 * Returns 0 if success, otherwise errno: -ELINKCONG,-EHOSTUNREACH,-EMSGSIZE 797 * Returns 0 if success, otherwise errno: -ELINKCONG,-EHOSTUNREACH,-EMSGSIZE
792 */ 798 */
793int tipc_link_xmit(struct sk_buff_head *list, u32 dnode, u32 selector) 799int tipc_link_xmit(struct net *net, struct sk_buff_head *list, u32 dnode,
800 u32 selector)
794{ 801{
795 struct tipc_link *link = NULL; 802 struct tipc_link *link = NULL;
796 struct tipc_node *node; 803 struct tipc_node *node;
797 int rc = -EHOSTUNREACH; 804 int rc = -EHOSTUNREACH;
798 805
799 node = tipc_node_find(dnode); 806 node = tipc_node_find(net, dnode);
800 if (node) { 807 if (node) {
801 tipc_node_lock(node); 808 tipc_node_lock(node);
802 link = node->active_links[selector & 1]; 809 link = node->active_links[selector & 1];
@@ -813,7 +820,7 @@ int tipc_link_xmit(struct sk_buff_head *list, u32 dnode, u32 selector)
813 * buffer, we just need to dequeue one SKB buffer from the 820 * buffer, we just need to dequeue one SKB buffer from the
814 * head list. 821 * head list.
815 */ 822 */
816 return tipc_sk_rcv(__skb_dequeue(list)); 823 return tipc_sk_rcv(net, __skb_dequeue(list));
817 } 824 }
818 __skb_queue_purge(list); 825 __skb_queue_purge(list);
819 826
@@ -1066,7 +1073,7 @@ static int link_recv_buf_validate(struct sk_buff *buf)
1066 1073
1067/** 1074/**
1068 * tipc_rcv - process TIPC packets/messages arriving from off-node 1075 * tipc_rcv - process TIPC packets/messages arriving from off-node
1069 * @net: net namespace handler 1076 * @net: the applicable net namespace
1070 * @skb: TIPC packet 1077 * @skb: TIPC packet
1071 * @b_ptr: pointer to bearer message arrived on 1078 * @b_ptr: pointer to bearer message arrived on
1072 * 1079 *
@@ -1112,7 +1119,7 @@ void tipc_rcv(struct net *net, struct sk_buff *skb, struct tipc_bearer *b_ptr)
1112 goto discard; 1119 goto discard;
1113 1120
1114 /* Locate neighboring node that sent message */ 1121 /* Locate neighboring node that sent message */
1115 n_ptr = tipc_node_find(msg_prevnode(msg)); 1122 n_ptr = tipc_node_find(net, msg_prevnode(msg));
1116 if (unlikely(!n_ptr)) 1123 if (unlikely(!n_ptr))
1117 goto discard; 1124 goto discard;
1118 tipc_node_lock(n_ptr); 1125 tipc_node_lock(n_ptr);
@@ -1203,7 +1210,7 @@ void tipc_rcv(struct net *net, struct sk_buff *skb, struct tipc_bearer *b_ptr)
1203 } 1210 }
1204 tipc_node_unlock(n_ptr); 1211 tipc_node_unlock(n_ptr);
1205 1212
1206 if (tipc_link_input(l_ptr, skb) != 0) 1213 if (tipc_link_input(net, l_ptr, skb) != 0)
1207 goto discard; 1214 goto discard;
1208 continue; 1215 continue;
1209unlock_discard: 1216unlock_discard:
@@ -1263,7 +1270,8 @@ static int tipc_link_prepare_input(struct net *net, struct tipc_link *l,
1263/** 1270/**
1264 * tipc_link_input - Deliver message too higher layers 1271 * tipc_link_input - Deliver message too higher layers
1265 */ 1272 */
1266static int tipc_link_input(struct tipc_link *l, struct sk_buff *buf) 1273static int tipc_link_input(struct net *net, struct tipc_link *l,
1274 struct sk_buff *buf)
1267{ 1275{
1268 struct tipc_msg *msg = buf_msg(buf); 1276 struct tipc_msg *msg = buf_msg(buf);
1269 int res = 0; 1277 int res = 0;
@@ -1274,13 +1282,13 @@ static int tipc_link_input(struct tipc_link *l, struct sk_buff *buf)
1274 case TIPC_HIGH_IMPORTANCE: 1282 case TIPC_HIGH_IMPORTANCE:
1275 case TIPC_CRITICAL_IMPORTANCE: 1283 case TIPC_CRITICAL_IMPORTANCE:
1276 case CONN_MANAGER: 1284 case CONN_MANAGER:
1277 tipc_sk_rcv(buf); 1285 tipc_sk_rcv(net, buf);
1278 break; 1286 break;
1279 case NAME_DISTRIBUTOR: 1287 case NAME_DISTRIBUTOR:
1280 tipc_named_rcv(buf); 1288 tipc_named_rcv(net, buf);
1281 break; 1289 break;
1282 case MSG_BUNDLER: 1290 case MSG_BUNDLER:
1283 tipc_link_bundle_rcv(buf); 1291 tipc_link_bundle_rcv(net, buf);
1284 break; 1292 break;
1285 default: 1293 default:
1286 res = -EINVAL; 1294 res = -EINVAL;
@@ -1855,7 +1863,7 @@ exit:
1855/* 1863/*
1856 * Bundler functionality: 1864 * Bundler functionality:
1857 */ 1865 */
1858void tipc_link_bundle_rcv(struct sk_buff *buf) 1866void tipc_link_bundle_rcv(struct net *net, struct sk_buff *buf)
1859{ 1867{
1860 u32 msgcount = msg_msgcnt(buf_msg(buf)); 1868 u32 msgcount = msg_msgcnt(buf_msg(buf));
1861 u32 pos = INT_H_SIZE; 1869 u32 pos = INT_H_SIZE;
@@ -1872,13 +1880,13 @@ void tipc_link_bundle_rcv(struct sk_buff *buf)
1872 pos += align(msg_size(omsg)); 1880 pos += align(msg_size(omsg));
1873 if (msg_isdata(omsg)) { 1881 if (msg_isdata(omsg)) {
1874 if (unlikely(msg_type(omsg) == TIPC_MCAST_MSG)) 1882 if (unlikely(msg_type(omsg) == TIPC_MCAST_MSG))
1875 tipc_sk_mcast_rcv(obuf); 1883 tipc_sk_mcast_rcv(net, obuf);
1876 else 1884 else
1877 tipc_sk_rcv(obuf); 1885 tipc_sk_rcv(net, obuf);
1878 } else if (msg_user(omsg) == CONN_MANAGER) { 1886 } else if (msg_user(omsg) == CONN_MANAGER) {
1879 tipc_sk_rcv(obuf); 1887 tipc_sk_rcv(net, obuf);
1880 } else if (msg_user(omsg) == NAME_DISTRIBUTOR) { 1888 } else if (msg_user(omsg) == NAME_DISTRIBUTOR) {
1881 tipc_named_rcv(obuf); 1889 tipc_named_rcv(net, obuf);
1882 } else { 1890 } else {
1883 pr_warn("Illegal bundled msg: %u\n", msg_user(omsg)); 1891 pr_warn("Illegal bundled msg: %u\n", msg_user(omsg));
1884 kfree_skb(obuf); 1892 kfree_skb(obuf);
@@ -1919,14 +1927,17 @@ void tipc_link_set_queue_limits(struct tipc_link *l_ptr, u32 window)
1919} 1927}
1920 1928
1921/* tipc_link_find_owner - locate owner node of link by link's name 1929/* tipc_link_find_owner - locate owner node of link by link's name
1930 * @net: the applicable net namespace
1922 * @name: pointer to link name string 1931 * @name: pointer to link name string
1923 * @bearer_id: pointer to index in 'node->links' array where the link was found. 1932 * @bearer_id: pointer to index in 'node->links' array where the link was found.
1924 * 1933 *
1925 * Returns pointer to node owning the link, or 0 if no matching link is found. 1934 * Returns pointer to node owning the link, or 0 if no matching link is found.
1926 */ 1935 */
1927static struct tipc_node *tipc_link_find_owner(const char *link_name, 1936static struct tipc_node *tipc_link_find_owner(struct net *net,
1937 const char *link_name,
1928 unsigned int *bearer_id) 1938 unsigned int *bearer_id)
1929{ 1939{
1940 struct tipc_net *tn = net_generic(net, tipc_net_id);
1930 struct tipc_link *l_ptr; 1941 struct tipc_link *l_ptr;
1931 struct tipc_node *n_ptr; 1942 struct tipc_node *n_ptr;
1932 struct tipc_node *found_node = NULL; 1943 struct tipc_node *found_node = NULL;
@@ -1934,7 +1945,7 @@ static struct tipc_node *tipc_link_find_owner(const char *link_name,
1934 1945
1935 *bearer_id = 0; 1946 *bearer_id = 0;
1936 rcu_read_lock(); 1947 rcu_read_lock();
1937 list_for_each_entry_rcu(n_ptr, &tipc_node_list, list) { 1948 list_for_each_entry_rcu(n_ptr, &tn->node_list, list) {
1938 tipc_node_lock(n_ptr); 1949 tipc_node_lock(n_ptr);
1939 for (i = 0; i < MAX_BEARERS; i++) { 1950 for (i = 0; i < MAX_BEARERS; i++) {
1940 l_ptr = n_ptr->links[i]; 1951 l_ptr = n_ptr->links[i];
@@ -1978,6 +1989,7 @@ static int link_value_is_valid(u16 cmd, u32 new_value)
1978 1989
1979/** 1990/**
1980 * link_cmd_set_value - change priority/tolerance/window for link/bearer/media 1991 * link_cmd_set_value - change priority/tolerance/window for link/bearer/media
1992 * @net: the applicable net namespace
1981 * @name: ptr to link, bearer, or media name 1993 * @name: ptr to link, bearer, or media name
1982 * @new_value: new value of link, bearer, or media setting 1994 * @new_value: new value of link, bearer, or media setting
1983 * @cmd: which link, bearer, or media attribute to set (TIPC_CMD_SET_LINK_*) 1995 * @cmd: which link, bearer, or media attribute to set (TIPC_CMD_SET_LINK_*)
@@ -1986,7 +1998,8 @@ static int link_value_is_valid(u16 cmd, u32 new_value)
1986 * 1998 *
1987 * Returns 0 if value updated and negative value on error. 1999 * Returns 0 if value updated and negative value on error.
1988 */ 2000 */
1989static int link_cmd_set_value(const char *name, u32 new_value, u16 cmd) 2001static int link_cmd_set_value(struct net *net, const char *name, u32 new_value,
2002 u16 cmd)
1990{ 2003{
1991 struct tipc_node *node; 2004 struct tipc_node *node;
1992 struct tipc_link *l_ptr; 2005 struct tipc_link *l_ptr;
@@ -1995,7 +2008,7 @@ static int link_cmd_set_value(const char *name, u32 new_value, u16 cmd)
1995 int bearer_id; 2008 int bearer_id;
1996 int res = 0; 2009 int res = 0;
1997 2010
1998 node = tipc_link_find_owner(name, &bearer_id); 2011 node = tipc_link_find_owner(net, name, &bearer_id);
1999 if (node) { 2012 if (node) {
2000 tipc_node_lock(node); 2013 tipc_node_lock(node);
2001 l_ptr = node->links[bearer_id]; 2014 l_ptr = node->links[bearer_id];
@@ -2063,8 +2076,8 @@ static int link_cmd_set_value(const char *name, u32 new_value, u16 cmd)
2063 return res; 2076 return res;
2064} 2077}
2065 2078
2066struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space, 2079struct sk_buff *tipc_link_cmd_config(struct net *net, const void *req_tlv_area,
2067 u16 cmd) 2080 int req_tlv_space, u16 cmd)
2068{ 2081{
2069 struct tipc_link_config *args; 2082 struct tipc_link_config *args;
2070 u32 new_value; 2083 u32 new_value;
@@ -2088,7 +2101,7 @@ struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space
2088 " (cannot change setting on broadcast link)"); 2101 " (cannot change setting on broadcast link)");
2089 } 2102 }
2090 2103
2091 res = link_cmd_set_value(args->name, new_value, cmd); 2104 res = link_cmd_set_value(net, args->name, new_value, cmd);
2092 if (res) 2105 if (res)
2093 return tipc_cfg_reply_error_string("cannot change link setting"); 2106 return tipc_cfg_reply_error_string("cannot change link setting");
2094 2107
@@ -2106,7 +2119,9 @@ static void link_reset_statistics(struct tipc_link *l_ptr)
2106 l_ptr->stats.recv_info = l_ptr->next_in_no; 2119 l_ptr->stats.recv_info = l_ptr->next_in_no;
2107} 2120}
2108 2121
2109struct sk_buff *tipc_link_cmd_reset_stats(const void *req_tlv_area, int req_tlv_space) 2122struct sk_buff *tipc_link_cmd_reset_stats(struct net *net,
2123 const void *req_tlv_area,
2124 int req_tlv_space)
2110{ 2125{
2111 char *link_name; 2126 char *link_name;
2112 struct tipc_link *l_ptr; 2127 struct tipc_link *l_ptr;
@@ -2122,7 +2137,7 @@ struct sk_buff *tipc_link_cmd_reset_stats(const void *req_tlv_area, int req_tlv_
2122 return tipc_cfg_reply_error_string("link not found"); 2137 return tipc_cfg_reply_error_string("link not found");
2123 return tipc_cfg_reply_none(); 2138 return tipc_cfg_reply_none();
2124 } 2139 }
2125 node = tipc_link_find_owner(link_name, &bearer_id); 2140 node = tipc_link_find_owner(net, link_name, &bearer_id);
2126 if (!node) 2141 if (!node)
2127 return tipc_cfg_reply_error_string("link not found"); 2142 return tipc_cfg_reply_error_string("link not found");
2128 2143
@@ -2147,13 +2162,15 @@ static u32 percent(u32 count, u32 total)
2147 2162
2148/** 2163/**
2149 * tipc_link_stats - print link statistics 2164 * tipc_link_stats - print link statistics
2165 * @net: the applicable net namespace
2150 * @name: link name 2166 * @name: link name
2151 * @buf: print buffer area 2167 * @buf: print buffer area
2152 * @buf_size: size of print buffer area 2168 * @buf_size: size of print buffer area
2153 * 2169 *
2154 * Returns length of print buffer data string (or 0 if error) 2170 * Returns length of print buffer data string (or 0 if error)
2155 */ 2171 */
2156static int tipc_link_stats(const char *name, char *buf, const u32 buf_size) 2172static int tipc_link_stats(struct net *net, const char *name, char *buf,
2173 const u32 buf_size)
2157{ 2174{
2158 struct tipc_link *l; 2175 struct tipc_link *l;
2159 struct tipc_stats *s; 2176 struct tipc_stats *s;
@@ -2166,7 +2183,7 @@ static int tipc_link_stats(const char *name, char *buf, const u32 buf_size)
2166 if (!strcmp(name, tipc_bclink_name)) 2183 if (!strcmp(name, tipc_bclink_name))
2167 return tipc_bclink_stats(buf, buf_size); 2184 return tipc_bclink_stats(buf, buf_size);
2168 2185
2169 node = tipc_link_find_owner(name, &bearer_id); 2186 node = tipc_link_find_owner(net, name, &bearer_id);
2170 if (!node) 2187 if (!node)
2171 return 0; 2188 return 0;
2172 2189
@@ -2243,7 +2260,9 @@ static int tipc_link_stats(const char *name, char *buf, const u32 buf_size)
2243 return ret; 2260 return ret;
2244} 2261}
2245 2262
2246struct sk_buff *tipc_link_cmd_show_stats(const void *req_tlv_area, int req_tlv_space) 2263struct sk_buff *tipc_link_cmd_show_stats(struct net *net,
2264 const void *req_tlv_area,
2265 int req_tlv_space)
2247{ 2266{
2248 struct sk_buff *buf; 2267 struct sk_buff *buf;
2249 struct tlv_desc *rep_tlv; 2268 struct tlv_desc *rep_tlv;
@@ -2261,7 +2280,7 @@ struct sk_buff *tipc_link_cmd_show_stats(const void *req_tlv_area, int req_tlv_s
2261 rep_tlv = (struct tlv_desc *)buf->data; 2280 rep_tlv = (struct tlv_desc *)buf->data;
2262 pb = TLV_DATA(rep_tlv); 2281 pb = TLV_DATA(rep_tlv);
2263 pb_len = ULTRA_STRING_MAX_LEN; 2282 pb_len = ULTRA_STRING_MAX_LEN;
2264 str_len = tipc_link_stats((char *)TLV_DATA(req_tlv_area), 2283 str_len = tipc_link_stats(net, (char *)TLV_DATA(req_tlv_area),
2265 pb, pb_len); 2284 pb, pb_len);
2266 if (!str_len) { 2285 if (!str_len) {
2267 kfree_skb(buf); 2286 kfree_skb(buf);
@@ -2343,6 +2362,7 @@ int tipc_nl_link_set(struct sk_buff *skb, struct genl_info *info)
2343 struct tipc_link *link; 2362 struct tipc_link *link;
2344 struct tipc_node *node; 2363 struct tipc_node *node;
2345 struct nlattr *attrs[TIPC_NLA_LINK_MAX + 1]; 2364 struct nlattr *attrs[TIPC_NLA_LINK_MAX + 1];
2365 struct net *net = genl_info_net(info);
2346 2366
2347 if (!info->attrs[TIPC_NLA_LINK]) 2367 if (!info->attrs[TIPC_NLA_LINK])
2348 return -EINVAL; 2368 return -EINVAL;
@@ -2358,7 +2378,7 @@ int tipc_nl_link_set(struct sk_buff *skb, struct genl_info *info)
2358 2378
2359 name = nla_data(attrs[TIPC_NLA_LINK_NAME]); 2379 name = nla_data(attrs[TIPC_NLA_LINK_NAME]);
2360 2380
2361 node = tipc_link_find_owner(name, &bearer_id); 2381 node = tipc_link_find_owner(net, name, &bearer_id);
2362 if (!node) 2382 if (!node)
2363 return -EINVAL; 2383 return -EINVAL;
2364 2384
@@ -2567,6 +2587,8 @@ static int __tipc_nl_add_node_links(struct tipc_nl_msg *msg,
2567 2587
2568int tipc_nl_link_dump(struct sk_buff *skb, struct netlink_callback *cb) 2588int tipc_nl_link_dump(struct sk_buff *skb, struct netlink_callback *cb)
2569{ 2589{
2590 struct net *net = sock_net(skb->sk);
2591 struct tipc_net *tn = net_generic(net, tipc_net_id);
2570 struct tipc_node *node; 2592 struct tipc_node *node;
2571 struct tipc_nl_msg msg; 2593 struct tipc_nl_msg msg;
2572 u32 prev_node = cb->args[0]; 2594 u32 prev_node = cb->args[0];
@@ -2584,7 +2606,7 @@ int tipc_nl_link_dump(struct sk_buff *skb, struct netlink_callback *cb)
2584 rcu_read_lock(); 2606 rcu_read_lock();
2585 2607
2586 if (prev_node) { 2608 if (prev_node) {
2587 node = tipc_node_find(prev_node); 2609 node = tipc_node_find(net, prev_node);
2588 if (!node) { 2610 if (!node) {
2589 /* We never set seq or call nl_dump_check_consistent() 2611 /* We never set seq or call nl_dump_check_consistent()
2590 * this means that setting prev_seq here will cause the 2612 * this means that setting prev_seq here will cause the
@@ -2596,7 +2618,8 @@ int tipc_nl_link_dump(struct sk_buff *skb, struct netlink_callback *cb)
2596 goto out; 2618 goto out;
2597 } 2619 }
2598 2620
2599 list_for_each_entry_continue_rcu(node, &tipc_node_list, list) { 2621 list_for_each_entry_continue_rcu(node, &tn->node_list,
2622 list) {
2600 tipc_node_lock(node); 2623 tipc_node_lock(node);
2601 err = __tipc_nl_add_node_links(&msg, node, &prev_link); 2624 err = __tipc_nl_add_node_links(&msg, node, &prev_link);
2602 tipc_node_unlock(node); 2625 tipc_node_unlock(node);
@@ -2610,7 +2633,7 @@ int tipc_nl_link_dump(struct sk_buff *skb, struct netlink_callback *cb)
2610 if (err) 2633 if (err)
2611 goto out; 2634 goto out;
2612 2635
2613 list_for_each_entry_rcu(node, &tipc_node_list, list) { 2636 list_for_each_entry_rcu(node, &tn->node_list, list) {
2614 tipc_node_lock(node); 2637 tipc_node_lock(node);
2615 err = __tipc_nl_add_node_links(&msg, node, &prev_link); 2638 err = __tipc_nl_add_node_links(&msg, node, &prev_link);
2616 tipc_node_unlock(node); 2639 tipc_node_unlock(node);
@@ -2633,6 +2656,7 @@ out:
2633 2656
2634int tipc_nl_link_get(struct sk_buff *skb, struct genl_info *info) 2657int tipc_nl_link_get(struct sk_buff *skb, struct genl_info *info)
2635{ 2658{
2659 struct net *net = genl_info_net(info);
2636 struct sk_buff *ans_skb; 2660 struct sk_buff *ans_skb;
2637 struct tipc_nl_msg msg; 2661 struct tipc_nl_msg msg;
2638 struct tipc_link *link; 2662 struct tipc_link *link;
@@ -2645,7 +2669,7 @@ int tipc_nl_link_get(struct sk_buff *skb, struct genl_info *info)
2645 return -EINVAL; 2669 return -EINVAL;
2646 2670
2647 name = nla_data(info->attrs[TIPC_NLA_LINK_NAME]); 2671 name = nla_data(info->attrs[TIPC_NLA_LINK_NAME]);
2648 node = tipc_link_find_owner(name, &bearer_id); 2672 node = tipc_link_find_owner(net, name, &bearer_id);
2649 if (!node) 2673 if (!node)
2650 return -EINVAL; 2674 return -EINVAL;
2651 2675
@@ -2687,6 +2711,7 @@ int tipc_nl_link_reset_stats(struct sk_buff *skb, struct genl_info *info)
2687 struct tipc_link *link; 2711 struct tipc_link *link;
2688 struct tipc_node *node; 2712 struct tipc_node *node;
2689 struct nlattr *attrs[TIPC_NLA_LINK_MAX + 1]; 2713 struct nlattr *attrs[TIPC_NLA_LINK_MAX + 1];
2714 struct net *net = genl_info_net(info);
2690 2715
2691 if (!info->attrs[TIPC_NLA_LINK]) 2716 if (!info->attrs[TIPC_NLA_LINK])
2692 return -EINVAL; 2717 return -EINVAL;
@@ -2709,7 +2734,7 @@ int tipc_nl_link_reset_stats(struct sk_buff *skb, struct genl_info *info)
2709 return 0; 2734 return 0;
2710 } 2735 }
2711 2736
2712 node = tipc_link_find_owner(link_name, &bearer_id); 2737 node = tipc_link_find_owner(net, link_name, &bearer_id);
2713 if (!node) 2738 if (!node)
2714 return -EINVAL; 2739 return -EINVAL;
2715 2740