Commit Graph

26380 Commits

Author SHA1 Message Date
Luiz Augusto von Dentz
63cb7df1ce btdev: Add support for LE Set Privacy mode
This adds support for LE Set Privacy mode which is required when using
Device Privacy mode:

< HCI Command: LE Set Priva.. (0x08|0x004e) plen 8
        Peer Identity address type: Public (0x00)
        Peer Identity address: BC:9A:78:56:34:12 (OUI BC-9A-78)
        Privacy Mode: Use Device Privacy (0x01)
> HCI Event: Command Complete (0x0e) plen 4
      LE Set Privacy Mode (0x08|0x004e) ncmd 1
2021-11-09 14:45:51 -08:00
Luiz Augusto von Dentz
081ba296db media: Fix memory leak
This fixes the following memory leak as a result of not freeing
app->proxies:

160 (32 direct, 128 indirect) bytes in 1 blocks are definitely lost in
loss record 218 of 261
   at 0x484086F: malloc (vg_replace_malloc.c:381)
   by 0x1CF80E: btd_malloc (util.c:33)
   by 0x1CF24D: queue_new (queue.c:47)
   by 0x144DB9: create_app (media.c:2262)
   by 0x144DB9: register_app (media.c:2322)
   by 0x1CC148: process_message (object.c:246)
2021-11-09 14:45:25 -08:00
Luiz Augusto von Dentz
8d2b847b00 client/gatt: Fix using atoi
atoi doesn't support values entered in hexadecimal (0x...) which is
likely the prefered format for the likes of handles, etc, so this
replaces the uses of atoi with strtol.
2021-11-09 14:45:23 -08:00
Jacek Konieczny
ee88dd213b midi: Free ALSA seq resources in midi_device_remove()
Sometimes, on connection error, this gets called and frees the device
when midi_disconnect() was not called which would leave ALSA sequencer
objects leaking.
2021-11-03 17:36:43 -07:00
Archie Pusaka
8d502bb4f8 adapter: Remove "Master" entry from LTK storage
The entry has been deprecated since 2014 and it's time to remove them
altogether.
2021-11-03 17:35:45 -07:00
Archie Pusaka
7b5a4abea2 doc: Add PeripheralLongTermKey for storing LTK
Update doc to reflect update in adapter.c.

Reviewed-by: Sonny Sasaka <sonnysasaka@chromium.org>
2021-11-03 17:35:28 -07:00
Archie Pusaka
1a04dc35b3 adapter: Use PeripheralLongTermKey to store LTK
Introducing PeripheralLongTermKey group for storing LTK info to
replace the less inclusive term. Currently we still need to write/read
from both to ensure smooth transition, but later we should deprecate
the old term.

Reviewed-by: Sonny Sasaka <sonnysasaka@chromium.org>
2021-11-03 17:34:28 -07:00
Luiz Augusto von Dentz
726058e39f device: Fix not updating the auto-connect/accept list
When receiving a new IRK the device address is updated but the old
address is not removed from the auto-connect/accept list.
2021-11-01 21:37:24 -07:00
Luiz Augusto von Dentz
06c8b17448 advertising-api: Clarify Duration property
Duration property refers to the rotation duration not the actual
lifetime of the advertising which is controlled by the Timeout
property.
2021-11-01 21:37:24 -07:00
Luiz Augusto von Dentz
7725579d6a mgmt-tester: Add test for Limited/Device Privacy
This adds a test for Limited/Device Privacy (0x02):

@ MGMT Command: Set Privacy (0x002f) plen 17
        Privacy: Limited (0x02)
        Key: 01020304050607080102030405060708
@ MGMT Event: Command Complete (0x0001) plen 7
      Set Privacy (0x002f) plen 4
        Status: Success (0x00)
        Current settings: 0x00002080
          BR/EDR
          Privacy
@ MGMT Event: New Settings (0x0006) plen 4
        Current settings: 0x00002080
          BR/EDR
          Privacy
2021-11-01 21:37:23 -07:00
Luiz Augusto von Dentz
7234c7394e main.conf: Fix Privacy modes
Device privacy 0x01 uses RPA regardless of the discoverable setting thus
it conforms to network mode not device mode.

Also this improves documentation to state what is the expectation of
each mode since it may not have been very clear by just using the terms
from the spec.
2021-11-01 21:37:23 -07:00
Tedd Ho-Jeong An
28e85e549d tools/mgmt-tester: Add LL Privacy test cases
This patch adds LL Privacy related test cases.

Multi Ext Advertising - Success 3 (Add 2 Advs)
Multi Ext Advertising - Success 4 (Remove Adv)
Multi Ext Advertising - Success 5 (Remove all)
Multi Ext Advertising - Success 6 (Add w/o power on)
Multi Ext Advertising - Fail (Add MAX)

