This fixes erroneously cleared sequence number when node performs IV Recovery procedure on startup in a following scenario: - node has IV Index set to <N> - node starts in IV_UPD_INIT state - node receives a Secure Network Beacon with IV Index <N>+1 and IV Update flag set Upon reception, the node shall: - increase its IV Index to <N>+1 - enter IV_UPD_UPDATING state This means that the node keeps transmitting messages using IV Index equal to <N>, therefore it shall not reset its Sequence Number before IV Update procedure completes. If, on the other hand, received Secure Network Beacon contains IV Index <N>+2 (or more), the node shall: - increase its IV Index to <N>+2 (or more) - enter IV_UPD_UPDATING state - reset the Sequence Number to 0 --- mesh/net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mesh/net.c b/mesh/net.c index 2785039db..b4b390541 100644 --- a/mesh/net.c +++ b/mesh/net.c @@ -2735,7 +2735,7 @@ static void update_iv_kr_state(struct mesh_subnet *subnet, uint32_t iv_index, } if (net->iv_upd_state == IV_UPD_INIT) { - if (iv_index > net->iv_index) + if (iv_index > net->iv_index + 1) mesh_net_set_seq_num(net, 0); net->iv_index = iv_index; -- 2.19.1