summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsak Westin <isak.westin@loytec.com>2022-09-29 13:03:41 +0200
committerAyush Garg <ayush.garg@samsung.com>2023-05-15 14:55:55 +0530
commit37fae28beb5a9e91535bb92b148af836fde18f1c (patch)
tree55ae1840c63f7bc8f18166c887a8380c49aa4699
parentf8e5c7226efe94f34a51f786d1fd34fba3bcd3ad (diff)
downloadbluez-37fae28beb5a9e91535bb92b148af836fde18f1c.tar.gz
bluez-37fae28beb5a9e91535bb92b148af836fde18f1c.tar.bz2
bluez-37fae28beb5a9e91535bb92b148af836fde18f1c.zip
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. Signed-off-by: Manika Shrivastava <manika.sh@samsung.com> Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
-rw-r--r--mesh/net.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/mesh/net.c b/mesh/net.c
index faa7aa98..ca6116fb 100644
--- a/mesh/net.c
+++ b/mesh/net.c
@@ -2706,7 +2706,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;
@@ -2721,6 +2721,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;