From 8116a787cd4970e6324a4a0d294027b1f100b999 Mon Sep 17 00:00:00 2001 From: lly Date: Mon, 6 Jan 2020 16:18:52 +0800 Subject: [PATCH] ble_mesh: Fix PreviousAddress endianess in Friend Request The upper transport layer is using big endian ordering. The PreviousAddress field of a Friend Request message should therefore be converted to native endianess using sys_cpu_to_be16(). --- components/bt/esp_ble_mesh/mesh_core/lpn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/bt/esp_ble_mesh/mesh_core/lpn.c b/components/bt/esp_ble_mesh/mesh_core/lpn.c index 06358cac4..a99b28dc4 100644 --- a/components/bt/esp_ble_mesh/mesh_core/lpn.c +++ b/components/bt/esp_ble_mesh/mesh_core/lpn.c @@ -324,7 +324,7 @@ static int send_friend_req(struct bt_mesh_lpn *lpn) .criteria = LPN_CRITERIA, .recv_delay = LPN_RECV_DELAY, .poll_to = LPN_POLL_TO, - .prev_addr = lpn->old_friend, + .prev_addr = sys_cpu_to_be16(lpn->old_friend), .num_elem = comp->elem_count, .lpn_counter = sys_cpu_to_be16(lpn->counter), };