Commit Graph

26170 Commits

Author SHA1 Message Date
Tedd Ho-Jeong An
b353ae3cf2 tools/mgmt-tester: Update the correct suspend reason for disconnect
This patch fixes the suspend reason for the pairing test cases to the
disconnect.
2021-10-06 10:40:04 -07:00
Tedd Ho-Jeong An
be1af7b8be tools/mgmt-tester: Fix the suspend reason code
This patch fixes the suspend reason code to align with the corrent
kernel implementation.
2021-10-05 11:39:19 -07:00
Tedd Ho-Jeong An
bb12ef4a9f tools/mgmt-tester: Add test cases for load_long_term_keys command
This patch adds extra test cases for load_long_term_keys command.
2021-10-04 16:07:47 -07:00
Miao-chen Chou
f4151f35b2 client: Print error code for connect methods
The following steps were performed.
- Issuing repeated commands to connect the same BLE device.
- Verifying the print in bluetoothctl console

Reviewed-by: Alain Michaud <alainm@chromium.org>
Reviewed-by: Howard Chung <howardchung@google.com>
2021-10-04 15:44:56 -07:00
Miao-chen Chou
e20bd10368 device: Include detailed error string in Connect() return
This replaces generic strerror message with context detailed error
string to better indicate the detailed failure reason so that the D-Bus
clients can optimize their application to work better with BlueZ, e.g.
introducing retry mechanism or building metrics.

Reviewed-by: Alain Michaud <alainm@chromium.org>
Reviewed-by: Howard Chung <howardchung@google.com>
2021-10-04 15:44:56 -07:00
Miao-chen Chou
8f73362e8c error: BR/EDR and LE connection failure reasons
The source of Connect() failures can be divided into the following
three.
- bluetoothd's device interface state transition and profile state
  transition
- Kernel's L2CAP layer state transition
- Potential HCI error codes returned by the remote device

Reviewed-by: Alain Michaud <alainm@chromium.org>
Reviewed-by: Howard Chung <howardchung@google.com>
2021-10-04 15:44:55 -07:00
Miao-chen Chou
de48279160 doc: Add errors.txt to describe errors of D-Bus method returns 2021-10-04 15:44:55 -07:00
Manish Mandlik
cf4144ff47 adv_monitor: Mark the device as lost on device_lost_timeout
Mark the device as lost on device_lost_timeout so that it can be found
again next time.

Verified this by adding a monitor using bluetoothctl and confirming that
the DeviceLost event is getting triggered when bt peer stops advertising
and DeviceFound event gets triggered again when the bt peer restarts the
advertising.

Reviewed-by: Yun-Hao Chung <howardchung@google.com>
2021-10-04 15:44:43 -07:00
Dagan Martinez
61576a8e78 gatt: Allow GATT server to dicate CCC permissions
Allow a GATT server to impose write permissions/restrictions on a CCC by
setting additional `X-notify` and `X-indicate` flags on its associated
characteristic.

This allows a developer to require encryption/authentication in order
for a GATT client to subscribe to server-initiated updates.

```
[bluetooth]# register-characteristic\
	4b75f0f8-1f23-46b1-900c-5bbabcd5ca93 encrypt-read,encrypt-notify

[NEW] Characteristic (Handle 0x0000)
        /org/bluez/app/service0/chrc17
        4b75f0f8-1f23-46b1-900c-5bbabcd5ca93
        Vendor specific
[/org/bluez/app/service0/chrc17] Enter value: 42
```
2021-10-01 10:59:14 -07:00
Dagan Martinez
7d0fc7e7f0 doc/gatt-api: Add 'X-notify/X-indicate`
Update docs to reflect the addition of the `X-notify` and `X-indicate`
characteristic flags, which allow a GATT server to restrict CCC write
permissions.
2021-10-01 10:58:56 -07:00
Tedd Ho-Jeong An
c1e6d6c46f tools/mgmt-tester: Add suspend/resume test cases
This patch adds the suspend/resume test cases:

Suspend/Resume - Success 1 (Suspend)
Suspend/Resume - Success 2 (Resume)
Suspend/Resume - Success 3 (Device in WL)
Suspend/Resume - Success 4 (Advertising)
Suspend/Resume - Success 5 (Pairing - Legacy)
Suspend/Resume - Success 6 (Pairing - SSP)
2021-09-29 15:43:17 -07:00
Tedd Ho-Jeong An
77eed55b30 tools/mgmt-tester: Fix Read Experiemental Feature test case
The quality report feature is supported only if the device support it.
Current emulator/btdev doesn't support it yet.

This patch updates the supported experimental feature list to align with
the current btdev implementation.
2021-09-29 15:43:16 -07:00
Bernie Conrad
838c0dc764 gatt: Fix not cleaning up when disconnected
There is a current use after free possible on a gatt server if a client
disconnects while a WriteValue call is being processed with dbus.

