summaryrefslogtreecommitdiff
path: root/mesh/mesh-io-generic.c
Commit message (Collapse)AuthorAgeFilesLines
* mesh: Update the behavior of --io optionInga Stotland2023-05-121-0/+3
| | | | | | | | | | | | | | | This aligns the behavior of command line option --io to add new "auto" value and modify the behavior of "generic" value: *auto* - Use first available controller: via MGMT interface if kernel supports it, otherwise, via raw HCI socket (i.e., default to *generic*). *generic:[hci]<index>* - Use generic HCI io on interface hci<index> The default value is now *auto*, whereas *generic* is used only if the specific HCI controller is explicitly specified.
* mesh: Tighten IO and fix out-of-bounds array accessInga Stotland2023-04-031-60/+10
| | | | | | | This fixes the out-of-bounds array access in mesh-io-mgmt.c caught by address sanitizer. Similar fixes were applied earlier to generic and unit IOs. With this patch, the common code is factored into a centralized location.
* mesh: Add new kernel MGMT based IO transportBrian Gix2022-09-261-36/+11
| | | | | | | | | | | 1. Re-structures MGMT handling such that it is used to detect kernel support of the mesh MGMT opcodes and events before selecting between using MGMT or the legacy raw HCI socket method. 2. Re-structures main() to allow command line to prefer MGMT over HCI or visa versa, plus optionally pass an explicte controller. 3. Adds mesh-io-mgmt as a transport.
* mesh: Fix bug where bluetooth-meshd stops sendingJonas Maes2022-06-211-11/+8
| | | | | | | | | | | | | | | | | When there is a backlog of mesh packets to be sent, the packet sender Fix bug where bluetooth-meshd stops sending When there is a backlog of mesh packets to be sent, the packet sender incorrectly infers that the tx worker thread is already running and therefore needn't be invoked. As a result, the mesh daemon will sometimes stop broadcasting while there are still packets in the queue. It will not resume broadcasting. This patch will invoke the tx worker thread correctly in that case. The logic to send packets at least twice when the transmitter is idle was slightly modified accordingly, and should behave the same way as before.
* mesh: Fix address overrun error in rx filterInga Stotland2022-03-261-9/+19
| | | | | | | | | | | | | | | | | | | | | | | | | This fixes the following error for invalid read access when registering filter for incoming messages: 140632==ERROR: AddressSanitizer: stack-buffer-overflow on address... #0 0x7f60c185741d in MemcmpInterceptorCommon(... #1 0x7f60c1857af8 in __interceptor_memcmp (/lib64/libasan.so... #2 0x55a10101536e in find_by_filter mesh/mesh-io-unit.c:494 #3 0x55a1010d8c46 in l_queue_remove_if ell/queue.c:517 #4 0x55a101014ebd in recv_register mesh/mesh-io-unit.c:506 #5 0x55a10102946f in mesh_net_attach mesh/net.c:2885 #6 0x55a101086f64 in send_reply mesh/dbus.c:153 #7 0x55a101124c3d in handle_method_return ell/dbus.c:216 #8 0x55a10112c8ef in message_read_handler ell/dbus.c:276 #9 0x55a1010dae20 in io_callback ell/io.c:120 #10 0x55a1010dff7e in l_main_iterate ell/main.c:478 #11 0x55a1010e06e3 in l_main_run ell/main.c:525 #12 0x55a1010e06e3 in l_main_run ell/main.c:507 #13 0x55a1010e0bfc in l_main_run_with_signal ell/main.c:647 #14 0x55a10100316e in main mesh/main.c:292 #15 0x7f60c0c6855f in __libc_start_call_main (/lib64/libc.so.6+... #16 0x7f60c0c6860b in __libc_start_main_alias_1 (/lib64/libc.so.6+... #17 0x55a101003ce4 in _start (/home/istotlan/bluez/mesh/bluetooth-m...
* mesh: Fix race condition memory leakBrian Gix2021-05-191-0/+2
| | | | | | | This is a minor fix of a memory leak triggered on process exit if proceess has been killed right after requesting an outbound advertisement be sent. It is harmless, but will cause an occasional static analysis failure.
* mesh: Add SPDX License IdentifierTedd Ho-Jeong An2020-09-211-10/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds SPDX License Identifier and removes the license text. ------------------------------------- License COUNT ------------------------------------- LGPL-2.1-or-later : 48 License: LGPL-2.1-or-later mesh/mesh-mgmt.h mesh/mesh-mgmt.c mesh/net-keys.c mesh/mesh-io-api.h mesh/mesh.h mesh/net-keys.h mesh/model.h mesh/util.h mesh/appkey.c mesh/cfgmod.h mesh/appkey.h mesh/prov.h mesh/prov-acceptor.c mesh/net.c mesh/dbus.h mesh/friend.h mesh/mesh-io-generic.c mesh/main.c mesh/util.c mesh/dbus.c mesh/error.h mesh/mesh-config-json.c mesh/agent.h mesh/pb-adv.c mesh/crypto.c mesh/crypto.h mesh/friend.c mesh/pb-adv.h mesh/provision.h mesh/mesh-config.h mesh/mesh-io-generic.h mesh/agent.c mesh/cfgmod-server.c mesh/mesh-io.h mesh/keyring.h mesh/net.h mesh/keyring.c mesh/mesh-defs.h mesh/mesh.c mesh/rpl.c mesh/manager.c mesh/model.c mesh/mesh-io.c mesh/node.c mesh/prov-initiator.c mesh/rpl.h mesh/node.h mesh/manager.h
* mesh: Add random address to mesh HCI initDaan Pape2020-08-221-0/+9
| | | | This prevents error 0x12 when enabling/disabling LE scans
* mesh: fix double-free of outbound tx dataBrian Gix2020-08-141-21/+31
| | | | | | | Due to the asyncronous multi-step process to send a packet on an HCI socket, an outbound packet could be superseded before send procedure is completed. This change ensures that at any stage in the process, that the pointer to the packet has been fully disposed.
* mesh: Add guard against wedging outbound queueBrian Gix2020-07-291-0/+8
| | | | | | | When using HCI command chains, the first packet send that starts an outbound sequence needs to still exist when command chain completes, or the outbound queue will wedge. The simplest solution is to send packets at least twice on an empty queue, if there is a chance it could be canceled.
* mesh: Fix memory leak when queuing OB pkts rapidlyBrian Gix2020-06-221-10/+14
| | | | | | | | If a new packet for outbound delivery is queued during the last transmission of the only other packet being sent, the prior packet got forgotten and leaked. This fix correctly deletes the prior packet, but also makes sure it is given the proper oportunity for transmission.
* mesh: Debug output clean upInga Stotland2020-06-011-2/+1
| | | | | This changes l_info() to l_debug() for recurring cases and removes some excessive debug output.
* mesh: Fix segfault caused by re-enabling of HCI controllerInga Stotland2020-05-171-56/+79
| | | | | | | | | | | | | This fixes the crash that occurs when a controller used by bluetooth-meshd is removed and then added back again. Also, correctly restart scanning when the controller is re-enabled. Backtrace: 0x00005618e754d040 in ?? () 0x00005618e6e12d9a in io_ready_callback () at mesh/mesh.c:174 0x00005618e6e3d2c8 in l_queue_foreach () at ell/queue.c:441 0x00005618e6e37927 in request_complete () at src/shared/mgmt.c:261
* mesh: rework incoming advertisement filteringBrian Gix2020-02-261-63/+87
| | | | | | | Future versions of Mesh will introduce new advertising packets, which do not fit in the limited and rigid filtering currently used. This minor rewrite allows registering and receiving of *any* AD types, including the filtering on multiple octets of the incoming AD parts.
* mesh: Fix io inititalization sequenceInga Stotland2019-11-151-12/+36
| | | | | | | | | | | This introduces a chain of callbacks to indicate whether mesh io is initialized and mesh network is ready to use. This fixes the reported situation when the receive callbacks were setup before the HCI was fully initialized. In other words, BT_HCI_CMD_LE_SET_SCAN_PARAMETERS was called before BT_HCI_CMD_RESET and, as the result, the callback issueing BT_HCI_CMD_LE_SET_SCAN_ENABLE command was not called.
* mesh: Show error message when io initialization failsMichał Lowas-Rzechonek2019-08-281-1/+4
|
* mesh: Fix double free of a pointer in mesh-io-genericInga Stotland2019-08-081-1/+9
| | | | | This fixes a crash in bluetooth-meshd due to freeing the same pointer twice. The fix is to initialize the address of freed TX buffer to NULL.
* mesh: Add special Beacon handler for ProvisioningBrian Gix2019-07-141-1/+1
| | | | | | | | Provisioning uses the same AD type for Provisioning that is also used by the Secure Network Beacon, but their usage is distinct from each other. This change allows us to enable/disable Unprovisioned Device Beacon capture without disrupting SNB handling.
* mesh: Move HCI handling to mesh-io-genericMichał Lowas-Rzechonek2019-06-241-24/+39
| | | | | | | | | | | This patch separates 'mesh' module from 'mesh_io', particularly regarding configuration and initialization. Main code is no longer aware of MGMT and HCI usage - querying available HCI interfaces now happens in mesh-io-generic. MGMT code is now extracted into mesh-mgmt module, which mesh-io-generic uses to query interfaces.
* mesh: Remove unnecessary includes from .c filesInga Stotland2019-05-171-4/+0
|
* mesh: Update copyright datesInga Stotland2019-05-171-1/+1
|
* mesh: remove uneeded BDADDR type checkBrian Gix2019-01-141-4/+0
| | | | BT_HCI_EVT_LE_ADV_REPORT only comes from legal LE events
* mesh: Rewrite Controler interface for full initBrian Gix2019-01-081-11/+138
| | | | | | Functionaility has been added to allow a BT 4.0 or later controller to be used for Advertising based Mesh usage, regardless of how it was previously initialized.
* mesh: Infrastructure for Mesh daemonBrian Gix2018-08-201-0/+660