From d5e050727463e622b334c90d27c38787ac8378bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Kopy=C5=9Bci=C5=84ski?= Date: Fri, 30 Oct 2020 12:29:15 +0100 Subject: [PATCH] mesh: Fix handling of app index and local device key Fix problem of not checking if the remote device key is actually our own. this is port of 0469bcdc43e4807ec1356fe2521a6fcd492ab6cb --- nimble/host/mesh/src/transport.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nimble/host/mesh/src/transport.c b/nimble/host/mesh/src/transport.c index 22bb5bc19..8d68dfe1c 100644 --- a/nimble/host/mesh/src/transport.c +++ b/nimble/host/mesh/src/transport.c @@ -1763,7 +1763,9 @@ int bt_mesh_app_key_get(const struct bt_mesh_subnet *subnet, u16_t app_idx, { struct bt_mesh_app_key *app_key; - if (app_idx == BT_MESH_KEY_DEV_LOCAL) { + if (app_idx == BT_MESH_KEY_DEV_LOCAL || + (app_idx == BT_MESH_KEY_DEV_REMOTE && + bt_mesh_elem_find(addr) != NULL)) { *aid = 0; *key = bt_mesh.dev_key; return 0;