This patch includes the addition of a pending disconnect callback to handle
cleanup better if a disconnect occurs during a write, an acquire write
or read operation using bt_att_register_disconnect with the cb.
2021-09-29 15:43:15 -07:00
Luiz Augusto von Dentz
1e9ce5ed80 client: Print MTU on attribute-info
This prints the MTU of the characteristic when available.
2021-09-28 16:53:08 -07:00
Luiz Augusto von Dentz
3a6b5f5ec1 gatt: Emit PropertiesChanged("MTU") when MTU is exchanged
This notifies client when the ATT MTU changes.
2021-09-28 16:42:58 -07:00
Luiz Augusto von Dentz
9bb8fbe51a shared/att: Add bt_att_register_exchange
This adds bt_att_register_exchange which can be used to register
handlers that gets notified when the MTU gets changed via MTU exchange
procedure.
2021-09-28 16:07:10 -07:00
Luiz Augusto von Dentz
aaa0c4996a gatt: Add implementation of GattCharacteristic1.MTU
This implements MTU property in GattCharacteristic1 interface.
2021-09-28 15:45:05 -07:00
Luiz Augusto von Dentz
1abf1400fa gatt-api: Add MTU property to GattCharacteristic1
This adds MTU properyt to GattCharacteristic1 which can be used in
order to determine how much data can be read/write using non-long
procedures which sometimes is the only thing the remote device
supports.

Fixes: https://github.com/bluez/bluez/issues/199
2021-09-28 15:42:46 -07:00
Luiz Augusto von Dentz
756fbd5ebd doc/tester-config: Enable KASAN
This patch adds CONFIG_KASAN=y in tester config.
2021-09-27 15:27:51 -07:00
Luiz Augusto von Dentz
2df3bba5b7 doc/tester-config: Enable Android Extension
This patch adds Android Extension in tester config.
2021-09-27 15:27:51 -07:00
Tedd Ho-Jeong An
f2db5c7afd doc/tester-config: Enable Microsoft Extension
This patch adds Microsoft Extension in tester config.
2021-09-27 15:27:51 -07:00
Inga Stotland
91c9329a05 tools/mesh-cfgclient: Export configuration database
This adds main menu command "export-db".
When the command is invoked, JSON configuration object is
cloned and trimmed of extraneous properties.
Information about netkeys, appkeys and device keys are obtained
from bluetooth-meshd by calling ExportKeys() method.
The obtained key values are recorded in the export JSON object.
2021-09-27 13:22:40 -07:00
Inga Stotland
7514aa8d9c tools/mesh-cfgclient: Excluded addresses property
The correct name for a property that contains a list of addresses
not allowed in circulation is "networkExclusions"
The "excluded" property in "nodes" array entry is used to indicated that
this node has been removed from a mesh network and it's address should not
be re-used.
2021-09-27 13:22:40 -07:00
Inga Stotland
1616e4883f tools/mesh-cfgclient: Store UUIDs in standard format
Use standard xxxx-xx-xx-xx-xxxxxxxx format for string
representation of mesh and node UUIDs in stored configuration.
2021-09-27 13:22:40 -07:00
Inga Stotland
eb642a59fb mesh: Implement ExportKeys() method
Add implementation for new method ExportKeys() on
org.bluez.mesh.Management1 interface.
This method is used by the authorized application to export information
about network keys, application keys and device keys present in the
local key database.
2021-09-27 13:22:39 -07:00
Inga Stotland
1dc1106895 doc/mesh-api: Add ExportKeys call
Add description for a new method:
ExportKeys() on org.bluez.mesh.Management1 interface.

This method is used by the authorized application to export information
about network keys, application keys and device keys present in the local
key database.
2021-09-27 13:22:39 -07:00
Inga Stotland
4e16431a51 tools/mesh-cfgclient: Add group parent address for DB compliance 2021-09-27 13:22:39 -07:00
Inga Stotland
55f91fd373 tools/mesh-cfgclient: Store remote's heartbeat sub/pub
Store remote node's heartbeat publication or subscription info upon
receiving CONFIG_HEARTBEAT_PUB_STATUS or CONFIG_HEARTBEAT_SUB_STATUS
messages when the messages' status code is set to Success.
2021-09-27 13:22:39 -07:00
Inga Stotland
725ad808fd tools/mesh-cfgclient: Save remote node feature setting
Save the information for remote node's relay, friend, proxy and
secure network beacon settings.
2021-09-27 13:22:39 -07:00
Inga Stotland
8525542fa7 tools/mesh-cfgclient: Rename mesh-db APIs for consistency 2021-09-27 13:22:39 -07:00
Inga Stotland
278805887d tools/mesh-cfgclient: Check the result of config save
After successful completion of configuration commands that change
configuration state of network, the updates are expected to be
recorded in configuration file. If for the results are not saved,
print a warning message.
2021-09-27 13:22:39 -07:00
Inga Stotland
8dc6b45207 tools/mesh-cfgclient: Store remote's model publication info
Update remote node's model publication after a successful completion
of "pub-set" or "pub-get" commands.
2021-09-27 13:22:39 -07:00
Inga Stotland
d66d3d34f9 tools/mesh-cfgclient: Disallow model commands w/o composition
If remote node's composition hasn't been acquired, disallow commands
that change model state (that is, bindings, subscriptions, publications).
Prompt to run "get-composition" command first.
2021-09-27 13:22:39 -07:00
Inga Stotland
5d14cbc2d5 tools/mesh-cfgclient: Store remote node's model subs
Update remote node's model subscriptions after a successful completion
of "sub-add", "sub-del", "sub-wrt" and "sub-del_all" commands.
2021-09-27 13:22:39 -07:00
Inga Stotland
aabda1e487 tools/mesh-cfgclient: Store remote node's model bindings
Update remote node's model binding after a successful completion
of "bind" or "unbind" commands.
2021-09-27 13:22:39 -07:00
Inga Stotland
87d13379a5 tools/mesh-cfgclient: Overwrite config values when adding new ones
This changes common utilities used in mesh-db.c to replace old values
by default whenever a new value is written.
2021-09-27 13:22:39 -07:00
Inga Stotland
e01a82948f tools/mesh: Add new info to stored remote nodes
When adding a new remote node into configuration database,
initialize additional default properties:
"excluded": false
"security": "secure"
"configComplete": false
2021-09-27 13:22:39 -07:00
Inga Stotland
d4e093b54f tools/mesh-cfgclient: Keep track of updated keys 2021-09-27 13:22:39 -07:00
Inga Stotland
ad1ecb0ad8 tools/mesh-cfgclient: Update stored NetKey and AppKey
NetKeys:
- Record additional properties: "name", "minSecurity", "timestamp"

