Commit Graph

25375 Commits

Author SHA1 Message Date
Szymon Janc
211067d557 avctp: Fix compilation with GCC 10
This one is a false positive but since we never use more than
UINPUT_MAX_NAME_SIZE bytes of name we can silence GCC by reducing
size of source string.

  CC       profiles/audio/bluetoothd-avctp.o
In function ‘uinput_create’,
    inlined from ‘init_uinput’ at profiles/audio/avctp.c:1259:20:
profiles/audio/avctp.c:1188:3: error: ‘strncpy’ output may be truncated copying 79 bytes from a string of length 248 [-Werror=stringop-truncation]
 1188 |   strncpy(dev.name, name, UINPUT_MAX_NAME_SIZE);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
2020-04-20 11:00:00 -07:00
Szymon Janc
df66caf9b3 sap: Fix compilation with GCC 10 2020-04-20 10:59:56 -07:00
Szymon Janc
f8f2962334 android: Fix build with GCC 10
status and state are used to hold various enum types depending on test
and callback passed. Define them as int to avoid warnings about enum
assignment from invalid type.
2020-04-20 10:59:52 -07:00
Brian Gix
ef0970a723 mesh: Fix GCC 10.0 warnings 2020-04-18 08:21:03 -07:00
Olivier Martin
8519cdbf4f emulator: Fix command line parameters with optional argument
Some parameters were missing the indication that additional
argument could be expected.
2020-04-15 16:02:50 -07:00
Pali Rohár
8fcbb6b01f doc: Update documentation for HSP and HFP profiles
Fix information about default rfcomm channel number in HFP HS role
(it is 7, not 6) and add documentation about default values.
2020-04-14 14:00:46 -07:00
Luiz Augusto von Dentz
bc3cd6a3b9 profile: Return -ENOENT for HSP AG
HSP AG role doesn't have any supported features.
2020-04-14 13:24:34 -07:00
Brian Gix
8a73c868b7 mesh: Add Time-outs to critical dbus send-with-replies
JoinComplete() dbus method calls are the only time that node tokens are
delivered to client Applications, so if the call fails for any reason
(including time-outs) the daemon has a way to clean-up the stale unused
node data.
2020-04-14 08:45:47 -07:00
Przemysław Fierek
fda1a55799 tools/mesh-cfgclient: Add waiting for 'JoinComplete' 2020-04-14 08:45:47 -07:00
Przemysław Fierek
a4ead01159 mesh: Change API to deliver tokens via JoinComplete
This patch changes Import and CreateNetwork API to deliver tokens via
the JoinComplete method call.  When application doesn't raise any error
during handling JoinComplete then it is assumed that the token has been
saved, otherwise when application replies with an error message then the
node is removed.
2020-04-14 08:45:47 -07:00
Michał Lowas-Rzechonek
2fb966d804 doc/mesh: Change API to deliver tokens via JoinComplete
If Application is not be able to reliably store the token, the daemon
will end up with a uncontrollable node in its database.

Let's fix the issue by always delivering tokens using JoinComplete call,
and expecting a reply - if the application return an error, daemon will
get rid of the node.
2020-04-14 08:45:47 -07:00
Pali Rohár
e3b8a6484b profile: Add default SDP record for Headset role of HSP 1.2
This would allow D-Bus agents to implement HS role of HSP profile.
2020-04-13 17:07:12 -07:00
Pali Rohár
040bd56a94 profile: Export Remote Audio Volume Control SDP value
Remote Audio Volume Control property in SDP record for HSP HS role
indicates if device supports volume control.

It is required for D-Bus agents which implements audio part of HSP
profile to know if remote device supports volume control or not.

With this change bluez exports status of this SDP property via firt bit
in Features entry in NewConnection() DBus callback method, like for HFP
profile.
2020-04-13 17:06:59 -07:00
Luiz Augusto von Dentz
b84bd5ee0b profile: Remove duplicate initialization of version and profile
These values are always set later by send_new_connection.
2020-04-13 17:06:30 -07:00
Pali Rohár
6a7fe599e7 profile: Fix not setting default features for HFP 1.7
When HFP AG features are not set then according to HFP 1.7.2
specification it has value 0b001001.
2020-04-13 17:06:16 -07:00
Przemysław Fierek
d5cc4ffd55 mesh: Fix invalid app_path on 'Join'
This patch fixes invalid app_path on 'Join' method call - the daemon
tried to use the value of app_root API argument, while it should use
path discovered by scanning result of GetManagedObjects() call.
2020-04-10 06:06:30 -07:00
Szymon Janc
427033253d test/example-advertisement: Fix advertising when discoverable
If adapter is discoverable (or LE-only) advertising was failing due
to too big adv data being set. Make sure there is enough space left
for flags if needed.
2020-04-09 11:27:30 -07:00
Rafał Gajda
60423fed39 mesh: Ignore beacons with IVU if IV already updated
When daemon receives beacon with IV=n+1, IVU=False it will
start sending messages with new IV and set sequence to 0.
However if daemon receives another beacon with IV=n+1, IVU=True it
will go back to sending messages with old IV=n (IVU set to True).
Because sequence number has been reset those messages will be dropped
by replay protection and node will lose communication.

