Bluetooth: Mesh: Initialize msg_ctx when re-encrypting friend msg
Set app_idx and net_idx in the msg_ctx before calling bt_mesh_keys_resolve when re-encrypting friend messages, as they'll be referenced inside the function. Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
This commit is contained in:
parent
ddc595b662
commit
48526b6925
1 changed files with 8 additions and 1 deletions
|
@ -350,7 +350,12 @@ static int unseg_app_sdu_unpack(struct bt_mesh_friend *frnd,
|
|||
struct unseg_app_sdu_meta *meta)
|
||||
{
|
||||
uint16_t app_idx = FRIEND_ADV(buf)->app_idx;
|
||||
struct bt_mesh_net_rx net;
|
||||
struct bt_mesh_net_rx net = {
|
||||
.ctx = {
|
||||
.app_idx = app_idx,
|
||||
.net_idx = frnd->subnet->net_idx,
|
||||
},
|
||||
};
|
||||
int err;
|
||||
|
||||
meta->subnet = frnd->subnet;
|
||||
|
@ -427,6 +432,8 @@ static int unseg_app_sdu_prepare(struct bt_mesh_friend *frnd,
|
|||
return 0;
|
||||
}
|
||||
|
||||
BT_DBG("Re-encrypting friend pdu");
|
||||
|
||||
err = unseg_app_sdu_decrypt(frnd, buf, &meta);
|
||||
if (err) {
|
||||
BT_WARN("Decryption failed! %d", err);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue