host/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
@@ -431,6 +431,9 @@ static int unseg_app_sdu_prepare(struct bt_mesh_friend *frnd,
return 0;
}
+ BT_DBG("Re-encrypting friend pdu (SeqNum %06x -> %06x)",
+ meta.crypto.seq_num, bt_mesh.seq);
+
err = unseg_app_sdu_unpack(frnd, buf, &meta);
if (err) {
return err;
@@ -446,6 +449,8 @@ static int unseg_app_sdu_prepare(struct bt_mesh_friend *frnd,
BT_DBG("Re-encrypting friend pdu (SeqNum %06x -> %06x)",
meta.crypto.seq_num, bt_mesh.seq);
+ meta.crypto.seq_num = bt_mesh.seq;
+
err = unseg_app_sdu_decrypt(frnd, buf, &meta);
if (err) {
BT_WARN("Decryption failed! %d", err);