LL Privacy - Add Device 1 (Add to AL)
LL Privacy - Add Device 2 (Add to RL)
LL Privacy - Add Device 3 (Enable RL)
LL Privacy - Add Device 4 (2 Devices to AL)
LL Privacy - Add Device 5 (2 Devices to RL)
LL Privacy - Add Device 6 (RL is full)
LL Privacy - Add Device 7 (WL is full)
LL Privacy - Add Device 8 (Disable Adv)
LL Privacy - Add Device 9 (Multi Adv)
LL Privacy - Add Device 10 (Multi Dev and Multi Adv)

LL Privacy - Remove Device 1 (Remove from AL)
LL Privacy - Remove Device 2 (Remove from RL)
LL Privacy - Remove Device 3 (Disable RL)
LL Privacy - Remove Device 4 (Disable Adv)
LL Privacy - Remove Device 5 (Multi Adv)

LL Privacy - Start Discovery 1 (Disable RL)
LL Privacy - Start Discovery 2 (Disable RL)

LL Privacy - Advertising 1 (Scan Results)
LL Privacy - Acceptor 1
LL Privacy - Acceptor 2

LL Privacy - Pair 1
LL Privacy - Pair 2 (Add to AL)
LL Privacy - Unpair 1
LL Privacy - Unpair 2 (Remove from AL)
2021-10-29 13:50:59 -07:00
Tedd Ho-Jeong An
1d6766a077 tools/mgmt-tester: Update the expected manufacturer of emulator
This patch updates the expected manufacturer of the emulator for the
following test cases:

> Read Ext Controller Info 1                           Failed
> Read Ext Controller Info 2                           Failed
> Read Ext Controller Info 3                           Failed
> Read Ext Controller Info 4                           Failed
> Read Ext Controller Info 5                           Failed
2021-10-29 13:50:58 -07:00
Luiz Augusto von Dentz
6b59e816dd device: Fix not clearing error on update_bredr_services
When trying to loads contents from file using g_key_file_load_from_file
it may cause an error which needs to be cleared since the gerr is
reused, also make sure the file is always created upfront to avoid
having such error when storage has not been initialized.
2021-10-28 14:36:38 -07:00
Luiz Augusto von Dentz
c37341904a obexd: Add missing phonebook backends
This adds missing phonebook backends to EXTRA_DIST so they can be build
from tarballs.

Fixes: https://github.com/bluez/bluez/issues/222
2021-10-26 11:17:42 -07:00
Luiz Augusto von Dentz
70807e8ff2 Makefile: Fix code style
Fix lines going over 80 columns.
2021-10-26 11:13:20 -07:00
Bernie Conrad
259407032a gatt: added missing disconn_id's and removed extra check
Adds missing assignment to disconn_id for pending operations and removes
check that is already handled by checking if the owner_queue of the op
is gone at the start of write_reply_cb.
2021-10-25 13:41:46 -07:00
Tedd Ho-Jeong An
380f6ba6a7 tools/mgmt-tester: Add support for experimental feature in setup
This patch adds support for experimental feature in setup_settings
options.
2021-10-25 13:38:36 -07:00
Tedd Ho-Jeong An
435a55db08 emulator: Add support to get the advertising address
This patch add supprt emulator to get the advertising address of the
central device.
2021-10-25 13:38:36 -07:00
Tedd Ho-Jeong An
9dcd6ea1f9 emulator: bthost: Add support LE Ext Adv Report
This patch adds support LE_Extended_Advertising_Report Eevnt in bthost.
2021-10-25 13:38:35 -07:00
Tedd Ho-Jeong An
f669f9bd1a emulator: Add support to config the accept and resolve list
This patch adds interfaces to config the accept list and resolve list in
the btdev.
2021-10-25 13:38:35 -07:00
Luiz Augusto von Dentz
0626b79214 btdev: Fix using the callback return as command complete
Command callback can only be used when generating a command status as
command complete can carry more than just the status.
2021-10-25 11:19:35 -07:00
Luiz Augusto von Dentz
8b6b9b7756 adapter: Fix storing IRK causing invalid read
When storing an IRK the storage file may not have been created yet
since that uses the device address which is likely changed to the
identity address causing the following trace:

Invalid read of size 8
   at 0x196452: store_irk.constprop.0 (adapter.c:8679)
   by 0x198C92: new_irk_callback (adapter.c:8737)
   by 0x1CF6DC: queue_foreach (queue.c:207)
   by 0x1D1394: process_notify (mgmt.c:308)
   by 0x1D1394: can_read_data (mgmt.c:374)
   by 0x1E0634: watch_callback (io-glib.c:157)
   by 0x4954A9E: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.6600.8)
   by 0x49A6A97: ??? (in /usr/lib64/libglib-2.0.so.0.6600.8)
   by 0x4954162: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.6600.8)
   by 0x1E0CD4: mainloop_run (mainloop-glib.c:66)
   by 0x1E10B1: mainloop_run_with_signal (mainloop-notify.c:188)
   by 0x12E3FC: main (main.c:1210)
 Address 0x6534418 is 8 bytes inside a block of size 16 free'd
