Linux bluetooth development
 help / color / mirror / Atom feed
From: "Gix, Brian" <brian.gix@intel.com>
To: "linux-bluetooth@vger.kernel.org" <linux-bluetooth@vger.kernel.org>
Cc: "michal.lowas-rzechonek@silvair.com" 
	<michal.lowas-rzechonek@silvair.com>,
	"Stotland, Inga" <inga.stotland@intel.com>,
	"rafal.gajda@silvair.com" <rafal.gajda@silvair.com>
Subject: Re: [PATCH BlueZ v2] mesh: Ignore beacons with IVU if IV already updated
Date: Wed, 8 Apr 2020 18:12:06 +0000	[thread overview]
Message-ID: <d5c4e48a176cbb32d45ef5460615bed40271b1a3.camel@intel.com> (raw)
In-Reply-To: <20200408171516.15151-1-brian.gix@intel.com>

Applied, Thanks
On Wed, 2020-04-08 at 10:15 -0700, Brian Gix wrote:
> From: Rafał Gajda <rafal.gajda@silvair.com>
> 
> When daemon receives beacon with IV=n+1, IVU=False it will
> start sending messages with new IV and set sequence to 0.
> However if daemon receives another beacon with IV=n+1, IVU=True it
> will go back to sending messages with old IV=n (IVU set to True).
> Because sequence number has been reset those messages will be dropped
> by replay protection and node will lose communication.
> 
> Once IV is updated daemon should not go back to using the old value.
> 
> This patch adds beacon rejection if IV has already been updated.
> ---
>  mesh/net.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/mesh/net.c b/mesh/net.c
> index 9a56d2ee8..bfb9c4435 100644
> --- a/mesh/net.c
> +++ b/mesh/net.c
> @@ -2696,6 +2696,10 @@ static void update_iv_ivu_state(struct mesh_net *net, uint32_t iv_index,
>  	/* If first beacon seen, accept without judgement */
>  	if (net->iv_upd_state == IV_UPD_INIT) {
>  		if (ivu) {
> +			/* Ignore beacons with IVU if IV already updated */
> +			if (iv_index == net->iv_index && !net->iv_update)
> +				return;
> +
>  			/* Other devices will be accepting old or new iv_index,
>  			 * but we don't know how far through update they are.
>  			 * Starting permissive state will allow us maximum
> @@ -2717,6 +2721,10 @@ static void update_iv_ivu_state(struct mesh_net *net, uint32_t iv_index,
>  			return;
>  		}
>  
> +		/* Ignore beacons with IVU if IV already updated */
> +		if (iv_index == net->iv_index)
> +			return;
> +
>  		if (!net->iv_update) {
>  			l_info("iv_upd_state = IV_UPD_UPDATING");
>  			net->iv_upd_state = IV_UPD_UPDATING;

      reply	other threads:[~2020-04-08 18:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-08 17:15 [PATCH BlueZ v2] mesh: Ignore beacons with IVU if IV already updated Brian Gix
2020-04-08 18:12 ` Gix, Brian [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d5c4e48a176cbb32d45ef5460615bed40271b1a3.camel@intel.com \
    --to=brian.gix@intel.com \
    --cc=inga.stotland@intel.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=michal.lowas-rzechonek@silvair.com \
    --cc=rafal.gajda@silvair.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox