diff options
Diffstat (limited to 'net/tipc')
-rw-r--r-- | net/tipc/port.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/net/tipc/port.c b/net/tipc/port.c index 606ff1a78e2b..60aede075b52 100644 --- a/net/tipc/port.c +++ b/net/tipc/port.c | |||
@@ -236,6 +236,8 @@ u32 tipc_port_init(struct tipc_port *p_ptr, | |||
236 | void tipc_port_destroy(struct tipc_port *p_ptr) | 236 | void tipc_port_destroy(struct tipc_port *p_ptr) |
237 | { | 237 | { |
238 | struct sk_buff *buf = NULL; | 238 | struct sk_buff *buf = NULL; |
239 | struct tipc_msg *msg = NULL; | ||
240 | u32 peer; | ||
239 | 241 | ||
240 | tipc_withdraw(p_ptr, 0, NULL); | 242 | tipc_withdraw(p_ptr, 0, NULL); |
241 | 243 | ||
@@ -247,14 +249,15 @@ void tipc_port_destroy(struct tipc_port *p_ptr) | |||
247 | if (p_ptr->connected) { | 249 | if (p_ptr->connected) { |
248 | buf = port_build_peer_abort_msg(p_ptr, TIPC_ERR_NO_PORT); | 250 | buf = port_build_peer_abort_msg(p_ptr, TIPC_ERR_NO_PORT); |
249 | tipc_nodesub_unsubscribe(&p_ptr->subscription); | 251 | tipc_nodesub_unsubscribe(&p_ptr->subscription); |
252 | msg = buf_msg(buf); | ||
253 | peer = msg_destnode(msg); | ||
254 | tipc_link_xmit2(buf, peer, msg_link_selector(msg)); | ||
250 | } | 255 | } |
251 | |||
252 | spin_lock_bh(&tipc_port_list_lock); | 256 | spin_lock_bh(&tipc_port_list_lock); |
253 | list_del(&p_ptr->port_list); | 257 | list_del(&p_ptr->port_list); |
254 | list_del(&p_ptr->wait_list); | 258 | list_del(&p_ptr->wait_list); |
255 | spin_unlock_bh(&tipc_port_list_lock); | 259 | spin_unlock_bh(&tipc_port_list_lock); |
256 | k_term_timer(&p_ptr->timer); | 260 | k_term_timer(&p_ptr->timer); |
257 | tipc_net_route_msg(buf); | ||
258 | } | 261 | } |
259 | 262 | ||
260 | /* | 263 | /* |
@@ -276,6 +279,7 @@ static struct sk_buff *port_build_proto_msg(struct tipc_port *p_ptr, | |||
276 | msg_set_destport(msg, tipc_port_peerport(p_ptr)); | 279 | msg_set_destport(msg, tipc_port_peerport(p_ptr)); |
277 | msg_set_origport(msg, p_ptr->ref); | 280 | msg_set_origport(msg, p_ptr->ref); |
278 | msg_set_msgcnt(msg, ack); | 281 | msg_set_msgcnt(msg, ack); |
282 | buf->next = NULL; | ||
279 | } | 283 | } |
280 | return buf; | 284 | return buf; |
281 | } | 285 | } |
@@ -284,6 +288,7 @@ static void port_timeout(unsigned long ref) | |||
284 | { | 288 | { |
285 | struct tipc_port *p_ptr = tipc_port_lock(ref); | 289 | struct tipc_port *p_ptr = tipc_port_lock(ref); |
286 | struct sk_buff *buf = NULL; | 290 | struct sk_buff *buf = NULL; |
291 | struct tipc_msg *msg = NULL; | ||
287 | 292 | ||
288 | if (!p_ptr) | 293 | if (!p_ptr) |
289 | return; | 294 | return; |
@@ -302,7 +307,8 @@ static void port_timeout(unsigned long ref) | |||
302 | k_start_timer(&p_ptr->timer, p_ptr->probing_interval); | 307 | k_start_timer(&p_ptr->timer, p_ptr->probing_interval); |
303 | } | 308 | } |
304 | tipc_port_unlock(p_ptr); | 309 | tipc_port_unlock(p_ptr); |
305 | tipc_net_route_msg(buf); | 310 | msg = buf_msg(buf); |
311 | tipc_link_xmit2(buf, msg_destnode(msg), msg_link_selector(msg)); | ||
306 | } | 312 | } |
307 | 313 | ||
308 | 314 | ||
@@ -310,12 +316,14 @@ static void port_handle_node_down(unsigned long ref) | |||
310 | { | 316 | { |
311 | struct tipc_port *p_ptr = tipc_port_lock(ref); | 317 | struct tipc_port *p_ptr = tipc_port_lock(ref); |
312 | struct sk_buff *buf = NULL; | 318 | struct sk_buff *buf = NULL; |
319 | struct tipc_msg *msg = NULL; | ||
313 | 320 | ||
314 | if (!p_ptr) | 321 | if (!p_ptr) |
315 | return; | 322 | return; |
316 | buf = port_build_self_abort_msg(p_ptr, TIPC_ERR_NO_NODE); | 323 | buf = port_build_self_abort_msg(p_ptr, TIPC_ERR_NO_NODE); |
317 | tipc_port_unlock(p_ptr); | 324 | tipc_port_unlock(p_ptr); |
318 | tipc_net_route_msg(buf); | 325 | msg = buf_msg(buf); |
326 | tipc_link_xmit2(buf, msg_destnode(msg), msg_link_selector(msg)); | ||
319 | } | 327 | } |
320 | 328 | ||
321 | 329 | ||
@@ -327,6 +335,7 @@ static struct sk_buff *port_build_self_abort_msg(struct tipc_port *p_ptr, u32 er | |||
327 | struct tipc_msg *msg = buf_msg(buf); | 335 | struct tipc_msg *msg = buf_msg(buf); |
328 | msg_swap_words(msg, 4, 5); | 336 | msg_swap_words(msg, 4, 5); |
329 | msg_swap_words(msg, 6, 7); | 337 | msg_swap_words(msg, 6, 7); |
338 | buf->next = NULL; | ||
330 | } | 339 | } |
331 | return buf; | 340 | return buf; |
332 | } | 341 | } |
@@ -351,6 +360,7 @@ static struct sk_buff *port_build_peer_abort_msg(struct tipc_port *p_ptr, u32 er | |||
351 | if (imp < TIPC_CRITICAL_IMPORTANCE) | 360 | if (imp < TIPC_CRITICAL_IMPORTANCE) |
352 | msg_set_importance(msg, ++imp); | 361 | msg_set_importance(msg, ++imp); |
353 | msg_set_errcode(msg, err); | 362 | msg_set_errcode(msg, err); |
363 | buf->next = NULL; | ||
354 | } | 364 | } |
355 | return buf; | 365 | return buf; |
356 | } | 366 | } |
@@ -401,7 +411,7 @@ void tipc_port_proto_rcv(struct sk_buff *buf) | |||
401 | p_ptr->probing_state = CONFIRMED; | 411 | p_ptr->probing_state = CONFIRMED; |
402 | tipc_port_unlock(p_ptr); | 412 | tipc_port_unlock(p_ptr); |
403 | exit: | 413 | exit: |
404 | tipc_net_route_msg(r_buf); | 414 | tipc_link_xmit2(r_buf, msg_destnode(msg), msg_link_selector(msg)); |
405 | kfree_skb(buf); | 415 | kfree_skb(buf); |
406 | } | 416 | } |
407 | 417 | ||
@@ -496,6 +506,7 @@ void tipc_acknowledge(u32 ref, u32 ack) | |||
496 | { | 506 | { |
497 | struct tipc_port *p_ptr; | 507 | struct tipc_port *p_ptr; |
498 | struct sk_buff *buf = NULL; | 508 | struct sk_buff *buf = NULL; |
509 | struct tipc_msg *msg; | ||
499 | 510 | ||
500 | p_ptr = tipc_port_lock(ref); | 511 | p_ptr = tipc_port_lock(ref); |
501 | if (!p_ptr) | 512 | if (!p_ptr) |
@@ -505,7 +516,10 @@ void tipc_acknowledge(u32 ref, u32 ack) | |||
505 | buf = port_build_proto_msg(p_ptr, CONN_ACK, ack); | 516 | buf = port_build_proto_msg(p_ptr, CONN_ACK, ack); |
506 | } | 517 | } |
507 | tipc_port_unlock(p_ptr); | 518 | tipc_port_unlock(p_ptr); |
508 | tipc_net_route_msg(buf); | 519 | if (!buf) |
520 | return; | ||
521 | msg = buf_msg(buf); | ||
522 | tipc_link_xmit2(buf, msg_destnode(msg), msg_link_selector(msg)); | ||
509 | } | 523 | } |
510 | 524 | ||
511 | int tipc_publish(struct tipc_port *p_ptr, unsigned int scope, | 525 | int tipc_publish(struct tipc_port *p_ptr, unsigned int scope, |
@@ -656,6 +670,7 @@ int tipc_port_disconnect(u32 ref) | |||
656 | */ | 670 | */ |
657 | int tipc_port_shutdown(u32 ref) | 671 | int tipc_port_shutdown(u32 ref) |
658 | { | 672 | { |
673 | struct tipc_msg *msg; | ||
659 | struct tipc_port *p_ptr; | 674 | struct tipc_port *p_ptr; |
660 | struct sk_buff *buf = NULL; | 675 | struct sk_buff *buf = NULL; |
661 | 676 | ||
@@ -665,6 +680,7 @@ int tipc_port_shutdown(u32 ref) | |||
665 | 680 | ||
666 | buf = port_build_peer_abort_msg(p_ptr, TIPC_CONN_SHUTDOWN); | 681 | buf = port_build_peer_abort_msg(p_ptr, TIPC_CONN_SHUTDOWN); |
667 | tipc_port_unlock(p_ptr); | 682 | tipc_port_unlock(p_ptr); |
668 | tipc_net_route_msg(buf); | 683 | msg = buf_msg(buf); |
684 | tipc_link_xmit2(buf, msg_destnode(msg), msg_link_selector(msg)); | ||
669 | return tipc_port_disconnect(ref); | 685 | return tipc_port_disconnect(ref); |
670 | } | 686 | } |