From 77e7d023b9b3762ffa86aba2c74d344531ca86dd Mon Sep 17 00:00:00 2001 From: lly Date: Fri, 6 Dec 2019 11:58:35 +0800 Subject: [PATCH] ble_mesh: Fixes wrong subnet info used for Friend Clear When Friend node tries to send Friend Clear message to other Friend nodes, it should use the subnet information based on the net_idx from friendship. --- components/bt/esp_ble_mesh/mesh_core/friend.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/bt/esp_ble_mesh/mesh_core/friend.c b/components/bt/esp_ble_mesh/mesh_core/friend.c index 880b123e63..67a9ef04cf 100644 --- a/components/bt/esp_ble_mesh/mesh_core/friend.c +++ b/components/bt/esp_ble_mesh/mesh_core/friend.c @@ -363,7 +363,7 @@ static int unseg_app_sdu_unpack(struct bt_mesh_friend *frnd, meta->is_dev_key = (app_idx == BLE_MESH_KEY_DEV); bt_mesh_net_header_parse(&buf->b, &meta->net); err = bt_mesh_app_key_get(meta->subnet, app_idx, &meta->key, - &meta->aid, NODE, meta->net.ctx.addr); + &meta->aid, 0x0, meta->net.ctx.addr); if (err) { return err; } @@ -774,7 +774,7 @@ static void send_friend_clear(struct bt_mesh_friend *frnd) .send_ttl = BLE_MESH_TTL_MAX, }; struct bt_mesh_net_tx tx = { - .sub = &bt_mesh.sub[0], + .sub = bt_mesh_subnet_get(frnd->net_idx), .ctx = &ctx, .src = bt_mesh_primary_addr(), .xmit = bt_mesh_net_transmit_get(),