summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafaƂ Gajda <rafal.gajda@silvair.com>2020-01-08 22:01:02 +0100
committerBrian Gix <brian.gix@intel.com>2020-01-08 13:55:21 -0800
commitd3093475b5a70b18ecbcb0b02ad5315eed1c15a4 (patch)
tree5ccb1ef8d0a26911cb8eff1b136cd0750bbca4d7
parent1169eb4434fd2093cbd6a2f58055bd1fbc33c3f0 (diff)
downloadbluez-d3093475b5a70b18ecbcb0b02ad5315eed1c15a4.tar.gz
mesh: Fix IV recovery
This patch fixes saving IV received in SNB to storage. Previously after creating new node with IV 0 (or loading node with IV > 0 but after long inactivity) first received SNB should update IV (and reset sequence number to 0 if necessary). The bug would prevent new IV being saved in storage which resulted in sequence number being set to 0 on first SNB received after every daemon reset but IV never being updated.
-rw-r--r--mesh/net.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mesh/net.c b/mesh/net.c
index 23565c11d..d7ce5493d 100644
--- a/mesh/net.c
+++ b/mesh/net.c
@@ -2657,7 +2657,7 @@ static void update_iv_ivu_state(struct mesh_net *net, uint32_t iv_index,
if ((iv_index - ivu) > (local_iv_index - local_ivu))
mesh_net_set_seq_num(net, 0);
- if (ivu != net->iv_update || local_iv_index != net->iv_index) {
+ if (ivu != net->iv_update || iv_index != net->iv_index) {
struct mesh_config *cfg = node_config_get(net->node);
mesh_config_write_iv_index(cfg, iv_index, ivu);