netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net  1/1] tipc: fix link re-establish failure
@ 2018-11-10 22:30 Jon Maloy
  2018-11-11 18:04 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Jon Maloy @ 2018-11-10 22:30 UTC (permalink / raw)
  To: netdev, davem
  Cc: gordan.mihaljevic, tung.q.nguyen, hoang.h.le, jon.maloy, maloy,
	xinl, ying.xue, tipc-discussion

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: 7ea817f4e832 ("tipc: check session number before accepting link protocol messages")
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
---
 net/tipc/link.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/net/tipc/link.c b/net/tipc/link.c
index 201c3b5..836727e 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -1594,14 +1594,17 @@ static int tipc_link_proto_rcv(struct tipc_link *l, struct sk_buff *skb,
 		if (in_range(peers_prio, l->priority + 1, TIPC_MAX_LINK_PRI))
 			l->priority = peers_prio;
 
-		/* ACTIVATE_MSG serves as PEER_RESET if link is already down */
-		if (msg_peer_stopping(hdr))
+		/* If peer is going down we want full re-establish cycle */
+		if (msg_peer_stopping(hdr)) {
 			rc = tipc_link_fsm_evt(l, LINK_FAILURE_EVT);
-		else if ((mtyp == RESET_MSG) || !link_is_up(l))
+			break;
+		}
+		/* ACTIVATE_MSG serves as PEER_RESET if link is already down */
+		if (mtyp == RESET_MSG || !link_is_up(l))
 			rc = tipc_link_fsm_evt(l, LINK_PEER_RESET_EVT);
 
 		/* ACTIVATE_MSG takes up link if it was already locally reset */
-		if ((mtyp == ACTIVATE_MSG) && (l->state == LINK_ESTABLISHING))
+		if (mtyp == ACTIVATE_MSG && l->state == LINK_ESTABLISHING)
 			rc = TIPC_LINK_UP_EVT;
 
 		l->peer_session = msg_session(hdr);
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [net 1/1] tipc: fix link re-establish failure
  2018-11-10 22:30 [net 1/1] tipc: fix link re-establish failure Jon Maloy
@ 2018-11-11 18:04 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-11-11 18:04 UTC (permalink / raw)
  To: donmalo99
  Cc: netdev, gordan.mihaljevic, tung.q.nguyen, hoang.h.le, jon.maloy,
	maloy, xinl, ying.xue, tipc-discussion

From: Jon Maloy <donmalo99@gmail.com>
Date: Sat, 10 Nov 2018 17:30:24 -0500

> 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: 7ea817f4e832 ("tipc: check session number before accepting link protocol messages")
> Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>

Applied and queued up for -stable.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-11-12  3:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-10 22:30 [net 1/1] tipc: fix link re-establish failure Jon Maloy
2018-11-11 18:04 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).