From d3093475b5a70b18ecbcb0b02ad5315eed1c15a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Gajda?= Date: Wed, 8 Jan 2020 22:01:02 +0100 Subject: [PATCH] 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. --- mesh/net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- 2.47.3