2021-10-22 13:10:09 -07:00
Luiz Augusto von Dentz
329b910bab btdev: Set Local RPA when own_addr_type is 0x03
This enables the emulator to properly emulate the generation of a Local
RPA so it always set the random_addr when Create Connection sets 0x03 as
own_addr_type 0x03:

< HCI Command: LE Extended.. (0x08|0x0043) plen 26
        Filter policy: Accept list is not used (0x00)
        Own address type: Random (0x03)
        Peer address type: Public (0x00)
        Peer address: 00:AA:01:01:00:00 (Intel Corporation)
        Initiating PHYs: 0x01
        Entry 0: LE 1M
          Scan interval: 60.000 msec (0x0060)
          Scan window: 60.000 msec (0x0060)
          Min connection interval: 30.00 msec (0x0018)
          Max connection interval: 50.00 msec (0x0028)
          Connection latency: 0 (0x0000)
          Supervision timeout: 420 msec (0x002a)
          Min connection length: 0.000 msec (0x0000)
          Max connection length: 0.000 msec (0x0000)
> HCI Event: Command Status (0x0f) plen 4
      LE Extended Create Connection (0x08|0x0043) ncmd 1
        Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 31
      LE Enhanced Connection Complete (0x0a)
        Status: Success (0x00)
        Handle: 42
        Role: Central (0x00)
        Peer address type: Public (0x00)
        Peer address: 00:AA:01:01:00:00 (Intel Corporation)
        Local resolvable private address: 60:0C:C5:B9:10:5D (Resolvable)
        Peer resolvable private address: 00:00:00:00:00:00 (Non-Resolvable)
        Connection interval: 50.00 msec (0x0028)
        Connection latency: 0 (0x0000)
        Supervision timeout: 420 msec (0x002a)
        Central clock accuracy: 0x00
2021-10-21 15:34:33 -07:00
Luiz Augusto von Dentz
8ab3b9e3ec mgmt-tester: Fix expected manufacturer
The emulator is now using Linux Foundation manufacturer ID.
2021-10-21 15:25:15 -07:00
Archie Pusaka
7cb83c3c0b tools/hcitool: Fix the descriptions of leal* commands
The descriptions of leal* commands are copied from lewl* commands.
However they should use "accept list" instead.
2021-10-21 13:30:12 -07:00
Luiz Augusto von Dentz
c49cf69837 emulator: Add initial support for MSFT vendor commands
This adds the initial support for MSFT vendor commands and enable them
when in btvirt:

< HCI Command: Microsoft Ex.. (0x3f|0x001e) plen 1
      Read Supported Features (0x00)
> HCI Event: Command Complete (0x0e) plen 14
      Microsoft Extension (0x3f|0x001e) ncmd 1
      Read Supported Features (0x00)
        Status: Success (0x00)
        Features: 0x3f 0x00 0x00 0x00 0x00 0x00 0x00 0x00
          RSSI Monitoring feature for BR/EDR
          RSSI Monitoring feature for LE connections
          RSSI Monitoring of LE advertisements
          Advertising Monitoring of LE advertisements
          Verifying the validity of P-192 and P-256 keys
          Continuous Advertising Monitoring
        Event prefix length: 0
        Event prefix:
< HCI Command: Microsoft Ex.. (0x3f|0x001e) plen 2
      LE Set Advertisement Filter Enable (0x05)
        Enable: All filter conditions (0x01)
> HCI Event: Command Complete (0x0e) plen 5
      Microsoft Extension (0x3f|0x001e) ncmd 1
      LE Set Advertisement Filter Enable (0x05)
        Status: Success (0x00)
