diff mbox series

[BlueZ,v2,1/2] mesh: Fix IV recovery

Message ID 20200108210103.32220-2-michal.lowas-rzechonek@silvair.com
State New
Headers show
Series [BlueZ,v2,1/2] mesh: Fix IV recovery | expand

Commit Message

Michał Lowas-Rzechonek Jan. 8, 2020, 9:01 p.m. UTC
From: Rafał Gajda <rafal.gajda@silvair.com>

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.
---
 mesh/net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

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);