mesh: Update seqnum when re-encrypting for friend
Sets the sequence number when re-encrypting messages from the friend to
the lpn.
this is port of
@@ -442,7 +442,8 @@ static int unseg_app_sdu_prepare(struct bt_mesh_friend *frnd,
return 0;
}
- BT_DBG("Re-encrypting friend pdu");
+ BT_DBG("Re-encrypting friend pdu (SeqNum %06x -> %06x)",
+ meta.crypto.seq_num, bt_mesh.seq);
err = unseg_app_sdu_decrypt(frnd, buf, &meta);
if (err) {
@@ -450,6 +451,8 @@ static int unseg_app_sdu_prepare(struct bt_mesh_friend *frnd,
return err;
}
+ meta.crypto.seq_num = bt_mesh.seq;
+
err = unseg_app_sdu_encrypt(frnd, buf, &meta);
if (err) {
BT_WARN("Re-encryption failed! %d", err);
