summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsak Westin <isak.westin@loytec.com>2022-09-29 13:03:41 +0200
committerBrian Gix <brian.gix@intel.com>2022-10-03 14:19:19 -0700
commit926d16db8ae4bb5c40266be5bd6b10023d932c0d (patch)
treee165fc5ef7a8f0bdb563bad8dd0673d93bb74d75
parent25a31f5a930e0bd724cc55b0595b082a732ccd79 (diff)
downloadbluez-926d16db8ae4bb5c40266be5bd6b10023d932c0d.tar.gz
mesh: Ignore Secure Network Beacon from subnet
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.
-rw-r--r--mesh/net.c13
1 files changed, 12 insertions, 1 deletions
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;