mesh: Fix encoding of Config Key Refresh Phase Status
authorMichał Lowas-Rzechonek <michal.lowas-rzechonek@silvair.com>
Tue, 11 Aug 2020 19:37:09 +0000 (21:37 +0200)
committerAbhay Agarwal <ay.agarwal@samsung.com>
Mon, 28 Dec 2020 06:20:04 +0000 (11:50 +0530)
Config Key Refresh Phase Status is 4 octets long (see Mesh Profile
v1.0.1, section 4.3.2.60): 1 octet for status, 2 octets for net key
index, 1 octet for the phase.

Change-Id: I7c9ab88fc8ea469ed4b354b3e746cdf9c1f000c3
Signed-off-by: anuj.bhumiya <anuj.bhumiya@samsung.com>
mesh/cfgmod-server.c

index 52a0e02..8fca756 100644 (file)
@@ -446,11 +446,11 @@ static uint16_t cfg_key_refresh_phase(struct mesh_node *node,
 
 done:
        msg[n] = status;
-       l_put_le16(idx, msg + n);
-       msg[n + 2] = (status != MESH_STATUS_SUCCESS) ?
+       l_put_le16(idx, &msg[n + 1]);
+       msg[n + 3] = (status != MESH_STATUS_SUCCESS) ?
                                                KEY_REFRESH_PHASE_NONE : phase;
 
-       return n + 3;
+       return n + 4;
 }
 
 static uint8_t uint32_to_log(uint32_t value)