2021-10-21 11:32:24 -07:00
Luiz Augusto von Dentz
47be9d4056 monitor: Enable decoding of MSFT extension with emulator
This enables decoding MSFT extension with emulator instances since it
shall be the only one using Linux Foundation as manufacturer.
2021-10-21 11:32:23 -07:00
Luiz Augusto von Dentz
655078d1f8 btdev: Use Linux Foundation as manufacturer
This makes the emulator use Linux Foundation manufacturer id which
shall be simpler to distinguish emulator instances since it is unlikely
there will be other vendors using it.
2021-10-21 11:32:22 -07:00
Luiz Augusto von Dentz
a6b2fd7bf2 emulator/vhci: Fix writing msft_opcode using binary format
debugfs expects values in string format not binary format.
2021-10-21 11:32:21 -07:00
Luiz Augusto von Dentz
5226a2d359 monitor/msft: Add feature bits definition
This adds the feature bits definition used in
HCI_VS_MSFT_Read_Supported_Features.
2021-10-21 11:32:20 -07:00
Luiz Augusto von Dentz
46ee5feb55 monitor/msft: Fix uuid.u128 format
128 bits are actually 16 octecs not 8.
2021-10-21 11:32:20 -07:00
Tedd Ho-Jeong An
1b0374157c peripheral: Fix unchecked return value
This patch fixes the unchecked return value(CWE-252) issues reported by
the Coverity.
2021-10-18 15:31:55 -07:00
Tedd Ho-Jeong An
96ffb02e2b obexd: Fix unchecked return value
This patch fixes the unchecked return value(CWE-252) issues reported by
the Coverity.
2021-10-18 15:31:55 -07:00
Tedd Ho-Jeong An
799f6ff793 mesh: Fix unchecked return value
This patch fixes the unchecked return value(CWE-252) issues reported by
the Coverity.
2021-10-18 15:31:55 -07:00
Tedd Ho-Jeong An
cd75918d21 profiles/input: Fix unchecked return value
This patch fixes the unchecked return value(CWE-252) issues reported by
the Coverity.
2021-10-18 15:31:55 -07:00
Tedd Ho-Jeong An
4ad622d592 profiles/a2dp: Fix unchecked return value
This patch fixes the unchecked return value(CWE-252) issues reported by
the Coverity.
2021-10-18 15:31:55 -07:00
Tedd Ho-Jeong An
0b23a290d0 plugins/admin: Fix unchecked return value
This patch fixes the unchecked return value(CWE-252) issues reported by
the Coverity.
2021-10-18 15:31:54 -07:00
Tedd Ho-Jeong An
1dbc27ec33 attrib-server: Fix unchecked return value
This patch fixes the unchecked return value(CWE-252) issues reported by
the Coverity.
2021-10-18 15:31:54 -07:00
Tedd Ho-Jeong An
2287c517ca adapter: Fix unchecked return value
This patch fixes the unchecked return value(CWE-252) issues reported by
the Coverity.
2021-10-18 15:31:54 -07:00
Tedd Ho-Jeong An
6a154cd080 device: Fix unchecked return value
This patch fixes the unchecked return value(CWE-252) issues reported by
the Coverity.
2021-10-18 15:31:53 -07:00
Tedd Ho-Jeong An
fb9f9db151 build: Fix build error with ell/cleanup.h
This patch fixes the build error due to missing ell/cleanup.h.

./ell/util.h:33:10: fatal error: ell/cleanup.h: No such file or directory
   33 | #include <ell/cleanup.h>
      |          ^~~~~~~~~~~~~~~
2021-10-18 13:08:27 -07:00
Luiz Augusto von Dentz
3f03ea4aeb mgmt-tester: Make use of vhci_set_force_suspend/vhci_set_force_wakeup
This replaces the direct setting debugfs to use vhci instance which
properly stores the controller index so it can be used even if there
are real controllers in the system.
2021-10-18 13:04:28 -07:00
Luiz Augusto von Dentz
016084253b vhci: Add functions to interface with debugfs
This adds functions that can be used to set debugfs options.
2021-10-18 13:04:27 -07:00
Luiz Augusto von Dentz
135f5d8258 hciemu: Use vhci_open to instanciate a vhci btdev
This makes use of vhci_open to isntanciate the vhci btdev since that
has proper support for reading the index assigned to it.
2021-10-18 13:04:25 -07:00
Luiz Augusto von Dentz
66573e120f vhci: Use io.h instead of mainloop.h
The likes of mainloop_add_fd is not implemented in mainloop-glib.c while
io_set_read_handler so this makes it possible to use vhci instance with
both libshared-glib and libshared-mainloop.
2021-10-18 13:04:24 -07:00
Luiz Augusto von Dentz
16f01989c2 vhci: Read the controller index
This makes vhci instance read its controller index assigned by the
kernel and also introduces vhci_get_btdev so it can be used by the
likes of hciemu.
2021-10-18 13:04:24 -07:00
Luiz Augusto von Dentz
beb5cc05e8 monitor: Make use of MSFT packet definitions
This make use of the packet definitions for MSFT extension.
2021-10-18 13:04:21 -07:00
Luiz Augusto von Dentz
7d49b158ba monitor: Add packet definitions for MSFT extension
This adds proper packet definitions for command and response of MSFT
extension.
2021-10-18 13:03:31 -07:00
Marcel Holtmann
8ac79215ff Release 5.62 2021-10-13 20:33:40 +02:00