AppKeys:
- Record additional property: "name"
2021-09-27 13:22:39 -07:00
Inga Stotland
a3054bda48 tools/mesh-cfgclient: Add timestamp to config database
This adds timestamp property to the configuration database.
The UTC timestamp format: YYYY-MM-DDThh:mm:ssZ
2021-09-27 13:22:39 -07:00
Inga Stotland
c3da135524 tools/mesh-cfgclient: Save provisioner info
This adds "provisioners" property to the config database.
The property includes the provisioner's name, UUID of the provisioner
device (corresponds to the local node), allocated unicast, group and
scene ranges.
The current implementation limitations:
- only one provisioner in the mesh network is supported,
- the unicast range is assumed to be contiguous,
- the group range is assumed to be contiguous,
- no support for scenes (empty array).
2021-09-27 13:22:39 -07:00
Dagan Martinez
7d4f408839 gatt: remove superfluous extended properties
BlueZ contained superfluous properties that not only did nothing of
value, but needlessly created CEP descriptors for any characteristic
with a secure/encrypted/authenticated flag applied to it.

This actually deviated from the spec(Bluetooth core 5.3, 3.3.3.1) by
setting the reserved bits in the CEPD.
2021-09-27 10:34:41 -07:00
Luiz Augusto von Dentz
5c0857665b avrcp: Fix browsing support in SDP record
Browsing features shall only be marked as supported when ERTM is also
available.
2021-09-24 14:17:54 -07:00
Luiz Augusto von Dentz
2dd006d264 avctp: Fix not handling when kernel has ERTM disabled
If kernel module is loaded with disable_ertm ERTM won't be available
thus browsing channel won't be able to be created, but it shall be
possible to still use AVRCP without it.

Fixes: https://github.com/bluez/bluez/issues/209
2021-09-24 14:17:28 -07:00
Archie Pusaka
0ba16aa232 device: Check both bearers's paired status upon removal of connection
Because Link Key for BREDR can be transformed into LTK for LE (and
vice versa), there is a possibility of getting 'paired' on either of
BREDR/LE without actually connected using the aforementioned bearer.

When removing the connection, we should check both bearers's paired
and bonded status rather than just the one getting disconnected.

Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
2021-09-23 16:20:28 -07:00
Luiz Augusto von Dentz
838741b884 adapter: Truncate number of LTKs loaded if over MGMT MTU
If MGMT MTU cannot accomodate all the existing LTKs only send the ones
that fit in the MTU and leave the remaining as unpaired.
2021-09-22 14:32:38 -07:00
Luiz Augusto von Dentz
ebb9c448ab shared/mgmt: Add mgmt_get_mtu
This adds mgmt_get_mtu function which can be used to query the
transport MTU.
2021-09-22 14:32:38 -07:00
Luiz Augusto von Dentz
023492834d lib: Fix HCI_MAX_ACL_SIZE
HCI_MAX_ACL_SIZE actually includes the maximum frames in AMP controller
so this changes it to properly define the max ACL frames on non-AMP
controllers and introduces a dedicated define for AMP controller as
HCI_MAX_AMP_SIZE.
2021-09-22 14:32:38 -07:00
Luiz Augusto von Dentz
c605e115dd shared/mgmt: Set MTU to UINT16_MAX
This sets MTU of MGMT socket to UINT16_MAX since some commands may
require more than the default size (e.g. Load LTKs).

Fixes: https://github.com/bluez/bluez/issues/201
2021-09-22 14:32:37 -07:00
Archie Pusaka
9ee79f67be doc: Inclusive language update
Update the docs to reflect the changes for the other inclusive
language updates.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2021-09-21 10:51:54 +02:00