Commit Graph

25375 Commits

Author SHA1 Message Date
Michał Lowas-Rzechonek
d565cc8dda mesh: Fix FPE in overcommit logic.
During overcommit, mesh_config_save is called in asynchronous mode to
avoid blocking Send() calls. This means that update of cfg->write_time
is scheduled via l_idle_oneshot, so if the next Send() gets scheduled
first, the code may see elapsed time of zero.

If this happens, then the overcommit logic was already executed and the
overcommit is pending, so we can just return.
2020-06-02 09:08:33 -07:00
Inga Stotland
ad37211780 mesh: Remove unused functions from net.c
The folllowing functionsa are not being used anywhere in the code and
have been removed:
mesh_net_flush()
mesh_net_prov_caps_get()
mesh_net_priv_key_get()
mesh_net_priv_key_set()
mesh_net_prov_rand()
mesh_net_prov_uni()
mesh_net_id_uuid_set()
mesh_net_test_addr()
mesh_net_test_mode()
mesh_net_uni_range_set()
mesh_net_uni_range_get()
mesh_net_set_window_accuracy()
2020-06-01 10:23:11 -07:00
Inga Stotland
962a759e9d mesh: Clean up style in net.c 2020-06-01 10:23:11 -07:00
Inga Stotland
c0013ccdb1 mesh: Remove debug-only related callback for packet send
This removes callback for sending every single access layer packet
since the callback does nothing but print debug satement. This
functionality is mature enough not to require such heavy debugging.
2020-06-01 10:23:10 -07:00
Inga Stotland
cb3088b598 mesh: Debug output clean up
This changes l_info() to l_debug() for recurring cases and
removes some excessive debug output.
2020-06-01 10:23:10 -07:00
Inga Stotland
c0509b127a mesh: Helper packet print should depend on debug setting
This changes the utility function print_packet() to check if
daemon is running in debug mode.
2020-06-01 10:23:10 -07:00
Alain Michaud
2a0ae8294b a2dp: Fix double free in load_remote_sep
This patch fixes a double free condition in load_remote_sep. Value is
freed, then the inner loop is broken, but the rest of the outer loop
will attempt to free value again.
2020-06-01 09:26:43 -07:00
Sonny Sasaka
390c2b0885 a2dp: Fix ref counting bug of setup_unref
In a2dp_reconfig, setup is ref-counted by cb_data. However, in the fail
label setup is unref-ed but cb_data is not cleared. This may cause
double unref in the future if cb_data gets executed. Instead, we should
do setup_cb_free to clear cb_data and unref setup.
2020-06-01 09:24:47 -07:00
Luiz Augusto von Dentz
8486b4cd24 adapter: Fix not removing client from discovery list
If command MGMT_OP_START_DISCOVERY fails we reply with btd_error_busy
but we don't remove the client from the list which would prevent the
client to start it once again.
2020-05-28 15:07:37 -07:00
Luiz Augusto von Dentz
ba91d0ad73 avrcp: Don't attempt to load settings if on volume changed is supported
If only volume changed is supported that means the player cannot really
indicate track/metadata changes so don't attempt to read them.
2020-05-28 14:52:33 -07:00
Luiz Augusto von Dentz
b7fe84c458 avrcp: Fix always requesting player settings for category 1
Player Application settings is not mandatory for category 1 so instead
of always listing the settings the code now checks if
AVRCP_FEATURE_PLAYER_SETTINGS is enabled.
2020-05-27 15:39:56 -07:00
Stimim Chen
7f77964111 shared/shell: don't hook io_hup on non-interactive
When we are in non-interactive mode (data.mode == 1), we should not
terminate the mainloop when stdin is disconnected.

For example, in bash, the following command would terminate immediately
without any output.

  : | btmgmt info
