linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Isak Westin <isak.westin@loytec.com>
To: linux-bluetooth@vger.kernel.org
Cc: Isak Westin <isak.westin@loytec.com>
Subject: [PATCH BlueZ 1/4] mesh: Ignore Secure Network Beacon from subnet
Date: Thu, 29 Sep 2022 13:03:41 +0200	[thread overview]
Message-ID: <20220929110344.26130-2-isak.westin@loytec.com> (raw)
In-Reply-To: <20220929110344.26130-1-isak.westin@loytec.com>

If this node is a member of a primary subnet and receives a Secure Network
beacon on a secondary subnet with an IV Index greater than the last known
IV Index of the primary subnet, the Secure Network beacon shall be ignored.
See MshPRFv1.0.1 section 3.10.5.
---
 mesh/net.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/mesh/net.c b/mesh/net.c
index 7fec98531..dc3d1fd80 100644
--- a/mesh/net.c
+++ b/mesh/net.c
@@ -2708,7 +2708,7 @@ static void process_beacon(void *net_ptr, void *user_data)
 	struct net_beacon_data *beacon_data = user_data;
 	uint32_t ivi;
 	bool ivu, kr, local_kr;
-	struct mesh_subnet *subnet;
+	struct mesh_subnet *subnet, *primary_subnet;
 
 	ivi = beacon_data->ivi;
 
@@ -2723,6 +2723,17 @@ static void process_beacon(void *net_ptr, void *user_data)
 	if (!subnet)
 		return;
 
+	/*
+	 * @MshPRFv1.0.1 section 3.10.5: IV Update procedure
+	 * If this node is a member of a primary subnet and receives a Secure
+	 * Network beacon on a secondary subnet with an IV Index greater than
+	 * the last known IV Index of the primary subnet, the Secure Network
+	 * beacon shall be ignored.
+	 */
+	primary_subnet = get_primary_subnet(net);
+	if (primary_subnet && subnet != primary_subnet && ivi > net->iv_index)
+		return;
+
 	/* Get IVU and KR boolean bits from beacon */
 	ivu = beacon_data->ivu;
 	kr = beacon_data->kr;
-- 
2.20.1






  reply	other threads:[~2022-09-29 11:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-29 11:03 [PATCH BlueZ 0/4] Mesh: Fix IV update and KeyRefresh procedures Isak Westin
2022-09-29 11:03 ` Isak Westin [this message]
2022-09-29 12:18   ` bluez.test.bot
2022-09-29 11:03 ` [PATCH BlueZ 2/4] mesh: Ignore SNB with invalid IV Index values Isak Westin
2022-09-29 11:03 ` [PATCH BlueZ 3/4] mesh: Allow Key refresh to skip Phase 2 Isak Westin
2022-09-29 11:03 ` [PATCH BlueZ 4/4] mesh: Allow Key Refresh Phase 0 to 3 transition Isak Westin
2022-10-03 21:30 ` [PATCH BlueZ 0/4] Mesh: Fix IV update and KeyRefresh procedures patchwork-bot+bluetooth

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=20220929110344.26130-2-isak.westin@loytec.com \
    --to=isak.westin@loytec.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).