| 5ed8cec7 |
mesh: Keep element and model lists sorted and unique
This keeps composition data unchanged even if elements or models are
registered in a different order. |
Michał Lowas-Rzechonek |
6 years ago |
1 file, +67, -13 |
| 07e16e8a |
mesh: Validate application by comparing composition data
Instead of validating application by enumerating D-Bus objects, create a
temporary node instance and check if composition data generated for the
temporary matches the node loaded from storage.
This allows node validation logic (primary element, mandatory models etc)
to be confined in node_generate_comp() function.
This also streamlines code implementing Attach(), Join() and
CreateNetwork() calls. |
Michał Lowas-Rzechonek |
6 years ago |
2 files, +195, -239 |
| 7cd089ea |
mesh: Convert void pointers to anonymous unions in managed_obj_request |
Michał Lowas-Rzechonek |
6 years ago |
1 file, +35, -40 |
| b1ecae6b |
test/test-mesh: Initialize required properties
This initialized required "Models" and "VendorModels" properties
wheher the actual models exist or not, according to the mesh-api.txt.
In case when an element does not contain either SIG defined models or
vendor defineed models, the corresponding properties should contain
empty arrays. |
Inga Stotland |
6 years ago |
1 file, +2, -4 |
| efcf88bf |
mesh: Fix storage init of Friend and LPN features
This fixes a typo in mesh-config-json.c when Friend feature
was initialized twice and LPN was not initialized at all. |
Inga Stotland |
6 years ago |
1 file, +1, -1 |
| 4b0bfe96 |
doc/mesh-api: Restore properties in mesh node hierarchy
This restores Features, Beacon, BeaconFlags, IvIndex and
SecondsSinceLAst heard properties under the
org.bluez.mesh.Node1 interface. |
Inga Stotland |
6 years ago |
1 file, +49, -49 |
| 79bf51db |
mesh: Check address range passed to ImportRemoteNode
+changed "not authorized" error to "invalid args" when managing device
key for local address range |
Michał Lowas-Rzechonek |
6 years ago |
7 files, +36, -4 |
| 060b3439 |
mesh: Propagate Net Index up Rx message chain
When a model receives a message, it is required by the spec
to respond using the same credentials. When an App Key is used,
this is trivial because App keys are bound to Net keys, so only
the App Index is required. Messages received on a Device key
however, need the Net Index preserved from original message for
re-use during the response. |
Brian Gix |
6 years ago |
6 files, +214, -187 |
| 8f0839a1 |
mesh: Normalize Access Key AID naming convention |
Brian Gix |
6 years ago |
3 files, +23, -26 |
| 51d9bb20 |
mesh: Add bound Net Index lookup for App Keys
This patch also normalizes the naming convention in favor of key_aid
when referring to the calculated AID of the used Access Layer key. |
Brian Gix |
6 years ago |
2 files, +39, -21 |
| faa7894b |
mesh: Allow sending on org.bluez.mesh.Provisioner1
This adds a new interface permission to bluetooth-mesh.conf:
<allow send_interface="org.bluez.mesh.Provisioner1"/> |
Inga Stotland |
6 years ago |
1 file, +1, -0 |
| d9ef18ff |
mesh: Init keyring storage directory on node Attach()
This adds initialization of keyring storage directory when
a mesh node is attached successfully. |
Inga Stotland |
6 years ago |
1 file, +8, -0 |
| 3937a002 |
mesh: Rename mesh_config_srv_init() to cfgmod_server_init()
This renames mesh_config_srv_init() to cfgmod_server_init() to avoid
confusion with mesh_config_..> API and to reflect that the call pertains
to configuration server model. |
Inga Stotland |
6 years ago |
3 files, +4, -4 |
| 2881bc14 |
mesh: Create or re-use a node storage directory for keyring
This adds APIs to set a directory for storing node's key ring info.
The directory is named MESH_STORAGE_DIR/<node uuid>. This directory
may contain additional node info plus node configuration, if node
configuration storage follows the same layout (as it does when
JSON based config file format is used). |
Inga Stotland |
6 years ago |
3 files, +51, -29 |
| 7cafe5fd |
mesh: Manage node config directory in mesh-config
This completely removes storage.c file. Instead, the handling
of mesh node configuration storage is done completely in
mesh-config layer by calling the following API functions:
bool mesh_config_load_nodes(const char *cfg_dir,
mesh_config_node_func_t cb,
void *user_data)
void mesh_config_release(struct mesh_config *cfg)
void mesh_config_destroy(struct mesh_config *cfg)
bool mesh_config_save(struct mesh_config *cfg, bool no_wait,
mesh_config_status_func_t cb, void *user_data)
struct mesh_config *mesh_config_create(const char *cfg_path,
const uint8_t uuid[16],
struct mesh_config_node *node) |
Inga Stotland |
6 years ago |
13 files, +254, -353 |
| d5752462 |
mesh: Use mesh_config APIs to store node configuration
This eliminates storage_set...() routines as an intermediate
layer between mesh_config layer and the rest of the daemon when
storing updated node configuration values.
For the JSON based implementation, each call to mesh_config_write...()
routines results in writing to the node configuration file. |
Inga Stotland |
6 years ago |
9 files, +155, -340 |
| c4bf0626 |
mesh: Replace storage_save_config with mesh_config_save_config
This moves writing out of node configuration from storage.c down to
mesh-config-<format-specific>.c to allow for more generic storage layout.
New generalized API in mesh-config.h:
mesh_config_save_config(struct mesh_config *cfg, bool no_wait,
mesh_config_status_func_t cb, void *user_data)
replaces the old one in storage.h:
storage_save_config(struct mesh_node *node, bool no_wait,
mesh_status_func_t cb, void *user_data)
Currently, only JSON format is supported for storing node configuration:
mesh_config_save_config is implemented in mesh-config-json.c |
Inga Stotland |
6 years ago |
5 files, +84, -85 |
| d8b2bef4 |
mesh: Confine dependency on json-c to mesh-config-json.c
This removes dependency on json-s/json.h header from everywhere
in the code except for mesh-config-json.c. The details about
node configuration storage format are obfuscated: a pointer
to an opaque mesh_config structure is stored with mesh_node and is
passed around to mae all the storage related operations. |
Inga Stotland |
6 years ago |
8 files, +525, -384 |
| d1a76eb3 |
mesh: Move load from storage functionality into node.c
This moves the initialization of a mesh node from stored
configuration from storage.c to node.c |
Inga Stotland |
6 years ago |
4 files, +215, -200 |
| 78668a02 |
mesh: Change mesh_db prefix to mesh_config
This changes the naming the API declarations in mesh-config.h:
mesh_db_... ->mesh_config_... |
Inga Stotland |
6 years ago |
6 files, +234, -215 |
| 0c698b33 |
mesh: Rename mesh-db.c to mesh-config-json.c
This moves mesh-db.h to mesh-config.h and mesh-db.c to mesh-config-json.c.
mesh-config.h declares common APIs for storing mesh node configuration.
mesh-config-json.c defines the APIs for JSOn specific storage.
This allows for future parallel implementation a different (not JSON-based)
mechanism of storing node configuration. |
Inga Stotland |
6 years ago |
9 files, +1946, -1949 |
| 76700ab9 |
mesh: Move network config setup from storage.c to node.c
This commit moves initialization of configuration parameters
for node->net when the local node state is restored from stored
configuration. Old location: storage.c, new locaiton node.c. |
Inga Stotland |
6 years ago |
2 files, +28, -39 |
| d6cafa1f |
input/hog: Remove HID device after HoG device disconnects
When the Bluetooth LE device disconnects, make sure to also destroy the
uHID device so that we don't have a lingering HID device accessible from
user-space.
This also fixes the input subsystem never seeing the device reattaching,
causing settings that should be applied on connection not to be applied.
https://bugzilla.kernel.org/show_bug.cgi?id=202909
Tested-by: Bastien Nocera <hadess@hadess.net> |
Benjamin Tissoires |
6 years ago |
1 file, +2, -0 |
| 14bbd653 |
test: This extends the mesh tool to exercise Provisioning methods
Note: This script is *not* a suitable tool for expanding into
a Mesh Provisioner. It is only intended to demonstrate the arguments
and methods required. |
Brian Gix |
6 years ago |
1 file, +113, -0 |
| 2e467710 |
mesh: Convert provisioning pkts to packed structs
Provisioning packets are defined in the specification
as packed big endian structures. Instead of specifying
an octet array, we now use struct matching the spec. |
Brian Gix |
6 years ago |
8 files, +247, -154 |
| 20585d78 |
mesh: Implement DBus Provisioning methods
This implements the Interface and Methods for:
UnprovisionedScan()
UnprovisionedScanCancel()
AddNode() |
Brian Gix |
6 years ago |
1 file, +296, -8 |
| f7856093 |
mesh: Fix implementation of Provisioner Initiator
This has had testing of baseline functionality that includes
OOB authentication type "3c" from BT Mesh v1.0 specification |
Brian Gix |
6 years ago |
2 files, +203, -58 |
| 76a7c417 |
mesh: Expose resources needed by Management1 interface |
Brian Gix |
6 years ago |
2 files, +35, -10 |
| 5f6dd3ff |
mesh: Expose mapping function for D-Bus errors |
Brian Gix |
6 years ago |
2 files, +5, -4 |
| ce299519 |
mesh: Add special Beacon handler for Provisioning
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. |
Brian Gix |
6 years ago |
3 files, +9, -6 |
| fea55846 |
mesh: Fix support for Provisioner Initiator |
Brian Gix |
6 years ago |
4 files, +77, -58 |
| cfec54d3 |
doc: Cleanup API Provisioner1 interface
Modified the RequestProvData In and Out param list to eliminate
parameters which can be provided by the Node which owns the
procedure, and clean-up the actual error list. |
Brian Gix |
6 years ago |
1 file, +8, -5 |
| 47a07dd3 |
emulator: Fix condition check in btdev_create()
This fixes a case where logical '||' was used with constant operand
and the condition check always resulted in true.
Was: if (type == BTDEV_TYPE_BREDRLE || type == BTDEV_TYPE_LE
|| BTDEV_TYPE_BREDRLE50)
Fixed: if (type == BTDEV_TYPE_BREDRLE || type == BTDEV_TYPE_LE
|| type == BTDEV_TYPE_BREDRLE50) |
Inga Stotland |
6 years ago |
1 file, +1, -1 |
| 721c1779 |
gatt: Fix failure of repeated AcquireNotify calls
This patch fixes a problem that can be encountered if a DBUS client
performs the following steps:
1) Calls AcquireNotify on a characteristic
2) Closes the fd produced by AcquireNotify
3) Immediately calls AcquireNotify again on the same characteristic
4) Disconnects DBUS client (does not have to be immediately)
5) Reconnects DBUS client and call AcquireNotify
If these steps are followed, then the third call to AcquireNotify
will often be responded to with an error message stating "Notify
acquired". Furthermore, the second call to AcquireNotify will not be
provided with an fd.
It turns out that the following was happening: Closing the fd causes
bluez to disable notifications on that characteristic by writing to
the CCC. If the second call to AcquireNotify is made before that CCC
write has completed, then a new write to the CCC to re-enable
notifications is enqueued. Once that first write has completed, the
second write is then taken from the queue and started in
`disable_ccc_callback()`. Unfortunately `disable_ccc_callback()` was
not actually using the data from the queue, but was instead just
re-using the data that it had been passed (`notify_data` instead of
`next_data`).
This meant that the write to the CCC to enable notifications would
happen, but the callback that needed to be made to the code that was
waiting for the enqueued operation to complete would never happen. In
this AcquireNotify case, the register_notify_io_cb() function would
not be called, resulting in no socket creation and no response to the
second AcquireNotify call. Instead it would leave some state
hanging around on bluez's representation of the characteristic, and so
subsequent calls to AcquireNotify by any DBUS client would fail with
the aforementioned error.
The fix is simple here -- make `disable_ccc_callback()` pass the
correct data through. |
Rob Spanton |
6 years ago |
1 file, +1, -1 |
| de02cf25 |
shared/hfp: Fix using uninitialized value
This fixes the following trace when running unit tests:
at 0x409597: is_response (hfp.c:1009)
by 0x409597: hf_call_prefix_handler (hfp.c:1103)
by 0x409955: hf_process_input (hfp.c:1176)
by 0x409955: hf_can_read_data (hfp.c:1240)
by 0x40C0E8: watch_callback (io-glib.c:170)
by 0x48C3EDC: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.6000.3)
by 0x48C426F: ??? (in /usr/lib64/libglib-2.0.so.0.6000.3)
by 0x48C45A2: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.6000.3)
by 0x40C94C: mainloop_run (mainloop-glib.c:79)
by 0x40CEF9: mainloop_run_with_signal (mainloop-notify.c:201)
by 0x408A43: tester_run (tester.c:870)
by 0x404E04: main (test-hfp.c:865) |
Luiz Augusto von Dentz |
6 years ago |
1 file, +1, -1 |
| b6960209 |
gatt: Require medium security for ATT socket over BR/EDR
Encryption is required according to the spec:
BLUETOOTH CORE SPECIFICATION Version 5.1 | Vol 3, Part G page 2397:
5.1.2 BR/EDR channel requirements
The channel shall be encrypted. The Key_Type shall be either an
Unauthenticated Combination Key or an Authenticated Combination Key. |
Luiz Augusto von Dentz |
6 years ago |
1 file, +1, -1 |
| 9c82249b |
att: Return error in case Exchange MTU is used over BR/EDR link
In case of BR/EDR the L2CAP MTU negotion is used instead:
BLUETOOTH CORE SPECIFICATION Version 5.1 | Vol 3, Part G page 2370
4.3.1 Exchange MTU
This sub-procedure shall not be used on a BR/EDR physical link since
the MTU size is negotiated using L2CAP channel configuration
procedures. |
Luiz Augusto von Dentz |
6 years ago |
1 file, +17, -0 |
| f36f71f6 |
tools: Fix build after y2038 changes in glibc
The 32-bit SIOCGSTAMP has been deprecated. Use the deprecated name
to fix the build. |
Bastien Nocera |
6 years ago |
2 files, +10, -2 |
| cf7d8a23 |
mesh: Fix segmentation fault when removing a node
This fixes a segmentation fault introduced by earlier changes.
Segmentation fault was used by accessing a queu that has been
destroyed, but the corresponding pointer hasn't been set to NULL. |
Inga Stotland |
6 years ago |
1 file, +4, -2 |
| 4e60dc5e |
mesh: Handle messages encrypted with a remote device key
This adds ability to receive messages encrypted using known remote
device key. Such a key must be added to the node's keyring using
ImportRemoteNode() method of org.bluez.mesh.Management1 interface.
Decrypted messages are then forwarded to the application using
DevKeyMessageReceived() D-Bus API.
Also, messages originating from a local node and encrypted using local
device key are forwarde to the application as well, if they weren't
handled by internal model. This allows e.g. receiving status messages
from a local Config Server in the application. |
Michał Lowas-Rzechonek |
6 years ago |
1 file, +55, -6 |
| 9e11b3ee |
mesh: Implement DevKeySend() method on Node interface
This patch implements D-Bus DevKeySend() method of org.bluez.mesh.Node1
interface, allowing the application to send messages encrypted using
a known remote device key.
At the moment the call ignores net_index argument and sends messages
using the primary subnet.
Also, it's no longer possible to use 'magic' key_index value 0x7fff
(denoting local device key) when calling regular Send(). Applications
should use DevKeySend() instead. |
Michał Lowas-Rzechonek |
6 years ago |
2 files, +61, -3 |
| 9dfc56d7 |
mesh: Split APP_IDX_DEV into APP_IDX_DEV_LOCAL and APP_IDX_DEV_REMOTE
This is needed to distinguish incoming messages encrypted using a device
key: if the key is local, the message can be forwarded to internal
models. If the key is a known remote one, it will be forwarded to the
application via DevKeyMessageReceived() API. |
Michał Lowas-Rzechonek |
6 years ago |
3 files, +25, -20 |
| e3c5b38f |
mesh: Cleanup D-Bus method returns with empty result |
Michał Lowas-Rzechonek |
6 years ago |
1 file, +3, -15 |
| 70ffc816 |
mesh: Use l_dbus_message...() APIs in more consistent fashion
This removes checks for the return values of l_dbus_message...()
calls in the few places where we can rely on ell to handle error
cases gracefully. |
Inga Stotland |
6 years ago |
3 files, +20, -35 |
| 5f896b47 |
mesh: Remove redundant initialization
This fixes a case where a variable was initialized twice. |
Inga Stotland |
6 years ago |
1 file, +1, -1 |
| 5764d8bf |
mesh: Fix stack overflow in get_element_properties
D-Bus type 'q' denotes uint16, not uint8. |
Michał 'Khorne' Lowas-Rzechonek |
6 years ago |
1 file, +1, -1 |
| e0fd407f |
mesh: Fix clean up of node's DBUS assosiated resources
This consolidates multiple places where node's object paths,
interfaces, etc. are de-allocated, into one routine:
free_node_dbus_resources().
This also addresses memory leaks assosiated with inconsistent freeing
of object path strings. |
Inga Stotland |
6 years ago |
1 file, +29, -37 |
| af06aebc |
mesh: Fix checks when restoring internal model state
This fixes incorrect conditional checks in restore_model_state()
which could lead to dereferencing a NULL pointer.
Wrong: if (l_queue_isempty(mod->bindings) || !mod->cbs->bind) ...
Fixed: if (!l_queue_isempty(mod->bindings) && cbs->bind) ... |
Inga Stotland |
6 years ago |
1 file, +1, -1 |
| 3df89f70 |
mesh: Fix memory leak on dbus message creation |
Brian Gix |
6 years ago |
1 file, +3, -0 |
| b2fd4c7e |
avctp: Fix not accounting output MTU properly
The code shall use BT_IO_OPT_OMTU to read the output MTU. |
Luiz Augusto von Dentz |
6 years ago |
1 file, +1, -1 |