2020-05-27 10:01:52 -07:00
Luiz Augusto von Dentz
92876b244c advertising: Fix advertising flags
When an instance wants to force being discoverable the code shall
actually check if the adapter is in general disverable mode already and
if not set BR/EDR as not supported so that devices scanning don't
assume BR/EDR PHY is connectable when in fact it isn't.
2020-05-26 11:07:48 -07:00
Luiz Augusto von Dentz
d317e8e646 emulator: Use master settings for CIS params
The slave will be the first to respond with CIS Estabished but only the
master has the CIG params set so this switch to master so parameters are
proper.
2020-05-26 09:44:49 -07:00
Brian Gix
ba4289c72e mesh: Destroy PB-ADV queue when provisioning done 2020-05-22 14:07:52 -07:00
Brian Gix
c80f88bdff mesh: Fix leaked message reference 2020-05-22 13:54:39 -07:00
Brian Gix
9084172128 mesh: Fix leaked mesh_net allocation 2020-05-22 13:54:39 -07:00
Brian Gix
29d737730a mesh: Fix using uninitialized bytes
Fixes two problems found with static analysis
2020-05-22 13:54:39 -07:00
Inga Stotland
ebed46f05e mesh: Clean up Join() method
This consolidates various places where a pending response
to Join() is created and makes sure that l_dus_message_unref()
is called correctly.
2020-05-22 13:45:53 -07:00
Inga Stotland
9dd9cba0a2 mesh: Fix memory leak in Create, Import & Attach methods
This ensures that every time l_dbus_message_ref() is used to preserve
a message for a pending method reply, there is a matching call to
l_dbus_message_unref().
2020-05-22 13:45:53 -07:00
Inga Stotland
7a5007178f mesh: Clean up Attach() method call
This consolidates error return form one place: off a callback
with unsuccessful status.
2020-05-22 13:45:53 -07:00
Inga Stotland
1b7d879555 mesh: Clean up Import() method call
This removes unnecessary failing conditions in Import() call and
simplifies iterations through "flags" dictionary.
2020-05-22 13:45:53 -07:00
Inga Stotland
dedc3cb274 mesh: Create a queue of pending requests in mesh_init()
This removes unnnecessary checking for queue existence every time
either Attach(), Create() or Import() methods are called.
2020-05-22 13:45:53 -07:00
Inga Stotland
b0adb615ca mesh: Remove unused function prototypes from node.h 2020-05-22 13:45:53 -07:00
Inga Stotland
7cdc215ff5 mesh: Add finalization of a newly created node
When a new node is created as a result of successful completion
of either Join() or Create() or Import() methods and has been
confirmed via successful token delivery to the application,
clean up node's D-Bus resources (application path, element paths, etc)
that have been gathered during the initial GetMAnagedObjects() call.
Also, remove the agent instance associaed with the new node.

These resources will be re-populated after the Attach() call
verifies the node's integrity.
2020-05-22 13:45:52 -07:00
Inga Stotland
7eca3becce mesh: Remove agent when freeing node's dynamic resources
This adds clean up of node's agent instance when node's dynamic
resources are freed.
2020-05-22 13:45:52 -07:00
Inga Stotland
f5fcab3276 mesh: Free allocated agent in mesh_remove_agent()
This adds previously missing call to free memory allocated
for agent structure.
2020-05-22 13:45:52 -07:00
Inga Stotland
8afaf5e958 mesh: Remove unused structure member
This removes unused "agent" member from join_data structure.
2020-05-22 13:45:52 -07:00
Luiz Augusto von Dentz
1450819e23 emulator: Don't require ACL connection for Setup ISO Data Path
LE Setup ISO Data Path can be used even before the ACL handle exists
when master since Set CIG Parameters will respond with ISO handle it
can then be used to setup the data path in advance of ACL connection.
2020-05-21 10:35:10 -07:00
Alvar Penning
440b07fab1 test/example-advertisement: Fix include_tx_power
Adding the Tx Power Level is no longer done via IncludeTxPower, but via
the tx-power value in the Includes array. The previous code did not
throw an error, but neither led to the insertion of the value. As a
result of this change, include_tx_power now adds the Tx Power Level
again.
2020-05-21 09:21:17 -07:00
Luiz Augusto von Dentz
58f2fcdc79 doc/settings-storage: Update documentation of Endpoints
Add documentation of DelayReporting storage as that has been added to
the cache.
2020-05-21 09:21:15 -07:00
Luiz Augusto von Dentz
e5e5ad9f9a a2dp: Store Delay Reporting capability
This stores Delay Reporting capability so it is properly restored when
loading from cache.
2020-05-21 09:21:12 -07:00
Luiz Augusto von Dentz
18c9091420 doc/media-api: Add documentation for DelayReporting
The code was expecting the endpoint to expose
MediaEndpoint.DelayReporting property in order to expose
MediaTransport.Delay property.
2020-05-21 09:21:10 -07:00
Luiz Augusto von Dentz
adfbafe91c a2dp: Fix caching endpoints for unknown version
Don't cache the capabilities of endpoints which the version is unknown
since so capabilities may not be available in such case.
2020-05-21 09:21:08 -07:00
Brian Gix
0e8ed1f261 mesh: Fix double-free
This fixes a double-free error when destroying the NVM storage of a mesh node.
Cleanly handle two distinct scenarios:

