mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-09-19 07:29:54 +00:00
mesh: Fix set friend_cred flag incorrectly
Only set friend_cred to true when friendship established and use friend cred security material decryption successfully. this is port of 5efe6ff8871b5ed0a68c59a44ef4156b3cfb605e
This commit is contained in:
committed by
Łukasz Rymanowski
parent
0beffcd022
commit
db8da90128
@@ -585,7 +585,6 @@ bool bt_mesh_net_cred_find(struct bt_mesh_net_rx *rx, struct os_mbuf *in,
|
||||
|
||||
BT_DBG("");
|
||||
|
||||
rx->friend_cred = 1U;
|
||||
#if MYNEWT_VAL(BLE_MESH_LOW_POWER)
|
||||
if (bt_mesh_lpn_established()) {
|
||||
rx->sub = bt_mesh.lpn.sub;
|
||||
@@ -597,6 +596,7 @@ bool bt_mesh_net_cred_find(struct bt_mesh_net_rx *rx, struct os_mbuf *in,
|
||||
|
||||
if (cb(rx, in, out, &bt_mesh.lpn.cred[j])) {
|
||||
rx->new_key = (j > 0);
|
||||
rx->friend_cred = 1U;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -630,6 +630,7 @@ bool bt_mesh_net_cred_find(struct bt_mesh_net_rx *rx, struct os_mbuf *in,
|
||||
|
||||
if (cb(rx, in, out, &frnd->cred[j])) {
|
||||
rx->new_key = (j > 0);
|
||||
rx->friend_cred = 1U;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -649,6 +650,7 @@ bool bt_mesh_net_cred_find(struct bt_mesh_net_rx *rx, struct os_mbuf *in,
|
||||
|
||||
if (cb(rx, in, out, &rx->sub->keys[j].msg)) {
|
||||
rx->new_key = (j > 0);
|
||||
rx->friend_cred = 0U;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user