From: David Miller Subject: Re: [net 1/1] tipc: ignore STATE_MSG on wrong link session Date: Mon, 01 Oct 2018 22:36:45 -0700 (PDT) Message-ID: <20181001.223645.2293940624987976431.davem@davemloft.net> References: <1537993732-4390-1-git-send-email-jon.maloy@ericsson.com> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, gordan.mihaljevic@dektech.com.au, tung.q.nguyen@dektech.com.au, hoang.h.le@dektech.com.au, canh.d.luu@dektech.com.au, ying.xue@windriver.com, tipc-discussion@lists.sourceforge.net To: jon.maloy@ericsson.com Return-path: Received: from shards.monkeyblade.net ([23.128.96.9]:37530 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726672AbeJBMSK (ORCPT ); Tue, 2 Oct 2018 08:18:10 -0400 In-Reply-To: <1537993732-4390-1-git-send-email-jon.maloy@ericsson.com> Sender: netdev-owner@vger.kernel.org List-ID: From: Jon Maloy Date: Wed, 26 Sep 2018 22:28:52 +0200 > From: LUU Duc Canh > > The initial session number when a link is created is based on a random > value, taken from struct tipc_net->random. It is then incremented for > each link reset to avoid mixing protocol messages from different link > sessions. > > However, when a bearer is reset all its links are deleted, and will > later be re-created using the same random value as the first time. > This means that if the link never went down between creation and > deletion we will still sometimes have two subsequent sessions with > the same session number. In virtual environments with potentially > long transmission times this has turned out to be a real problem. > > We now fix this by randomizing the session number each time a link > is created. > > With a session number size of 16 bits this gives a risk of session > collision of 1/64k. To reduce this further, we also introduce a sanity > check on the very first STATE message arriving at a link. If this has > an acknowledge value differing from 0, which is logically impossible, > we ignore the message. The final risk for session collision is hence > reduced to 1/4G, which should be sufficient. > > Signed-off-by: LUU Duc Canh > Signed-off-by: Jon Maloy Applied.