1. When the node is being deleted at runtime.  This causes release of
   both dynamic memory and NVM storage.

2. During shutdown, we release dynamic memory only.
2020-05-20 15:16:55 -07:00
Marcel Holtmann
5b6536954b lib: Update company identifiers 2020-05-20 16:56:29 +02:00
Marcel Holtmann
e85c65c1bb doc: Add information about management version 1.17 2020-05-20 16:43:00 +02:00
Rafael Ávila de Espíndola
e5bb5fa89c HACKING: Mention disabling SELinux
Running bluetoothd from the build directory I noticed that as soon as
a bluetooth audio device was connect, bluetoothd would be disconnected
from dbus and print

Disconnected from D-Bus. Exiting.

Luiz Augusto von Dentz suggested trying with SELinux disabled and that
solved the problem.

This patch just documents how to disable SELinux before running
bluetoothd from the build directory. I would love to say more about
why that is needed, but could not find anything on the audit log.
2020-05-19 10:54:53 -07:00
Miao-chen Chou
a106a3ae3b doc/advertisement-monitor-api: Rename methods and shorten the preset strings
This renames RegisterApplication/UnregisterApplication to
RegisterMonitor/UnregisterMonitor and shortens the strings used in some
properties.
2020-05-18 14:25:42 -07:00
Haakon Drews
9382afca3b hog: Set vendor, product and version for all instances
Set the the correct vendor and product ids for all UHID/HoG
devices when they are unknown at HoG creation time.

Before this change, when connecting a BT device with multiple HoG
services for the first time, only the first HoG instance's vendor,
product and version fields would be set by the DIS callback. This meant
that all HoG instances except the first would be left with unset values
and their UHID devices would then be created with '0000:0000' as their
vendor:product ids.
2020-05-18 14:05:34 -07:00
Luiz Augusto von Dentz
de492ac82d emulator: Fix not reporting LE Set Default PHY as supported
LE Set Default PHY (Octet 35 - Bit 5) is in fact supported.
2020-05-18 09:24:53 -07:00
Marcel Holtmann
8496a438f2 build: Move --enable-hid2hci later in the list options 2020-05-18 09:56:17 +02:00
Marcel Holtmann
3660706726 build: Enable the hid2hci tool for developers by default 2020-05-18 09:54:18 +02:00
Sonny Sasaka
15e8fbfdf1 build: Add an option to explicitly enable hid2hci
hid2hci is no longer a common use. This patch changes the default to not
build and install hid2hci and provide a configure flag --enable-hid2hci
to explicitly enable it.
2020-05-18 09:52:36 +02:00
Inga Stotland
2cd067b8b7 mesh: Fix segfault caused by re-enabling of HCI controller
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
2020-05-17 08:12:20 -07:00
Brian Gix
d18cb97bb5 mesh: Fix valgrind memory leak warnings
These warnings are caused by not completely freeing memory allocations
at shutdown, and are not serious, but they make valgrind output cleaner.
2020-05-15 18:25:30 -07:00
Brian Gix
cc0719ceae mesh: Fix valgrind memory leaks
These memory leaks are ones that will compound over time with node
creation and deletion.
2020-05-15 18:24:18 -07:00
Inga Stotland
a51871bd73 mesh: Remove redundant call to save node configuration
This removes a redundant call to save node configuration in
add_local_node(): there is a number of unconditional calls to
mesh_config_write_<some_node_Setting>() within this function
which would result in the node configuration being saved implicitly.
2020-05-14 09:12:56 -07:00
Inga Stotland
8a38226212 mesh: Allow updating CID, PID, VID & CRPL on node attach
This allows to update settings of the following composition fields
when an existing node (application) attaches to the daemon:
Company ID (CID), Product ID (PID), Versioin ID (VID),
CRPL (replay protection depth)
2020-05-14 09:12:56 -07:00
Inga Stotland
b91f6f0be3 mesh: Avoid saving duplicate fields in node config
This modifies miscellaneous utility functions in mesh-config-json.c:
when writing a new value to a node configuration file, delete
the existing field containing an old value first.
2020-05-14 09:12:56 -07:00