Bluetooth: Mesh: Update seqnum when re-encrypting for friend

Sets the sequence number when re-encrypting messages from the friend to
the lpn.

This is a regression from #28511.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
This commit is contained in:
Trond Einar Snekvik 2021-02-08 14:33:38 +01:00 committed by Anas Nashif
commit 512444d863

View file

@ -432,7 +432,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) {
@ -440,6 +441,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);