|
2 | 2 |
|
3 | 3 | /* |
4 | 4 | * SPDX-FileCopyrightText: 2017 Intel Corporation |
5 | | - * SPDX-FileContributor: 2018-2023 Espressif Systems (Shanghai) CO LTD |
| 5 | + * SPDX-FileContributor: 2018-2024 Espressif Systems (Shanghai) CO LTD |
6 | 6 | * |
7 | 7 | * SPDX-License-Identifier: Apache-2.0 |
8 | 8 | */ |
@@ -967,18 +967,36 @@ int bt_mesh_net_send(struct bt_mesh_net_tx *tx, struct net_buf *buf, |
967 | 967 | } |
968 | 968 |
|
969 | 969 | /* Deliver to local network interface if necessary */ |
970 | | - if (IS_ENABLED(CONFIG_BLE_MESH_NODE) && bt_mesh_is_provisioned() && |
971 | | - (bt_mesh_fixed_group_match(tx->ctx->addr) || |
972 | | - bt_mesh_elem_find(tx->ctx->addr))) { |
973 | | - if (cb && cb->start) { |
974 | | - cb->start(0, 0, cb_data); |
975 | | - } |
976 | | - net_buf_slist_put(&bt_mesh.local_queue, net_buf_ref(buf)); |
977 | | - if (cb && cb->end) { |
978 | | - cb->end(0, cb_data); |
| 970 | + if (((IS_ENABLED(CONFIG_BLE_MESH_NODE) && bt_mesh_is_provisioned()) || |
| 971 | + (IS_ENABLED(CONFIG_BLE_MESH_PROVISIONER) && bt_mesh_is_provisioner_en())) && |
| 972 | + (bt_mesh_fixed_group_match(tx->ctx->addr) || bt_mesh_elem_find(tx->ctx->addr))) { |
| 973 | + /** |
| 974 | + * If the target address isn't a unicast address, then the callback function |
| 975 | + * will be called by `adv task` in place of here, to avoid the callback function |
| 976 | + * being called twice. |
| 977 | + * See BLEMESH24-76 for more details. |
| 978 | + */ |
| 979 | + if (BLE_MESH_ADDR_IS_UNICAST(tx->ctx->addr)) { |
| 980 | + if (cb && cb->start) { |
| 981 | + cb->start(0, 0, cb_data); |
| 982 | + } |
| 983 | + |
| 984 | + net_buf_slist_put(&bt_mesh.local_queue, net_buf_ref(buf)); |
| 985 | + |
| 986 | + if (cb && cb->end) { |
| 987 | + cb->end(0, cb_data); |
| 988 | + } |
| 989 | + |
| 990 | + k_work_submit(&bt_mesh.local_work); |
| 991 | + |
| 992 | + goto done; |
| 993 | + } else { |
| 994 | + net_buf_slist_put(&bt_mesh.local_queue, net_buf_ref(buf)); |
| 995 | + k_work_submit(&bt_mesh.local_work); |
979 | 996 | } |
980 | | - k_work_submit(&bt_mesh.local_work); |
981 | | - } else if (tx->ctx->send_ttl != 1U) { |
| 997 | + } |
| 998 | + |
| 999 | + if (tx->ctx->send_ttl != 1U) { |
982 | 1000 | /* Deliver to the advertising network interface. Mesh spec |
983 | 1001 | * 3.4.5.2: "The output filter of the interface connected to |
984 | 1002 | * advertising or GATT bearers shall drop all messages with |
|
0 commit comments