mesh: Ignore SNB with invalid IV Index values
authorIsak Westin <isak.westin@loytec.com>
Thu, 29 Sep 2022 11:03:42 +0000 (13:03 +0200)
committerAyush Garg <ayush.garg@samsung.com>
Mon, 15 May 2023 09:25:55 +0000 (14:55 +0530)
If we are in IV update in progress state, and receive a Secure Network
beacon with an IV index equal to last known IV index + 1, and IV update
flag set to 1, it should 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>
mesh/net.c

index ca6116f..eb949d2 100644 (file)
@@ -2669,6 +2669,10 @@ static bool update_iv_ivu_state(struct mesh_net *net, uint32_t iv_index,
                if (iv_index == net->iv_index)
                        return false;
 
+               /* Ignore beacon with invalid IV index value */
+               if (net->iv_update && iv_index == net->iv_index + 1)
+                       return false;
+
                if (!net->iv_update) {
                        l_debug("iv_upd_state = IV_UPD_UPDATING");
                        net->iv_upd_state = IV_UPD_UPDATING;