Once IV is updated daemon should not go back to using the old value.

This patch adds beacon rejection if IV has already been updated.
2020-04-08 10:08:31 -07:00
Marcel Holtmann
5b294a5666 monitor: Add support for opening extra mgmt socket for events 2020-04-08 10:09:05 +02:00
Archie Pusaka
cbbb0c2ead shared/att: Check the signature of att packets
Tested to pass these BT certification test
SM/MAS/SIGN/BV-03-C
SM/MAS/SIGN/BI-01-C
2020-04-07 12:52:24 -07:00
Archie Pusaka
18169e7c23 unit/test-crypto: test for bt_crypto_verify_att_sign
Adding tests for verifying att signature
2020-04-07 12:52:24 -07:00
Archie Pusaka
992ce8be2c shared/crypto: Add bt_crypto_verify_att_sign
This is used to verify the signature of incoming ATT packets.
2020-04-07 12:52:23 -07:00
Luiz Augusto von Dentz
397cbeb864 client: Make advertise instances default to discoverable
The more common case is that advertisements are discoverable not the
other way around.
2020-04-07 12:52:23 -07:00
Brian Gix
31003c95d8 tools/mesh-cfgclient: Default to highest security
To encourage best practices, we request the highest level of
security available in common between provision initiator and
acceptor.
2020-04-07 10:01:55 -07:00
Brian Gix
5fc60b2ce7 unit: Exit test-mesh-crypto on any detected fail
Unit test would signal failures if run on commandline, but not if
run as part of a unit test sweep. This change forces an exit(1) on
any detected fail, and is caught by test suite runner.
2020-04-07 09:52:44 -07:00
Michał Lowas-Rzechonek
59aae8b1cc mesh: Remove redundant code from mesh/crypto
- Remove application_encrypt/application_decrypt
- Make mesh_crypto_privacy_counter private, add mesh_crypto_pecb
- Make *_nonce functions private and align their implementation to be
  more consistent
- Refactor network_encrypt/network_decrypt to use *_nonce functions and
  rename them to packet_encrypt/packet_decrypt
- Refactor packet_encode/packet_decode
2020-04-07 09:52:44 -07:00
Luiz Augusto von Dentz
e45b7a21f9 gatt: Fix not sending any data when server supports AcquireWrite
msg.msg_iovlen should be set to 1 to forward the data received over the
file descriptor.
2020-04-07 09:13:17 +02:00
Szymon Janc
590a11b82f gatt: Fix AcquireWrite and AcquireNotify server support
Register read handler only for notify IO and handle socket
disconnection in sock_io_read.
2020-04-07 09:13:17 +02:00
Marcel Holtmann
2a7df9323e monitor: Fix off-by-one error with IRKs and LTKs 2020-04-05 20:51:36 +02:00
Marcel Holtmann
ba3cbc5b1c lib: Update company identifiers 2020-04-05 09:58:31 +02:00
Marcel Holtmann
14301cf0d4 doc: Define bus controller value for VIRTIO transport 2020-04-04 22:24:57 +02:00
Sonny Sasaka
c580e4b332 tools/hciattach_ath3k: Load BT board data based on country code
BT board data file PS_ASIC-<country-code>.pst is loaded based
on country code. If not exist, default BT board data file
PS_ASIC.pst would be loaded.

