aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/tipc/link.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/net/tipc/link.c b/net/tipc/link.c
index bd206ebe4eea..b8c1231e3147 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -51,6 +51,12 @@
51 51
52 52
53/* 53/*
54 * Out-of-range value for link session numbers
55 */
56
57#define INVALID_SESSION 0x10000
58
59/*
54 * Limit for deferred reception queue: 60 * Limit for deferred reception queue:
55 */ 61 */
56 62
@@ -464,7 +470,7 @@ struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer,
464 msg = l_ptr->pmsg; 470 msg = l_ptr->pmsg;
465 msg_init(msg, LINK_PROTOCOL, RESET_MSG, TIPC_OK, INT_H_SIZE, l_ptr->addr); 471 msg_init(msg, LINK_PROTOCOL, RESET_MSG, TIPC_OK, INT_H_SIZE, l_ptr->addr);
466 msg_set_size(msg, sizeof(l_ptr->proto_msg)); 472 msg_set_size(msg, sizeof(l_ptr->proto_msg));
467 msg_set_session(msg, tipc_random); 473 msg_set_session(msg, (tipc_random & 0xffff));
468 msg_set_bearer_id(msg, b_ptr->identity); 474 msg_set_bearer_id(msg, b_ptr->identity);
469 strcpy((char *)msg_data(msg), if_name); 475 strcpy((char *)msg_data(msg), if_name);
470 476
@@ -705,10 +711,10 @@ void tipc_link_reset(struct link *l_ptr)
705 u32 checkpoint = l_ptr->next_in_no; 711 u32 checkpoint = l_ptr->next_in_no;
706 int was_active_link = tipc_link_is_active(l_ptr); 712 int was_active_link = tipc_link_is_active(l_ptr);
707 713
708 msg_set_session(l_ptr->pmsg, msg_session(l_ptr->pmsg) + 1); 714 msg_set_session(l_ptr->pmsg, ((msg_session(l_ptr->pmsg) + 1) & 0xffff));
709 715
710 /* Link is down, accept any session: */ 716 /* Link is down, accept any session */
711 l_ptr->peer_session = 0; 717 l_ptr->peer_session = INVALID_SESSION;
712 718
713 /* Prepare for max packet size negotiation */ 719 /* Prepare for max packet size negotiation */
714 link_init_max_pkt(l_ptr); 720 link_init_max_pkt(l_ptr);
@@ -2275,7 +2281,8 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf)
2275 switch (msg_type(msg)) { 2281 switch (msg_type(msg)) {
2276 2282
2277 case RESET_MSG: 2283 case RESET_MSG:
2278 if (!link_working_unknown(l_ptr) && l_ptr->peer_session) { 2284 if (!link_working_unknown(l_ptr) &&
2285 (l_ptr->peer_session != INVALID_SESSION)) {
2279 if (msg_session(msg) == l_ptr->peer_session) { 2286 if (msg_session(msg) == l_ptr->peer_session) {
2280 dbg("Duplicate RESET: %u<->%u\n", 2287 dbg("Duplicate RESET: %u<->%u\n",
2281 msg_session(msg), l_ptr->peer_session); 2288 msg_session(msg), l_ptr->peer_session);