mesh: Check LPN credentials before establishment

While the friend node considers the friendship established as soon as it
sends the friendship offer, the LPN only considers the friendship
established once it receives the first update after its poll. This
update is encrypted with the friendship credentials, which aren't
available, as they're protected by an if (lpn_established()) check.

Changes the check to lpn_waiting_update(), which makes the LPN check its
friendship credentials only when it's expecting a response to a poll
message. This is the only time the friend will send messages encrypted
with the friendship credentials.

This is port of 040b027e00545326919d323ab1d5272fc8517eb7
This commit is contained in:
Krzysztof Kopyściński
2021-01-12 14:05:19 +01:00
committed by Łukasz Rymanowski
parent 4ccfa1ce03
commit 5642a14a50
+1 -1
View File
@@ -593,7 +593,7 @@ bool bt_mesh_net_cred_find(struct bt_mesh_net_rx *rx, struct os_mbuf *in,
BT_DBG("");
#if MYNEWT_VAL(BLE_MESH_LOW_POWER)
if (bt_mesh_lpn_established()) {
if (bt_mesh_lpn_waiting_update()) {
rx->sub = bt_mesh.lpn.sub;
for (j = 0; j < ARRAY_SIZE(bt_mesh.lpn.cred); j++) {