Skip to content

Commit 7ab412d

Browse files
Jon Maloydavem330
authored andcommitted
tipc: fix link re-establish failure
When a link failure is detected locally, the link is reset, the flag link->in_session is set to false, and a RESET_MSG with the 'stopping' bit set is sent to the peer. The purpose of this bit is to inform the peer that this endpoint just is going down, and that the peer should handle the reception of this particular RESET message as a local failure. This forces the peer to accept another RESET or ACTIVATE message from this endpoint before it can re-establish the link. This again is necessary to ensure that link session numbers are properly exchanged before the link comes up again. If a failure is detected locally at the same time at the peer endpoint this will do the same, which is also a correct behavior. However, when receiving such messages, the endpoints will not distinguish between 'stopping' RESETs and ordinary ones when it comes to updating session numbers. Both endpoints will copy the received session number and set their 'in_session' flags to true at the reception, while they are still expecting another RESET from the peer before they can go ahead and re-establish. This is contradictory, since, after applying the validation check referred to below, the 'in_session' flag will cause rejection of all such messages, and the link will never come up again. We now fix this by not only handling received RESET/STOPPING messages as a local failure, but also by omitting to set a new session number and the 'in_session' flag in such cases. Fixes: 7ea817f ("tipc: check session number before accepting link protocol messages") Signed-off-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 63c8299 commit 7ab412d

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

net/tipc/link.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1594,14 +1594,17 @@ static int tipc_link_proto_rcv(struct tipc_link *l, struct sk_buff *skb,
15941594
if (in_range(peers_prio, l->priority + 1, TIPC_MAX_LINK_PRI))
15951595
l->priority = peers_prio;
15961596

1597-
/* ACTIVATE_MSG serves as PEER_RESET if link is already down */
1598-
if (msg_peer_stopping(hdr))
1597+
/* If peer is going down we want full re-establish cycle */
1598+
if (msg_peer_stopping(hdr)) {
15991599
rc = tipc_link_fsm_evt(l, LINK_FAILURE_EVT);
1600-
else if ((mtyp == RESET_MSG) || !link_is_up(l))
1600+
break;
1601+
}
1602+
/* ACTIVATE_MSG serves as PEER_RESET if link is already down */
1603+
if (mtyp == RESET_MSG || !link_is_up(l))
16011604
rc = tipc_link_fsm_evt(l, LINK_PEER_RESET_EVT);
16021605

16031606
/* ACTIVATE_MSG takes up link if it was already locally reset */
1604-
if ((mtyp == ACTIVATE_MSG) && (l->state == LINK_ESTABLISHING))
1607+
if (mtyp == ACTIVATE_MSG && l->state == LINK_ESTABLISHING)
16051608
rc = TIPC_LINK_UP_EVT;
16061609

16071610
l->peer_session = msg_session(hdr);

0 commit comments

Comments
 (0)