This patch doesn't define how to get the country code at the moment, but
future patches can supply the country code in the region parameter of
get_ps_file_name.
2020-04-03 19:56:52 +02:00
Inga Stotland
7dc7bee53f tools/mesh-cfgclient: Store "index" as integer in config
Write "index", "elementIndex", "boundNetKey" as integers
rather than hex strings in configuration file.
2020-04-03 00:29:32 -07:00
Inga Stotland
ee436b6e45 tools/mescfg-client: Use local routines for config write
This removes dependencies on internal structures of
mesh/mesh-config-json.c.
2020-04-03 00:29:32 -07:00
Marcel Holtmann
50ac810291 lib: Add details for reading security information command 2020-04-02 15:21:18 +02:00
Marcel Holtmann
47b5609d0b tools: Add command for reading the security information 2020-04-02 15:20:53 +02:00
Marcel Holtmann
9c9e8419e3 doc: Add Read Security Information command description 2020-04-02 15:20:09 +02:00
Marcel Holtmann
35a22bb989 tools: Fix command for reading extended controller information 2020-04-02 13:45:41 +02:00
Marcel Holtmann
de5aa22b1c tools: Add command for toggling wideband speech feature 2020-04-02 13:36:41 +02:00
Marcel Holtmann
65c24b0940 lib: Add missing text for wideband speech command 2020-04-02 13:36:00 +02:00
Luiz Augusto von Dentz
f64f05a515 gatt: Fix Acquire* reply handling
Originally these operation did not set any owner_queue which caused
them to crash if the attribute is freed before the respose, to fix that
the reply will now check if owner_queue was reset to NULL which means
the attribute is no longer available but the owner_queue was never set
in the first place so this ensures they are now setup properly.
2020-04-02 09:58:25 +02:00
Inga Stotland
55d06e0cd5 mesh: Fix segfault related to idle config write
If node configuration is completely removed from the system,
remove all pending writes to the configuration file.

Fixes the segfault below:

mesh/cfgmod-server.c:node_reset() Node Reset
mesh/mesh-config-json.c:mesh_config_destroy() Delete node config /var/lib/bluetooth/mesh/02040d0a060e0a08090b0103070f050c
mesh/util.c:del_fobject() RM /var/lib/bluetooth/mesh/02040d0a060e0a08090b0103070f050c/rpl/00000000/0001
mesh/util.c:del_fobject() RMDIR /var/lib/bluetooth/mesh/02040d0a060e0a08090b0103070f050c/rpl/00000000
mesh/util.c:del_fobject() RMDIR /var/lib/bluetooth/mesh/02040d0a060e0a08090b0103070f050c/rpl
mesh/util.c:del_fobject() RM /var/lib/bluetooth/mesh/02040d0a060e0a08090b0103070f050c/node.json.bak
mesh/util.c:del_fobject() RM /var/lib/bluetooth/mesh/02040d0a060e0a08090b0103070f050c/node.json
mesh/util.c:del_fobject() RMDIR /var/lib/bluetooth/mesh/02040d0a060e0a08090b0103070f050c
Segmentation fault

Program terminated with signal SIGSEGV, Segmentation fault.

  0x0000563a35df2ed0 in ?? ()
  0x00007fd6b131689f in json_object_to_json_string_length (jso=jso@entry=0x563a35dd8d30, flags=flags@entry=2,
2020-04-01 18:27:14 -07:00
Inga Stotland
4e42f2edde mesh: Move SEQ_MASK define in mesh-defs.h 2020-04-01 18:27:14 -07:00
Inga Stotland
1b17e09801 tools/mesh-cfgclient: Add commands for Key Refresh Phase
This adds two new menu commands:
"kr-phase-get" - sends Config Key Refresh Phase Get message
"kr-phase-set" - sends Config Key Refresh Phase Set message
2020-04-01 12:11:35 -07:00
Inga Stotland
2f4dcb4e52 tools/mesh-cfgclient: Save subnet key refresh phase
This records Key Refresh phase of a subnet either as a consequence
of successful execution of subnet-update or subnet-set-phase commands.
2020-04-01 12:11:35 -07:00
Brian Gix
3eaf2f114d mesh: Clear prov capabilities structure before reading
Capabilities need to be zero'd before realtime reading fresh values,
because they are mostly bitmasks, which are set when capabilities are
detected, and never otherwise cleared.
2020-04-01 12:06:15 -07:00
Michał Lowas-Rzechonek
96c50477ba doc/mesh-api: OOB Information field is 16 bit, not 32 2020-04-01 12:06:15 -07:00
Michał Lowas-Rzechonek
1695ec1e0c mesh: Honor provisioner's capabilities
This patch makes the daemon select authentication method based from
capabilities supported by both provisioned node and provisioner
application.
2020-04-01 12:06:14 -07:00
Michał Lowas-Rzechonek
f333ce2d95 mesh: Refresh provisioner's capabilities
As provisioner's capabilities might change during application lifetime
(e.g. no network link to download OOB key), let's query the agent again
after application calls AddNode().
2020-04-01 12:06:14 -07:00
Michał Lowas-Rzechonek
037d452415 mesh: Clean up naming of provisioning callbacks 2020-04-01 12:06:14 -07:00