diff options
Diffstat (limited to 'net/tipc')
-rw-r--r-- | net/tipc/bcast.c | 27 | ||||
-rw-r--r-- | net/tipc/bcast.h | 7 | ||||
-rw-r--r-- | net/tipc/bearer.c | 67 | ||||
-rw-r--r-- | net/tipc/bearer.h | 16 | ||||
-rw-r--r-- | net/tipc/config.c | 2 | ||||
-rw-r--r-- | net/tipc/core.h | 4 | ||||
-rw-r--r-- | net/tipc/discover.c | 12 | ||||
-rw-r--r-- | net/tipc/link.c | 41 | ||||
-rw-r--r-- | net/tipc/link.h | 3 | ||||
-rw-r--r-- | net/tipc/net.c | 4 |
10 files changed, 110 insertions, 73 deletions
diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c index 816c0e49319f..e7c538304595 100644 --- a/net/tipc/bcast.c +++ b/net/tipc/bcast.c | |||
@@ -369,7 +369,7 @@ void tipc_bclink_update_link_state(struct net *net, struct tipc_node *n_ptr, | |||
369 | msg_set_bcgap_to(msg, to); | 369 | msg_set_bcgap_to(msg, to); |
370 | 370 | ||
371 | tipc_bclink_lock(); | 371 | tipc_bclink_lock(); |
372 | tipc_bearer_send(MAX_BEARERS, buf, NULL); | 372 | tipc_bearer_send(net, MAX_BEARERS, buf, NULL); |
373 | bcl->stats.sent_nacks++; | 373 | bcl->stats.sent_nacks++; |
374 | tipc_bclink_unlock(); | 374 | tipc_bclink_unlock(); |
375 | kfree_skb(buf); | 375 | kfree_skb(buf); |
@@ -425,7 +425,7 @@ int tipc_bclink_xmit(struct net *net, struct sk_buff_head *list) | |||
425 | if (likely(bclink)) { | 425 | if (likely(bclink)) { |
426 | tipc_bclink_lock(); | 426 | tipc_bclink_lock(); |
427 | if (likely(bclink->bcast_nodes.count)) { | 427 | if (likely(bclink->bcast_nodes.count)) { |
428 | rc = __tipc_link_xmit(bcl, list); | 428 | rc = __tipc_link_xmit(net, bcl, list); |
429 | if (likely(!rc)) { | 429 | if (likely(!rc)) { |
430 | u32 len = skb_queue_len(&bcl->outqueue); | 430 | u32 len = skb_queue_len(&bcl->outqueue); |
431 | 431 | ||
@@ -682,13 +682,14 @@ static int tipc_bcbearer_send(struct sk_buff *buf, struct tipc_bearer *unused1, | |||
682 | 682 | ||
683 | if (bp_index == 0) { | 683 | if (bp_index == 0) { |
684 | /* Use original buffer for first bearer */ | 684 | /* Use original buffer for first bearer */ |
685 | tipc_bearer_send(b->identity, buf, &b->bcast_addr); | 685 | tipc_bearer_send(net, b->identity, buf, &b->bcast_addr); |
686 | } else { | 686 | } else { |
687 | /* Avoid concurrent buffer access */ | 687 | /* Avoid concurrent buffer access */ |
688 | tbuf = pskb_copy_for_clone(buf, GFP_ATOMIC); | 688 | tbuf = pskb_copy_for_clone(buf, GFP_ATOMIC); |
689 | if (!tbuf) | 689 | if (!tbuf) |
690 | break; | 690 | break; |
691 | tipc_bearer_send(b->identity, tbuf, &b->bcast_addr); | 691 | tipc_bearer_send(net, b->identity, tbuf, |
692 | &b->bcast_addr); | ||
692 | kfree_skb(tbuf); /* Bearer keeps a clone */ | 693 | kfree_skb(tbuf); /* Bearer keeps a clone */ |
693 | } | 694 | } |
694 | if (bcbearer->remains_new.count == 0) | 695 | if (bcbearer->remains_new.count == 0) |
@@ -703,8 +704,10 @@ static int tipc_bcbearer_send(struct sk_buff *buf, struct tipc_bearer *unused1, | |||
703 | /** | 704 | /** |
704 | * tipc_bcbearer_sort - create sets of bearer pairs used by broadcast bearer | 705 | * tipc_bcbearer_sort - create sets of bearer pairs used by broadcast bearer |
705 | */ | 706 | */ |
706 | void tipc_bcbearer_sort(struct tipc_node_map *nm_ptr, u32 node, bool action) | 707 | void tipc_bcbearer_sort(struct net *net, struct tipc_node_map *nm_ptr, |
708 | u32 node, bool action) | ||
707 | { | 709 | { |
710 | struct tipc_net *tn = net_generic(net, tipc_net_id); | ||
708 | struct tipc_bcbearer_pair *bp_temp = bcbearer->bpairs_temp; | 711 | struct tipc_bcbearer_pair *bp_temp = bcbearer->bpairs_temp; |
709 | struct tipc_bcbearer_pair *bp_curr; | 712 | struct tipc_bcbearer_pair *bp_curr; |
710 | struct tipc_bearer *b; | 713 | struct tipc_bearer *b; |
@@ -723,7 +726,7 @@ void tipc_bcbearer_sort(struct tipc_node_map *nm_ptr, u32 node, bool action) | |||
723 | 726 | ||
724 | rcu_read_lock(); | 727 | rcu_read_lock(); |
725 | for (b_index = 0; b_index < MAX_BEARERS; b_index++) { | 728 | for (b_index = 0; b_index < MAX_BEARERS; b_index++) { |
726 | b = rcu_dereference_rtnl(bearer_list[b_index]); | 729 | b = rcu_dereference_rtnl(tn->bearer_list[b_index]); |
727 | if (!b || !b->nodes.count) | 730 | if (!b || !b->nodes.count) |
728 | continue; | 731 | continue; |
729 | 732 | ||
@@ -939,8 +942,10 @@ int tipc_bclink_set_queue_limits(u32 limit) | |||
939 | return 0; | 942 | return 0; |
940 | } | 943 | } |
941 | 944 | ||
942 | int tipc_bclink_init(void) | 945 | int tipc_bclink_init(struct net *net) |
943 | { | 946 | { |
947 | struct tipc_net *tn = net_generic(net, tipc_net_id); | ||
948 | |||
944 | bcbearer = kzalloc(sizeof(*bcbearer), GFP_ATOMIC); | 949 | bcbearer = kzalloc(sizeof(*bcbearer), GFP_ATOMIC); |
945 | if (!bcbearer) | 950 | if (!bcbearer) |
946 | return -ENOMEM; | 951 | return -ENOMEM; |
@@ -967,19 +972,21 @@ int tipc_bclink_init(void) | |||
967 | bcl->max_pkt = MAX_PKT_DEFAULT_MCAST; | 972 | bcl->max_pkt = MAX_PKT_DEFAULT_MCAST; |
968 | tipc_link_set_queue_limits(bcl, BCLINK_WIN_DEFAULT); | 973 | tipc_link_set_queue_limits(bcl, BCLINK_WIN_DEFAULT); |
969 | bcl->bearer_id = MAX_BEARERS; | 974 | bcl->bearer_id = MAX_BEARERS; |
970 | rcu_assign_pointer(bearer_list[MAX_BEARERS], &bcbearer->bearer); | 975 | rcu_assign_pointer(tn->bearer_list[MAX_BEARERS], &bcbearer->bearer); |
971 | bcl->state = WORKING_WORKING; | 976 | bcl->state = WORKING_WORKING; |
972 | strlcpy(bcl->name, tipc_bclink_name, TIPC_MAX_LINK_NAME); | 977 | strlcpy(bcl->name, tipc_bclink_name, TIPC_MAX_LINK_NAME); |
973 | return 0; | 978 | return 0; |
974 | } | 979 | } |
975 | 980 | ||
976 | void tipc_bclink_stop(void) | 981 | void tipc_bclink_stop(struct net *net) |
977 | { | 982 | { |
983 | struct tipc_net *tn = net_generic(net, tipc_net_id); | ||
984 | |||
978 | tipc_bclink_lock(); | 985 | tipc_bclink_lock(); |
979 | tipc_link_purge_queues(bcl); | 986 | tipc_link_purge_queues(bcl); |
980 | tipc_bclink_unlock(); | 987 | tipc_bclink_unlock(); |
981 | 988 | ||
982 | RCU_INIT_POINTER(bearer_list[BCBEARER], NULL); | 989 | RCU_INIT_POINTER(tn->bearer_list[BCBEARER], NULL); |
983 | synchronize_net(); | 990 | synchronize_net(); |
984 | kfree(bcbearer); | 991 | kfree(bcbearer); |
985 | kfree(bclink); | 992 | kfree(bclink); |
diff --git a/net/tipc/bcast.h b/net/tipc/bcast.h index fd0d17a76493..692efb662253 100644 --- a/net/tipc/bcast.h +++ b/net/tipc/bcast.h | |||
@@ -84,8 +84,8 @@ static inline int tipc_nmap_equal(struct tipc_node_map *nm_a, | |||
84 | void tipc_port_list_add(struct tipc_port_list *pl_ptr, u32 port); | 84 | void tipc_port_list_add(struct tipc_port_list *pl_ptr, u32 port); |
85 | void tipc_port_list_free(struct tipc_port_list *pl_ptr); | 85 | void tipc_port_list_free(struct tipc_port_list *pl_ptr); |
86 | 86 | ||
87 | int tipc_bclink_init(void); | 87 | int tipc_bclink_init(struct net *net); |
88 | void tipc_bclink_stop(void); | 88 | void tipc_bclink_stop(struct net *net); |
89 | void tipc_bclink_set_flags(unsigned int flags); | 89 | void tipc_bclink_set_flags(unsigned int flags); |
90 | void tipc_bclink_add_node(u32 addr); | 90 | void tipc_bclink_add_node(u32 addr); |
91 | void tipc_bclink_remove_node(u32 addr); | 91 | void tipc_bclink_remove_node(u32 addr); |
@@ -99,7 +99,8 @@ void tipc_bclink_update_link_state(struct net *net, struct tipc_node *n_ptr, | |||
99 | int tipc_bclink_stats(char *stats_buf, const u32 buf_size); | 99 | int tipc_bclink_stats(char *stats_buf, const u32 buf_size); |
100 | int tipc_bclink_reset_stats(void); | 100 | int tipc_bclink_reset_stats(void); |
101 | int tipc_bclink_set_queue_limits(u32 limit); | 101 | int tipc_bclink_set_queue_limits(u32 limit); |
102 | void tipc_bcbearer_sort(struct tipc_node_map *nm_ptr, u32 node, bool action); | 102 | void tipc_bcbearer_sort(struct net *net, struct tipc_node_map *nm_ptr, |
103 | u32 node, bool action); | ||
103 | uint tipc_bclink_get_mtu(void); | 104 | uint tipc_bclink_get_mtu(void); |
104 | int tipc_bclink_xmit(struct net *net, struct sk_buff_head *list); | 105 | int tipc_bclink_xmit(struct net *net, struct sk_buff_head *list); |
105 | void tipc_bclink_wakeup_users(struct net *net); | 106 | void tipc_bclink_wakeup_users(struct net *net); |
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c index a735c08e9d90..2fe9dcb418d4 100644 --- a/net/tipc/bearer.c +++ b/net/tipc/bearer.c | |||
@@ -34,6 +34,7 @@ | |||
34 | * POSSIBILITY OF SUCH DAMAGE. | 34 | * POSSIBILITY OF SUCH DAMAGE. |
35 | */ | 35 | */ |
36 | 36 | ||
37 | #include <net/sock.h> | ||
37 | #include "core.h" | 38 | #include "core.h" |
38 | #include "config.h" | 39 | #include "config.h" |
39 | #include "bearer.h" | 40 | #include "bearer.h" |
@@ -67,8 +68,6 @@ static const struct nla_policy tipc_nl_media_policy[TIPC_NLA_MEDIA_MAX + 1] = { | |||
67 | [TIPC_NLA_MEDIA_PROP] = { .type = NLA_NESTED } | 68 | [TIPC_NLA_MEDIA_PROP] = { .type = NLA_NESTED } |
68 | }; | 69 | }; |
69 | 70 | ||
70 | struct tipc_bearer __rcu *bearer_list[MAX_BEARERS + 1]; | ||
71 | |||
72 | static void bearer_disable(struct net *net, struct tipc_bearer *b_ptr, | 71 | static void bearer_disable(struct net *net, struct tipc_bearer *b_ptr, |
73 | bool shutting_down); | 72 | bool shutting_down); |
74 | 73 | ||
@@ -191,13 +190,14 @@ static int bearer_name_validate(const char *name, | |||
191 | /** | 190 | /** |
192 | * tipc_bearer_find - locates bearer object with matching bearer name | 191 | * tipc_bearer_find - locates bearer object with matching bearer name |
193 | */ | 192 | */ |
194 | struct tipc_bearer *tipc_bearer_find(const char *name) | 193 | struct tipc_bearer *tipc_bearer_find(struct net *net, const char *name) |
195 | { | 194 | { |
195 | struct tipc_net *tn = net_generic(net, tipc_net_id); | ||
196 | struct tipc_bearer *b_ptr; | 196 | struct tipc_bearer *b_ptr; |
197 | u32 i; | 197 | u32 i; |
198 | 198 | ||
199 | for (i = 0; i < MAX_BEARERS; i++) { | 199 | for (i = 0; i < MAX_BEARERS; i++) { |
200 | b_ptr = rtnl_dereference(bearer_list[i]); | 200 | b_ptr = rtnl_dereference(tn->bearer_list[i]); |
201 | if (b_ptr && (!strcmp(b_ptr->name, name))) | 201 | if (b_ptr && (!strcmp(b_ptr->name, name))) |
202 | return b_ptr; | 202 | return b_ptr; |
203 | } | 203 | } |
@@ -207,8 +207,9 @@ struct tipc_bearer *tipc_bearer_find(const char *name) | |||
207 | /** | 207 | /** |
208 | * tipc_bearer_get_names - record names of bearers in buffer | 208 | * tipc_bearer_get_names - record names of bearers in buffer |
209 | */ | 209 | */ |
210 | struct sk_buff *tipc_bearer_get_names(void) | 210 | struct sk_buff *tipc_bearer_get_names(struct net *net) |
211 | { | 211 | { |
212 | struct tipc_net *tn = net_generic(net, tipc_net_id); | ||
212 | struct sk_buff *buf; | 213 | struct sk_buff *buf; |
213 | struct tipc_bearer *b; | 214 | struct tipc_bearer *b; |
214 | int i, j; | 215 | int i, j; |
@@ -219,7 +220,7 @@ struct sk_buff *tipc_bearer_get_names(void) | |||
219 | 220 | ||
220 | for (i = 0; media_info_array[i] != NULL; i++) { | 221 | for (i = 0; media_info_array[i] != NULL; i++) { |
221 | for (j = 0; j < MAX_BEARERS; j++) { | 222 | for (j = 0; j < MAX_BEARERS; j++) { |
222 | b = rtnl_dereference(bearer_list[j]); | 223 | b = rtnl_dereference(tn->bearer_list[j]); |
223 | if (!b) | 224 | if (!b) |
224 | continue; | 225 | continue; |
225 | if (b->media == media_info_array[i]) { | 226 | if (b->media == media_info_array[i]) { |
@@ -232,27 +233,29 @@ struct sk_buff *tipc_bearer_get_names(void) | |||
232 | return buf; | 233 | return buf; |
233 | } | 234 | } |
234 | 235 | ||
235 | void tipc_bearer_add_dest(u32 bearer_id, u32 dest) | 236 | void tipc_bearer_add_dest(struct net *net, u32 bearer_id, u32 dest) |
236 | { | 237 | { |
238 | struct tipc_net *tn = net_generic(net, tipc_net_id); | ||
237 | struct tipc_bearer *b_ptr; | 239 | struct tipc_bearer *b_ptr; |
238 | 240 | ||
239 | rcu_read_lock(); | 241 | rcu_read_lock(); |
240 | b_ptr = rcu_dereference_rtnl(bearer_list[bearer_id]); | 242 | b_ptr = rcu_dereference_rtnl(tn->bearer_list[bearer_id]); |
241 | if (b_ptr) { | 243 | if (b_ptr) { |
242 | tipc_bcbearer_sort(&b_ptr->nodes, dest, true); | 244 | tipc_bcbearer_sort(net, &b_ptr->nodes, dest, true); |
243 | tipc_disc_add_dest(b_ptr->link_req); | 245 | tipc_disc_add_dest(b_ptr->link_req); |
244 | } | 246 | } |
245 | rcu_read_unlock(); | 247 | rcu_read_unlock(); |
246 | } | 248 | } |
247 | 249 | ||
248 | void tipc_bearer_remove_dest(u32 bearer_id, u32 dest) | 250 | void tipc_bearer_remove_dest(struct net *net, u32 bearer_id, u32 dest) |
249 | { | 251 | { |
252 | struct tipc_net *tn = net_generic(net, tipc_net_id); | ||
250 | struct tipc_bearer *b_ptr; | 253 | struct tipc_bearer *b_ptr; |
251 | 254 | ||
252 | rcu_read_lock(); | 255 | rcu_read_lock(); |
253 | b_ptr = rcu_dereference_rtnl(bearer_list[bearer_id]); | 256 | b_ptr = rcu_dereference_rtnl(tn->bearer_list[bearer_id]); |
254 | if (b_ptr) { | 257 | if (b_ptr) { |
255 | tipc_bcbearer_sort(&b_ptr->nodes, dest, false); | 258 | tipc_bcbearer_sort(net, &b_ptr->nodes, dest, false); |
256 | tipc_disc_remove_dest(b_ptr->link_req); | 259 | tipc_disc_remove_dest(b_ptr->link_req); |
257 | } | 260 | } |
258 | rcu_read_unlock(); | 261 | rcu_read_unlock(); |
@@ -264,6 +267,7 @@ void tipc_bearer_remove_dest(u32 bearer_id, u32 dest) | |||
264 | int tipc_enable_bearer(struct net *net, const char *name, u32 disc_domain, | 267 | int tipc_enable_bearer(struct net *net, const char *name, u32 disc_domain, |
265 | u32 priority) | 268 | u32 priority) |
266 | { | 269 | { |
270 | struct tipc_net *tn = net_generic(net, tipc_net_id); | ||
267 | struct tipc_bearer *b_ptr; | 271 | struct tipc_bearer *b_ptr; |
268 | struct tipc_media *m_ptr; | 272 | struct tipc_media *m_ptr; |
269 | struct tipc_bearer_names b_names; | 273 | struct tipc_bearer_names b_names; |
@@ -315,7 +319,7 @@ restart: | |||
315 | bearer_id = MAX_BEARERS; | 319 | bearer_id = MAX_BEARERS; |
316 | with_this_prio = 1; | 320 | with_this_prio = 1; |
317 | for (i = MAX_BEARERS; i-- != 0; ) { | 321 | for (i = MAX_BEARERS; i-- != 0; ) { |
318 | b_ptr = rtnl_dereference(bearer_list[i]); | 322 | b_ptr = rtnl_dereference(tn->bearer_list[i]); |
319 | if (!b_ptr) { | 323 | if (!b_ptr) { |
320 | bearer_id = i; | 324 | bearer_id = i; |
321 | continue; | 325 | continue; |
@@ -349,7 +353,7 @@ restart: | |||
349 | 353 | ||
350 | strcpy(b_ptr->name, name); | 354 | strcpy(b_ptr->name, name); |
351 | b_ptr->media = m_ptr; | 355 | b_ptr->media = m_ptr; |
352 | res = m_ptr->enable_media(b_ptr); | 356 | res = m_ptr->enable_media(net, b_ptr); |
353 | if (res) { | 357 | if (res) { |
354 | pr_warn("Bearer <%s> rejected, enable failure (%d)\n", | 358 | pr_warn("Bearer <%s> rejected, enable failure (%d)\n", |
355 | name, -res); | 359 | name, -res); |
@@ -371,7 +375,7 @@ restart: | |||
371 | return -EINVAL; | 375 | return -EINVAL; |
372 | } | 376 | } |
373 | 377 | ||
374 | rcu_assign_pointer(bearer_list[bearer_id], b_ptr); | 378 | rcu_assign_pointer(tn->bearer_list[bearer_id], b_ptr); |
375 | 379 | ||
376 | pr_info("Enabled bearer <%s>, discovery domain %s, priority %u\n", | 380 | pr_info("Enabled bearer <%s>, discovery domain %s, priority %u\n", |
377 | name, | 381 | name, |
@@ -398,6 +402,7 @@ static int tipc_reset_bearer(struct net *net, struct tipc_bearer *b_ptr) | |||
398 | static void bearer_disable(struct net *net, struct tipc_bearer *b_ptr, | 402 | static void bearer_disable(struct net *net, struct tipc_bearer *b_ptr, |
399 | bool shutting_down) | 403 | bool shutting_down) |
400 | { | 404 | { |
405 | struct tipc_net *tn = net_generic(net, tipc_net_id); | ||
401 | u32 i; | 406 | u32 i; |
402 | 407 | ||
403 | pr_info("Disabling bearer <%s>\n", b_ptr->name); | 408 | pr_info("Disabling bearer <%s>\n", b_ptr->name); |
@@ -408,8 +413,8 @@ static void bearer_disable(struct net *net, struct tipc_bearer *b_ptr, | |||
408 | tipc_disc_delete(b_ptr->link_req); | 413 | tipc_disc_delete(b_ptr->link_req); |
409 | 414 | ||
410 | for (i = 0; i < MAX_BEARERS; i++) { | 415 | for (i = 0; i < MAX_BEARERS; i++) { |
411 | if (b_ptr == rtnl_dereference(bearer_list[i])) { | 416 | if (b_ptr == rtnl_dereference(tn->bearer_list[i])) { |
412 | RCU_INIT_POINTER(bearer_list[i], NULL); | 417 | RCU_INIT_POINTER(tn->bearer_list[i], NULL); |
413 | break; | 418 | break; |
414 | } | 419 | } |
415 | } | 420 | } |
@@ -421,7 +426,7 @@ int tipc_disable_bearer(struct net *net, const char *name) | |||
421 | struct tipc_bearer *b_ptr; | 426 | struct tipc_bearer *b_ptr; |
422 | int res; | 427 | int res; |
423 | 428 | ||
424 | b_ptr = tipc_bearer_find(name); | 429 | b_ptr = tipc_bearer_find(net, name); |
425 | if (b_ptr == NULL) { | 430 | if (b_ptr == NULL) { |
426 | pr_warn("Attempt to disable unknown bearer <%s>\n", name); | 431 | pr_warn("Attempt to disable unknown bearer <%s>\n", name); |
427 | res = -EINVAL; | 432 | res = -EINVAL; |
@@ -432,13 +437,13 @@ int tipc_disable_bearer(struct net *net, const char *name) | |||
432 | return res; | 437 | return res; |
433 | } | 438 | } |
434 | 439 | ||
435 | int tipc_enable_l2_media(struct tipc_bearer *b) | 440 | int tipc_enable_l2_media(struct net *net, struct tipc_bearer *b) |
436 | { | 441 | { |
437 | struct net_device *dev; | 442 | struct net_device *dev; |
438 | char *driver_name = strchr((const char *)b->name, ':') + 1; | 443 | char *driver_name = strchr((const char *)b->name, ':') + 1; |
439 | 444 | ||
440 | /* Find device with specified name */ | 445 | /* Find device with specified name */ |
441 | dev = dev_get_by_name(&init_net, driver_name); | 446 | dev = dev_get_by_name(net, driver_name); |
442 | if (!dev) | 447 | if (!dev) |
443 | return -ENODEV; | 448 | return -ENODEV; |
444 | 449 | ||
@@ -514,13 +519,14 @@ int tipc_l2_send_msg(struct sk_buff *buf, struct tipc_bearer *b, | |||
514 | * The media send routine must not alter the buffer being passed in | 519 | * The media send routine must not alter the buffer being passed in |
515 | * as it may be needed for later retransmission! | 520 | * as it may be needed for later retransmission! |
516 | */ | 521 | */ |
517 | void tipc_bearer_send(u32 bearer_id, struct sk_buff *buf, | 522 | void tipc_bearer_send(struct net *net, u32 bearer_id, struct sk_buff *buf, |
518 | struct tipc_media_addr *dest) | 523 | struct tipc_media_addr *dest) |
519 | { | 524 | { |
525 | struct tipc_net *tn = net_generic(net, tipc_net_id); | ||
520 | struct tipc_bearer *b_ptr; | 526 | struct tipc_bearer *b_ptr; |
521 | 527 | ||
522 | rcu_read_lock(); | 528 | rcu_read_lock(); |
523 | b_ptr = rcu_dereference_rtnl(bearer_list[bearer_id]); | 529 | b_ptr = rcu_dereference_rtnl(tn->bearer_list[bearer_id]); |
524 | if (likely(b_ptr)) | 530 | if (likely(b_ptr)) |
525 | b_ptr->media->send_msg(buf, b_ptr, dest); | 531 | b_ptr->media->send_msg(buf, b_ptr, dest); |
526 | rcu_read_unlock(); | 532 | rcu_read_unlock(); |
@@ -630,14 +636,15 @@ void tipc_bearer_cleanup(void) | |||
630 | 636 | ||
631 | void tipc_bearer_stop(struct net *net) | 637 | void tipc_bearer_stop(struct net *net) |
632 | { | 638 | { |
639 | struct tipc_net *tn = net_generic(net, tipc_net_id); | ||
633 | struct tipc_bearer *b_ptr; | 640 | struct tipc_bearer *b_ptr; |
634 | u32 i; | 641 | u32 i; |
635 | 642 | ||
636 | for (i = 0; i < MAX_BEARERS; i++) { | 643 | for (i = 0; i < MAX_BEARERS; i++) { |
637 | b_ptr = rtnl_dereference(bearer_list[i]); | 644 | b_ptr = rtnl_dereference(tn->bearer_list[i]); |
638 | if (b_ptr) { | 645 | if (b_ptr) { |
639 | bearer_disable(net, b_ptr, true); | 646 | bearer_disable(net, b_ptr, true); |
640 | bearer_list[i] = NULL; | 647 | tn->bearer_list[i] = NULL; |
641 | } | 648 | } |
642 | } | 649 | } |
643 | } | 650 | } |
@@ -694,6 +701,8 @@ int tipc_nl_bearer_dump(struct sk_buff *skb, struct netlink_callback *cb) | |||
694 | int i = cb->args[0]; | 701 | int i = cb->args[0]; |
695 | struct tipc_bearer *bearer; | 702 | struct tipc_bearer *bearer; |
696 | struct tipc_nl_msg msg; | 703 | struct tipc_nl_msg msg; |
704 | struct net *net = sock_net(skb->sk); | ||
705 | struct tipc_net *tn = net_generic(net, tipc_net_id); | ||
697 | 706 | ||
698 | if (i == MAX_BEARERS) | 707 | if (i == MAX_BEARERS) |
699 | return 0; | 708 | return 0; |
@@ -704,7 +713,7 @@ int tipc_nl_bearer_dump(struct sk_buff *skb, struct netlink_callback *cb) | |||
704 | 713 | ||
705 | rtnl_lock(); | 714 | rtnl_lock(); |
706 | for (i = 0; i < MAX_BEARERS; i++) { | 715 | for (i = 0; i < MAX_BEARERS; i++) { |
707 | bearer = rtnl_dereference(bearer_list[i]); | 716 | bearer = rtnl_dereference(tn->bearer_list[i]); |
708 | if (!bearer) | 717 | if (!bearer) |
709 | continue; | 718 | continue; |
710 | 719 | ||
@@ -726,6 +735,7 @@ int tipc_nl_bearer_get(struct sk_buff *skb, struct genl_info *info) | |||
726 | struct tipc_bearer *bearer; | 735 | struct tipc_bearer *bearer; |
727 | struct tipc_nl_msg msg; | 736 | struct tipc_nl_msg msg; |
728 | struct nlattr *attrs[TIPC_NLA_BEARER_MAX + 1]; | 737 | struct nlattr *attrs[TIPC_NLA_BEARER_MAX + 1]; |
738 | struct net *net = genl_info_net(info); | ||
729 | 739 | ||
730 | if (!info->attrs[TIPC_NLA_BEARER]) | 740 | if (!info->attrs[TIPC_NLA_BEARER]) |
731 | return -EINVAL; | 741 | return -EINVAL; |
@@ -749,7 +759,7 @@ int tipc_nl_bearer_get(struct sk_buff *skb, struct genl_info *info) | |||
749 | msg.seq = info->snd_seq; | 759 | msg.seq = info->snd_seq; |
750 | 760 | ||
751 | rtnl_lock(); | 761 | rtnl_lock(); |
752 | bearer = tipc_bearer_find(name); | 762 | bearer = tipc_bearer_find(net, name); |
753 | if (!bearer) { | 763 | if (!bearer) { |
754 | err = -EINVAL; | 764 | err = -EINVAL; |
755 | goto err_out; | 765 | goto err_out; |
@@ -791,7 +801,7 @@ int tipc_nl_bearer_disable(struct sk_buff *skb, struct genl_info *info) | |||
791 | name = nla_data(attrs[TIPC_NLA_BEARER_NAME]); | 801 | name = nla_data(attrs[TIPC_NLA_BEARER_NAME]); |
792 | 802 | ||
793 | rtnl_lock(); | 803 | rtnl_lock(); |
794 | bearer = tipc_bearer_find(name); | 804 | bearer = tipc_bearer_find(net, name); |
795 | if (!bearer) { | 805 | if (!bearer) { |
796 | rtnl_unlock(); | 806 | rtnl_unlock(); |
797 | return -EINVAL; | 807 | return -EINVAL; |
@@ -861,6 +871,7 @@ int tipc_nl_bearer_set(struct sk_buff *skb, struct genl_info *info) | |||
861 | char *name; | 871 | char *name; |
862 | struct tipc_bearer *b; | 872 | struct tipc_bearer *b; |
863 | struct nlattr *attrs[TIPC_NLA_BEARER_MAX + 1]; | 873 | struct nlattr *attrs[TIPC_NLA_BEARER_MAX + 1]; |
874 | struct net *net = genl_info_net(info); | ||
864 | 875 | ||
865 | if (!info->attrs[TIPC_NLA_BEARER]) | 876 | if (!info->attrs[TIPC_NLA_BEARER]) |
866 | return -EINVAL; | 877 | return -EINVAL; |
@@ -876,7 +887,7 @@ int tipc_nl_bearer_set(struct sk_buff *skb, struct genl_info *info) | |||
876 | name = nla_data(attrs[TIPC_NLA_BEARER_NAME]); | 887 | name = nla_data(attrs[TIPC_NLA_BEARER_NAME]); |
877 | 888 | ||
878 | rtnl_lock(); | 889 | rtnl_lock(); |
879 | b = tipc_bearer_find(name); | 890 | b = tipc_bearer_find(net, name); |
880 | if (!b) { | 891 | if (!b) { |
881 | rtnl_unlock(); | 892 | rtnl_unlock(); |
882 | return -EINVAL; | 893 | return -EINVAL; |
diff --git a/net/tipc/bearer.h b/net/tipc/bearer.h index 91a8eeea309c..01722d6b2058 100644 --- a/net/tipc/bearer.h +++ b/net/tipc/bearer.h | |||
@@ -92,7 +92,7 @@ struct tipc_media { | |||
92 | int (*send_msg)(struct sk_buff *buf, | 92 | int (*send_msg)(struct sk_buff *buf, |
93 | struct tipc_bearer *b_ptr, | 93 | struct tipc_bearer *b_ptr, |
94 | struct tipc_media_addr *dest); | 94 | struct tipc_media_addr *dest); |
95 | int (*enable_media)(struct tipc_bearer *b_ptr); | 95 | int (*enable_media)(struct net *net, struct tipc_bearer *b_ptr); |
96 | void (*disable_media)(struct tipc_bearer *b_ptr); | 96 | void (*disable_media)(struct tipc_bearer *b_ptr); |
97 | int (*addr2str)(struct tipc_media_addr *addr, | 97 | int (*addr2str)(struct tipc_media_addr *addr, |
98 | char *strbuf, | 98 | char *strbuf, |
@@ -159,8 +159,6 @@ struct tipc_bearer_names { | |||
159 | 159 | ||
160 | struct tipc_link; | 160 | struct tipc_link; |
161 | 161 | ||
162 | extern struct tipc_bearer __rcu *bearer_list[]; | ||
163 | |||
164 | /* | 162 | /* |
165 | * TIPC routines available to supported media types | 163 | * TIPC routines available to supported media types |
166 | */ | 164 | */ |
@@ -193,20 +191,20 @@ int tipc_media_set_priority(const char *name, u32 new_value); | |||
193 | int tipc_media_set_window(const char *name, u32 new_value); | 191 | int tipc_media_set_window(const char *name, u32 new_value); |
194 | void tipc_media_addr_printf(char *buf, int len, struct tipc_media_addr *a); | 192 | void tipc_media_addr_printf(char *buf, int len, struct tipc_media_addr *a); |
195 | struct sk_buff *tipc_media_get_names(void); | 193 | struct sk_buff *tipc_media_get_names(void); |
196 | int tipc_enable_l2_media(struct tipc_bearer *b); | 194 | int tipc_enable_l2_media(struct net *net, struct tipc_bearer *b); |
197 | void tipc_disable_l2_media(struct tipc_bearer *b); | 195 | void tipc_disable_l2_media(struct tipc_bearer *b); |
198 | int tipc_l2_send_msg(struct sk_buff *buf, struct tipc_bearer *b, | 196 | int tipc_l2_send_msg(struct sk_buff *buf, struct tipc_bearer *b, |
199 | struct tipc_media_addr *dest); | 197 | struct tipc_media_addr *dest); |
200 | 198 | ||
201 | struct sk_buff *tipc_bearer_get_names(void); | 199 | struct sk_buff *tipc_bearer_get_names(struct net *net); |
202 | void tipc_bearer_add_dest(u32 bearer_id, u32 dest); | 200 | void tipc_bearer_add_dest(struct net *net, u32 bearer_id, u32 dest); |
203 | void tipc_bearer_remove_dest(u32 bearer_id, u32 dest); | 201 | void tipc_bearer_remove_dest(struct net *net, u32 bearer_id, u32 dest); |
204 | struct tipc_bearer *tipc_bearer_find(const char *name); | 202 | struct tipc_bearer *tipc_bearer_find(struct net *net, const char *name); |
205 | struct tipc_media *tipc_media_find(const char *name); | 203 | struct tipc_media *tipc_media_find(const char *name); |
206 | int tipc_bearer_setup(void); | 204 | int tipc_bearer_setup(void); |
207 | void tipc_bearer_cleanup(void); | 205 | void tipc_bearer_cleanup(void); |
208 | void tipc_bearer_stop(struct net *net); | 206 | void tipc_bearer_stop(struct net *net); |
209 | void tipc_bearer_send(u32 bearer_id, struct sk_buff *buf, | 207 | void tipc_bearer_send(struct net *net, u32 bearer_id, struct sk_buff *buf, |
210 | struct tipc_media_addr *dest); | 208 | struct tipc_media_addr *dest); |
211 | 209 | ||
212 | #endif /* _TIPC_BEARER_H */ | 210 | #endif /* _TIPC_BEARER_H */ |
diff --git a/net/tipc/config.c b/net/tipc/config.c index cf2d417ad488..ac73291d0d32 100644 --- a/net/tipc/config.c +++ b/net/tipc/config.c | |||
@@ -251,7 +251,7 @@ struct sk_buff *tipc_cfg_do_cmd(struct net *net, u32 orig_node, u16 cmd, | |||
251 | rep_tlv_buf = tipc_nametbl_get(req_tlv_area, req_tlv_space); | 251 | rep_tlv_buf = tipc_nametbl_get(req_tlv_area, req_tlv_space); |
252 | break; | 252 | break; |
253 | case TIPC_CMD_GET_BEARER_NAMES: | 253 | case TIPC_CMD_GET_BEARER_NAMES: |
254 | rep_tlv_buf = tipc_bearer_get_names(); | 254 | rep_tlv_buf = tipc_bearer_get_names(net); |
255 | break; | 255 | break; |
256 | case TIPC_CMD_GET_MEDIA_NAMES: | 256 | case TIPC_CMD_GET_MEDIA_NAMES: |
257 | rep_tlv_buf = tipc_media_get_names(); | 257 | rep_tlv_buf = tipc_media_get_names(); |
diff --git a/net/tipc/core.h b/net/tipc/core.h index 4fb113397e7b..75a332b1968e 100644 --- a/net/tipc/core.h +++ b/net/tipc/core.h | |||
@@ -60,6 +60,7 @@ | |||
60 | #include <net/netns/generic.h> | 60 | #include <net/netns/generic.h> |
61 | 61 | ||
62 | #include "node.h" | 62 | #include "node.h" |
63 | #include "bearer.h" | ||
63 | 64 | ||
64 | #define TIPC_MOD_VER "2.0.0" | 65 | #define TIPC_MOD_VER "2.0.0" |
65 | 66 | ||
@@ -87,6 +88,9 @@ struct tipc_net { | |||
87 | struct list_head node_list; | 88 | struct list_head node_list; |
88 | u32 num_nodes; | 89 | u32 num_nodes; |
89 | u32 num_links; | 90 | u32 num_links; |
91 | |||
92 | /* Bearer list */ | ||
93 | struct tipc_bearer __rcu *bearer_list[MAX_BEARERS + 1]; | ||
90 | }; | 94 | }; |
91 | 95 | ||
92 | #ifdef CONFIG_SYSCTL | 96 | #ifdef CONFIG_SYSCTL |
diff --git a/net/tipc/discover.c b/net/tipc/discover.c index f0fd8b449aef..f93dd3dd621b 100644 --- a/net/tipc/discover.c +++ b/net/tipc/discover.c | |||
@@ -51,6 +51,7 @@ | |||
51 | /** | 51 | /** |
52 | * struct tipc_link_req - information about an ongoing link setup request | 52 | * struct tipc_link_req - information about an ongoing link setup request |
53 | * @bearer_id: identity of bearer issuing requests | 53 | * @bearer_id: identity of bearer issuing requests |
54 | * @net: network namespace instance | ||
54 | * @dest: destination address for request messages | 55 | * @dest: destination address for request messages |
55 | * @domain: network domain to which links can be established | 56 | * @domain: network domain to which links can be established |
56 | * @num_nodes: number of nodes currently discovered (i.e. with an active link) | 57 | * @num_nodes: number of nodes currently discovered (i.e. with an active link) |
@@ -62,6 +63,7 @@ | |||
62 | struct tipc_link_req { | 63 | struct tipc_link_req { |
63 | u32 bearer_id; | 64 | u32 bearer_id; |
64 | struct tipc_media_addr dest; | 65 | struct tipc_media_addr dest; |
66 | struct net *net; | ||
65 | u32 domain; | 67 | u32 domain; |
66 | int num_nodes; | 68 | int num_nodes; |
67 | spinlock_t lock; | 69 | spinlock_t lock; |
@@ -254,7 +256,7 @@ void tipc_disc_rcv(struct net *net, struct sk_buff *buf, | |||
254 | rbuf = tipc_buf_acquire(INT_H_SIZE); | 256 | rbuf = tipc_buf_acquire(INT_H_SIZE); |
255 | if (rbuf) { | 257 | if (rbuf) { |
256 | tipc_disc_init_msg(net, rbuf, DSC_RESP_MSG, bearer); | 258 | tipc_disc_init_msg(net, rbuf, DSC_RESP_MSG, bearer); |
257 | tipc_bearer_send(bearer->identity, rbuf, &maddr); | 259 | tipc_bearer_send(net, bearer->identity, rbuf, &maddr); |
258 | kfree_skb(rbuf); | 260 | kfree_skb(rbuf); |
259 | } | 261 | } |
260 | } | 262 | } |
@@ -328,7 +330,7 @@ static void disc_timeout(unsigned long data) | |||
328 | * hold at fast polling rate if don't have any associated nodes, | 330 | * hold at fast polling rate if don't have any associated nodes, |
329 | * otherwise hold at slow polling rate | 331 | * otherwise hold at slow polling rate |
330 | */ | 332 | */ |
331 | tipc_bearer_send(req->bearer_id, req->buf, &req->dest); | 333 | tipc_bearer_send(req->net, req->bearer_id, req->buf, &req->dest); |
332 | 334 | ||
333 | 335 | ||
334 | req->timer_intv *= 2; | 336 | req->timer_intv *= 2; |
@@ -370,6 +372,7 @@ int tipc_disc_create(struct net *net, struct tipc_bearer *b_ptr, | |||
370 | 372 | ||
371 | tipc_disc_init_msg(net, req->buf, DSC_REQ_MSG, b_ptr); | 373 | tipc_disc_init_msg(net, req->buf, DSC_REQ_MSG, b_ptr); |
372 | memcpy(&req->dest, dest, sizeof(*dest)); | 374 | memcpy(&req->dest, dest, sizeof(*dest)); |
375 | req->net = net; | ||
373 | req->bearer_id = b_ptr->identity; | 376 | req->bearer_id = b_ptr->identity; |
374 | req->domain = b_ptr->domain; | 377 | req->domain = b_ptr->domain; |
375 | req->num_nodes = 0; | 378 | req->num_nodes = 0; |
@@ -378,7 +381,7 @@ int tipc_disc_create(struct net *net, struct tipc_bearer *b_ptr, | |||
378 | setup_timer(&req->timer, disc_timeout, (unsigned long)req); | 381 | setup_timer(&req->timer, disc_timeout, (unsigned long)req); |
379 | mod_timer(&req->timer, jiffies + req->timer_intv); | 382 | mod_timer(&req->timer, jiffies + req->timer_intv); |
380 | b_ptr->link_req = req; | 383 | b_ptr->link_req = req; |
381 | tipc_bearer_send(req->bearer_id, req->buf, &req->dest); | 384 | tipc_bearer_send(net, req->bearer_id, req->buf, &req->dest); |
382 | return 0; | 385 | return 0; |
383 | } | 386 | } |
384 | 387 | ||
@@ -405,11 +408,12 @@ void tipc_disc_reset(struct net *net, struct tipc_bearer *b_ptr) | |||
405 | 408 | ||
406 | spin_lock_bh(&req->lock); | 409 | spin_lock_bh(&req->lock); |
407 | tipc_disc_init_msg(net, req->buf, DSC_REQ_MSG, b_ptr); | 410 | tipc_disc_init_msg(net, req->buf, DSC_REQ_MSG, b_ptr); |
411 | req->net = net; | ||
408 | req->bearer_id = b_ptr->identity; | 412 | req->bearer_id = b_ptr->identity; |
409 | req->domain = b_ptr->domain; | 413 | req->domain = b_ptr->domain; |
410 | req->num_nodes = 0; | 414 | req->num_nodes = 0; |
411 | req->timer_intv = TIPC_LINK_REQ_INIT; | 415 | req->timer_intv = TIPC_LINK_REQ_INIT; |
412 | mod_timer(&req->timer, jiffies + req->timer_intv); | 416 | mod_timer(&req->timer, jiffies + req->timer_intv); |
413 | tipc_bearer_send(req->bearer_id, req->buf, &req->dest); | 417 | tipc_bearer_send(net, req->bearer_id, req->buf, &req->dest); |
414 | spin_unlock_bh(&req->lock); | 418 | spin_unlock_bh(&req->lock); |
415 | } | 419 | } |
diff --git a/net/tipc/link.c b/net/tipc/link.c index f6505652742e..be21e6ac73fe 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c | |||
@@ -129,11 +129,13 @@ static unsigned int align(unsigned int i) | |||
129 | 129 | ||
130 | static void link_init_max_pkt(struct tipc_link *l_ptr) | 130 | static void link_init_max_pkt(struct tipc_link *l_ptr) |
131 | { | 131 | { |
132 | struct tipc_node *node = l_ptr->owner; | ||
133 | struct tipc_net *tn = net_generic(node->net, tipc_net_id); | ||
132 | struct tipc_bearer *b_ptr; | 134 | struct tipc_bearer *b_ptr; |
133 | u32 max_pkt; | 135 | u32 max_pkt; |
134 | 136 | ||
135 | rcu_read_lock(); | 137 | rcu_read_lock(); |
136 | b_ptr = rcu_dereference_rtnl(bearer_list[l_ptr->bearer_id]); | 138 | b_ptr = rcu_dereference_rtnl(tn->bearer_list[l_ptr->bearer_id]); |
137 | if (!b_ptr) { | 139 | if (!b_ptr) { |
138 | rcu_read_unlock(); | 140 | rcu_read_unlock(); |
139 | return; | 141 | return; |
@@ -431,7 +433,7 @@ void tipc_link_reset(struct tipc_link *l_ptr) | |||
431 | return; | 433 | return; |
432 | 434 | ||
433 | tipc_node_link_down(l_ptr->owner, l_ptr); | 435 | tipc_node_link_down(l_ptr->owner, l_ptr); |
434 | tipc_bearer_remove_dest(l_ptr->bearer_id, l_ptr->addr); | 436 | tipc_bearer_remove_dest(owner->net, l_ptr->bearer_id, l_ptr->addr); |
435 | 437 | ||
436 | if (was_active_link && tipc_node_active_links(l_ptr->owner)) { | 438 | if (was_active_link && tipc_node_active_links(l_ptr->owner)) { |
437 | l_ptr->reset_checkpoint = checkpoint; | 439 | l_ptr->reset_checkpoint = checkpoint; |
@@ -471,11 +473,14 @@ void tipc_link_reset_list(struct net *net, unsigned int bearer_id) | |||
471 | rcu_read_unlock(); | 473 | rcu_read_unlock(); |
472 | } | 474 | } |
473 | 475 | ||
474 | static void link_activate(struct tipc_link *l_ptr) | 476 | static void link_activate(struct tipc_link *link) |
475 | { | 477 | { |
476 | l_ptr->next_in_no = l_ptr->stats.recv_info = 1; | 478 | struct tipc_node *node = link->owner; |
477 | tipc_node_link_up(l_ptr->owner, l_ptr); | 479 | |
478 | tipc_bearer_add_dest(l_ptr->bearer_id, l_ptr->addr); | 480 | link->next_in_no = 1; |
481 | link->stats.recv_info = 1; | ||
482 | tipc_node_link_up(node, link); | ||
483 | tipc_bearer_add_dest(node->net, link->bearer_id, link->addr); | ||
479 | } | 484 | } |
480 | 485 | ||
481 | /** | 486 | /** |
@@ -707,7 +712,8 @@ drop: | |||
707 | * Only the socket functions tipc_send_stream() and tipc_send_packet() need | 712 | * Only the socket functions tipc_send_stream() and tipc_send_packet() need |
708 | * to act on the return value, since they may need to do more send attempts. | 713 | * to act on the return value, since they may need to do more send attempts. |
709 | */ | 714 | */ |
710 | int __tipc_link_xmit(struct tipc_link *link, struct sk_buff_head *list) | 715 | int __tipc_link_xmit(struct net *net, struct tipc_link *link, |
716 | struct sk_buff_head *list) | ||
711 | { | 717 | { |
712 | struct tipc_msg *msg = buf_msg(skb_peek(list)); | 718 | struct tipc_msg *msg = buf_msg(skb_peek(list)); |
713 | uint psz = msg_size(msg); | 719 | uint psz = msg_size(msg); |
@@ -740,7 +746,8 @@ int __tipc_link_xmit(struct tipc_link *link, struct sk_buff_head *list) | |||
740 | 746 | ||
741 | if (skb_queue_len(outqueue) < sndlim) { | 747 | if (skb_queue_len(outqueue) < sndlim) { |
742 | __skb_queue_tail(outqueue, skb); | 748 | __skb_queue_tail(outqueue, skb); |
743 | tipc_bearer_send(link->bearer_id, skb, addr); | 749 | tipc_bearer_send(net, link->bearer_id, |
750 | skb, addr); | ||
744 | link->next_out = NULL; | 751 | link->next_out = NULL; |
745 | link->unacked_window = 0; | 752 | link->unacked_window = 0; |
746 | } else if (tipc_msg_bundle(outqueue, skb, mtu)) { | 753 | } else if (tipc_msg_bundle(outqueue, skb, mtu)) { |
@@ -774,7 +781,7 @@ static int __tipc_link_xmit_skb(struct tipc_link *link, struct sk_buff *skb) | |||
774 | struct sk_buff_head head; | 781 | struct sk_buff_head head; |
775 | 782 | ||
776 | skb2list(skb, &head); | 783 | skb2list(skb, &head); |
777 | return __tipc_link_xmit(link, &head); | 784 | return __tipc_link_xmit(link->owner->net, link, &head); |
778 | } | 785 | } |
779 | 786 | ||
780 | int tipc_link_xmit_skb(struct net *net, struct sk_buff *skb, u32 dnode, | 787 | int tipc_link_xmit_skb(struct net *net, struct sk_buff *skb, u32 dnode, |
@@ -808,7 +815,7 @@ int tipc_link_xmit(struct net *net, struct sk_buff_head *list, u32 dnode, | |||
808 | tipc_node_lock(node); | 815 | tipc_node_lock(node); |
809 | link = node->active_links[selector & 1]; | 816 | link = node->active_links[selector & 1]; |
810 | if (link) | 817 | if (link) |
811 | rc = __tipc_link_xmit(link, list); | 818 | rc = __tipc_link_xmit(net, link, list); |
812 | tipc_node_unlock(node); | 819 | tipc_node_unlock(node); |
813 | } | 820 | } |
814 | 821 | ||
@@ -900,7 +907,8 @@ void tipc_link_push_packets(struct tipc_link *l_ptr) | |||
900 | msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in); | 907 | msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in); |
901 | if (msg_user(msg) == MSG_BUNDLER) | 908 | if (msg_user(msg) == MSG_BUNDLER) |
902 | TIPC_SKB_CB(skb)->bundling = false; | 909 | TIPC_SKB_CB(skb)->bundling = false; |
903 | tipc_bearer_send(l_ptr->bearer_id, skb, | 910 | tipc_bearer_send(l_ptr->owner->net, |
911 | l_ptr->bearer_id, skb, | ||
904 | &l_ptr->media_addr); | 912 | &l_ptr->media_addr); |
905 | l_ptr->next_out = tipc_skb_queue_next(outqueue, skb); | 913 | l_ptr->next_out = tipc_skb_queue_next(outqueue, skb); |
906 | } else { | 914 | } else { |
@@ -997,7 +1005,8 @@ void tipc_link_retransmit(struct tipc_link *l_ptr, struct sk_buff *skb, | |||
997 | msg = buf_msg(skb); | 1005 | msg = buf_msg(skb); |
998 | msg_set_ack(msg, mod(l_ptr->next_in_no - 1)); | 1006 | msg_set_ack(msg, mod(l_ptr->next_in_no - 1)); |
999 | msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in); | 1007 | msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in); |
1000 | tipc_bearer_send(l_ptr->bearer_id, skb, &l_ptr->media_addr); | 1008 | tipc_bearer_send(l_ptr->owner->net, l_ptr->bearer_id, skb, |
1009 | &l_ptr->media_addr); | ||
1001 | retransmits--; | 1010 | retransmits--; |
1002 | l_ptr->stats.retransmitted++; | 1011 | l_ptr->stats.retransmitted++; |
1003 | } | 1012 | } |
@@ -1459,7 +1468,8 @@ void tipc_link_proto_xmit(struct tipc_link *l_ptr, u32 msg_typ, int probe_msg, | |||
1459 | skb_copy_to_linear_data(buf, msg, sizeof(l_ptr->proto_msg)); | 1468 | skb_copy_to_linear_data(buf, msg, sizeof(l_ptr->proto_msg)); |
1460 | buf->priority = TC_PRIO_CONTROL; | 1469 | buf->priority = TC_PRIO_CONTROL; |
1461 | 1470 | ||
1462 | tipc_bearer_send(l_ptr->bearer_id, buf, &l_ptr->media_addr); | 1471 | tipc_bearer_send(l_ptr->owner->net, l_ptr->bearer_id, buf, |
1472 | &l_ptr->media_addr); | ||
1463 | l_ptr->unacked_window = 0; | 1473 | l_ptr->unacked_window = 0; |
1464 | kfree_skb(buf); | 1474 | kfree_skb(buf); |
1465 | } | 1475 | } |
@@ -2037,7 +2047,7 @@ static int link_cmd_set_value(struct net *net, const char *name, u32 new_value, | |||
2037 | return res; | 2047 | return res; |
2038 | } | 2048 | } |
2039 | 2049 | ||
2040 | b_ptr = tipc_bearer_find(name); | 2050 | b_ptr = tipc_bearer_find(net, name); |
2041 | if (b_ptr) { | 2051 | if (b_ptr) { |
2042 | switch (cmd) { | 2052 | switch (cmd) { |
2043 | case TIPC_CMD_SET_LINK_TOL: | 2053 | case TIPC_CMD_SET_LINK_TOL: |
@@ -2295,10 +2305,11 @@ struct sk_buff *tipc_link_cmd_show_stats(struct net *net, | |||
2295 | 2305 | ||
2296 | static void link_print(struct tipc_link *l_ptr, const char *str) | 2306 | static void link_print(struct tipc_link *l_ptr, const char *str) |
2297 | { | 2307 | { |
2308 | struct tipc_net *tn = net_generic(l_ptr->owner->net, tipc_net_id); | ||
2298 | struct tipc_bearer *b_ptr; | 2309 | struct tipc_bearer *b_ptr; |
2299 | 2310 | ||
2300 | rcu_read_lock(); | 2311 | rcu_read_lock(); |
2301 | b_ptr = rcu_dereference_rtnl(bearer_list[l_ptr->bearer_id]); | 2312 | b_ptr = rcu_dereference_rtnl(tn->bearer_list[l_ptr->bearer_id]); |
2302 | if (b_ptr) | 2313 | if (b_ptr) |
2303 | pr_info("%s Link %x<%s>:", str, l_ptr->addr, b_ptr->name); | 2314 | pr_info("%s Link %x<%s>:", str, l_ptr->addr, b_ptr->name); |
2304 | rcu_read_unlock(); | 2315 | rcu_read_unlock(); |
diff --git a/net/tipc/link.h b/net/tipc/link.h index 380e27ee0f70..9df7fa4d3bdd 100644 --- a/net/tipc/link.h +++ b/net/tipc/link.h | |||
@@ -223,7 +223,8 @@ int tipc_link_xmit_skb(struct net *net, struct sk_buff *skb, u32 dest, | |||
223 | u32 selector); | 223 | u32 selector); |
224 | int tipc_link_xmit(struct net *net, struct sk_buff_head *list, u32 dest, | 224 | int tipc_link_xmit(struct net *net, struct sk_buff_head *list, u32 dest, |
225 | u32 selector); | 225 | u32 selector); |
226 | int __tipc_link_xmit(struct tipc_link *link, struct sk_buff_head *list); | 226 | int __tipc_link_xmit(struct net *net, struct tipc_link *link, |
227 | struct sk_buff_head *list); | ||
227 | void tipc_link_bundle_rcv(struct net *net, struct sk_buff *buf); | 228 | void tipc_link_bundle_rcv(struct net *net, struct sk_buff *buf); |
228 | void tipc_link_proto_xmit(struct tipc_link *l_ptr, u32 msg_typ, int prob, | 229 | void tipc_link_proto_xmit(struct tipc_link *l_ptr, u32 msg_typ, int prob, |
229 | u32 gap, u32 tolerance, u32 priority, u32 acked_mtu); | 230 | u32 gap, u32 tolerance, u32 priority, u32 acked_mtu); |
diff --git a/net/tipc/net.c b/net/tipc/net.c index de18aacf3d64..38633e5f8a7d 100644 --- a/net/tipc/net.c +++ b/net/tipc/net.c | |||
@@ -117,7 +117,7 @@ int tipc_net_start(struct net *net, u32 addr) | |||
117 | tipc_own_addr = addr; | 117 | tipc_own_addr = addr; |
118 | tipc_named_reinit(); | 118 | tipc_named_reinit(); |
119 | tipc_sk_reinit(); | 119 | tipc_sk_reinit(); |
120 | res = tipc_bclink_init(); | 120 | res = tipc_bclink_init(net); |
121 | if (res) | 121 | if (res) |
122 | return res; | 122 | return res; |
123 | 123 | ||
@@ -140,7 +140,7 @@ void tipc_net_stop(struct net *net) | |||
140 | tipc_own_addr); | 140 | tipc_own_addr); |
141 | rtnl_lock(); | 141 | rtnl_lock(); |
142 | tipc_bearer_stop(net); | 142 | tipc_bearer_stop(net); |
143 | tipc_bclink_stop(); | 143 | tipc_bclink_stop(net); |
144 | tipc_node_stop(net); | 144 | tipc_node_stop(net); |
145 | rtnl_unlock(); | 145 | rtnl_unlock(); |
146 | 146 | ||