platform/upstream/bluez.git
4 years agomesh: Store model publication settings in config file
Inga Stotland [Fri, 8 Mar 2019 22:58:20 +0000 (14:58 -0800)]
mesh: Store model publication settings in config file

This adds functionality to enable storing model publication
parameters in node configuration file.

Also, fix calculations of model publication period.

Change-Id: I85c14f623f3b75e0744ed8dc78b55d0150f4b3b8
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Save model subscription updates to config file
Inga Stotland [Fri, 8 Mar 2019 22:58:19 +0000 (14:58 -0800)]
mesh: Save model subscription updates to config file

This adds functionality in Config Server model to save changes in
node configuration file when model subscriptions are added, deleted or
overwritten.

Change-Id: I2f949cca75a86ef2605eea1bd2dcfd325d4726f2
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Add json config functions to save pub/sub updates
Inga Stotland [Fri, 8 Mar 2019 22:58:18 +0000 (14:58 -0800)]
mesh: Add json config functions to save pub/sub updates

This adds functions to save updates to model subscriptions and
publication in JSON format.

Change-Id: I5f34ae2f596a7d1c97f887ac6211d206fee9d4fd
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Set node ID for a newly provisioned node
Inga Stotland [Fri, 8 Mar 2019 22:56:34 +0000 (14:56 -0800)]
mesh: Set node ID for a newly provisioned node

When a new node is created after successful provisioning, a 4-digit
hex node id needs to be generated and preserved.

Change-Id: Ia1e85e14d6e5fa90464f0f4ce4216ce903e7bd43
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Enable local loopback
Brian Gix [Fri, 8 Mar 2019 22:40:16 +0000 (14:40 -0800)]
mesh: Enable local loopback

Implements mechanism to allow direct messaging between local
nodes without requiring an external relay node.

Change-Id: I7f7eac5194cebd126be689178af18d390bdf6a0a
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Fix array processing in Send, Publish, Join
Inga Stotland [Fri, 1 Mar 2019 23:53:15 +0000 (15:53 -0800)]
mesh: Fix array processing in Send, Publish, Join

Use correct parameters when calling l_dbus_message_iter_get_fixed_array().
Also, check the return value and the length of the processed array and
return an error if the checks fail.

Change-Id: I8c4f4ad5ea9a1596782e606a01c849e374cc2d84
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agodoc/mesh-api: Fix Attach() method signature
Inga Stotland [Thu, 28 Feb 2019 23:24:56 +0000 (15:24 -0800)]
doc/mesh-api: Fix Attach() method signature

Correct return arguments for Attach() method.
Also, fix some grammar and formatting.

Change-Id: I699ee4cf6ed323a5837b944b9c3dc7940fc221ef
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Implement Leave() method on Network interface
Inga Stotland [Fri, 22 Feb 2019 06:31:48 +0000 (22:31 -0800)]
mesh: Implement Leave() method on Network interface

This implements D-Bus Leave() method that results in complete removal
of node information from the system, including configuration files
from storage directory.

Change-Id: I0ff0c49e768bd3a04f8e8d10a59b91b20562c43a
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Cleanup storage save and remove procedures
Inga Stotland [Fri, 22 Feb 2019 06:31:47 +0000 (22:31 -0800)]
mesh: Cleanup storage save and remove procedures

To remove a node config directory completely, the directory
needs to be empty. Both node.json and node,json.bak files must
are deleted.

Also, change storage_save_config() type to void to eliminate
meaningless checks.

Change-Id: Idacf96ed74e8b4818dea061efbe242107df8cdac
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Re-arrange node cleanup functions
Inga Stotland [Fri, 22 Feb 2019 06:31:46 +0000 (22:31 -0800)]
mesh: Re-arrange node cleanup functions

Rename node_free() to node_remove() and consolidate clean up operations.
Change declarations for internally used functions to static.

Change-Id: I22aba42a8c1d7632a8f8dc1bb81ceb92caaa70da
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Fix type checking for 32 vs 64 bit systems
Brian Gix [Wed, 27 Feb 2019 18:12:55 +0000 (10:12 -0800)]
mesh: Fix type checking for 32 vs 64 bit systems

Change-Id: I3636c1633d504f0bc4f04b8068503453cc111938
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Fix for file naming convention
Brian Gix [Wed, 20 Feb 2019 23:21:42 +0000 (15:21 -0800)]
mesh: Fix for file naming convention

Change-Id: I8a1ffd35187be78936194737105fa749fb32a528
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Return correct error code for AppKey List command
Inga Stotland [Thu, 14 Feb 2019 03:45:27 +0000 (19:45 -0800)]
mesh: Return correct error code for AppKey List command

If AppKey List command is called with a network key index that
is not valid for the node, return Invalid NetKey Index error code

Change-Id: I77e4065e710b536ba641fd49ca2eeb5b5d7e47be
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Save newly added or updated app key to config file
Inga Stotland [Thu, 14 Feb 2019 03:45:26 +0000 (19:45 -0800)]
mesh: Save newly added or updated app key to config file

This separates mesh_db_app_key_add() into distinct functions:
mesh_db_app_key_add() and mesh_db_app_key_update() which will be called
based on whether an application key is newly added or updated.

Change-Id: I897fe6ba17c4994f55c6514fb3c9e5e4602835e3
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Separate functions for app key add and update
Inga Stotland [Thu, 14 Feb 2019 03:45:25 +0000 (19:45 -0800)]
mesh: Separate functions for app key add and update

This splits appkey_key_add() into two separate functions:
app_key_add() and app_key_update().
Fix checks for miscellaneous invalid conditions and return
appropriate error status.

Change-Id: I938afa1eb355337f43b3c2e4f23205edbb7c3834
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Use l_malloc instead of l_new with a cast
Marcel Holtmann [Sat, 16 Feb 2019 07:23:43 +0000 (08:23 +0100)]
mesh: Use l_malloc instead of l_new with a cast

Change-Id: Ie2308b4cf1a15428aefe65e39c21df6da2627006
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Use PRIx64 instead of %16.16lx
Marcel Holtmann [Sat, 16 Feb 2019 07:00:08 +0000 (08:00 +0100)]
mesh: Use PRIx64 instead of %16.16lx

Change-Id: I11f0e5ebc81e4b20abd0747a9c578a70afb0fe1e
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Save newly added or updated net key to config file
Inga Stotland [Thu, 7 Feb 2019 03:55:37 +0000 (19:55 -0800)]
mesh: Save newly added or updated net key to config file

This separates mesh_db_net_key_add() into distinct functions:
mesh_db_net_key_add() and mesh_db_net_key_update() which will be called
based on whether a network key was newly added or updated.

Change-Id: I7af60c622c39f813a5aab64b5ae936943a1cfcb8
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Save key refresh phase state to node config file
Inga Stotland [Thu, 7 Feb 2019 03:55:36 +0000 (19:55 -0800)]
mesh: Save key refresh phase state to node config file

This adds implementation for saving the key refresh phase to
a node configuration file in JSON format. When the key refresh
procedure is finished, the old network keys are remove from the
configuration file.

Change-Id: I33341489ae538cf9734c0a68025865d53f49548f
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Declare internal functions as static
Inga Stotland [Thu, 7 Feb 2019 03:55:35 +0000 (19:55 -0800)]
mesh: Declare internal functions as static

This renames mesh_net_key_refresh_finish() to key_refresh_finish() and
mesh_net_key_phase_two() to key_refresh_phase_wo() and changes the
function declaration to static since they are called only within net.c

Change-Id: Ic24e0f6168bd2407d29f786d5664368d721015a3
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Add function to restore net key state from storage
Inga Stotland [Thu, 7 Feb 2019 03:55:34 +0000 (19:55 -0800)]
mesh: Add function to restore net key state from storage

This creates subnet state based on saved network key state:
current keys and, if present, updated keys.
Secure network beacon is generated according to key refresh phase.

Change-Id: I3f89ffb8181afc5d66966ee8e369125875a2c262
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Separate functions for net key add and update
Inga Stotland [Thu, 7 Feb 2019 03:55:33 +0000 (19:55 -0800)]
mesh: Separate functions for net key add and update

This splits mesh_net_key_add() into two separate functions:
mesh_net_key_add() and mesh_net_key_update().
mesh_net_key_update() essentially replaces mesh_net_kr_phase_one()
since switching to Key Refresh phase one can only be triggered
by successful network key update.

Change-Id: I9be2f9784ebb094906107bd8923694199e0900f3
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agoTODO: Fix complexity level for Bluetooth mesh items
Inga Stotland [Mon, 4 Feb 2019 23:31:01 +0000 (15:31 -0800)]
TODO: Fix complexity level for Bluetooth mesh items

Change-Id: Ib90ce697f36c7bdffb07ebf13049ad00effa27cc
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Add D-Bus policy for Bluetooth mesh daemon
Inga Stotland [Sat, 19 Jan 2019 03:58:37 +0000 (19:58 -0800)]
mesh: Add D-Bus policy for Bluetooth mesh daemon

This adds new D-Bus policy file bluetooth-mesh.conf

Change-Id: I39bdf73540f11ee60f09cbf17e4b8490c7b2ccf3
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Rename mesh daemon executable to bluetooth-meshd
Inga Stotland [Sat, 19 Jan 2019 03:58:36 +0000 (19:58 -0800)]
mesh: Rename mesh daemon executable to bluetooth-meshd

Change-Id: Iba5efaeeda8de4e5fe569cc5616f1e0fca5c2b55
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agoTODO: Add Bluetooth mesh items
Inga Stotland [Mon, 4 Feb 2019 19:15:34 +0000 (11:15 -0800)]
TODO: Add Bluetooth mesh items

Change-Id: I27f947041a9b3a9614786728b112d8a9864c83fb
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Remove unnecessary variable initialization
Inga Stotland [Sat, 2 Feb 2019 06:49:35 +0000 (22:49 -0800)]
mesh: Remove unnecessary variable initialization

Change-Id: Ie8728738b7c4a372008d7ce3863f2f4be4fdc6d3
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Add README file
Inga Stotland [Fri, 1 Feb 2019 00:22:41 +0000 (16:22 -0800)]
mesh: Add README file

    This file contains instructions for Bluetooth mesh daemon
    configuration and description of the persistent storage.

Change-Id: I7db9c5dd9662c571f1a22e8116f06adf3c041d3a
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Add MGMT bypass when specifying controller
Brian Gix [Thu, 31 Jan 2019 20:50:22 +0000 (12:50 -0800)]
mesh: Add MGMT bypass when specifying controller

If Daemon is started with an explicit controller specified, the
MGMT search for an unused shared controller is bypassed, and
the controller is opened directly.

Change-Id: I204b0db6ff185fade58bc9bd4d4fb6556920e22b
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Fix logic when cleaning up incomplete provisioning
Inga Stotland [Sat, 19 Jan 2019 06:53:18 +0000 (22:53 -0800)]
mesh: Fix logic when cleaning up incomplete provisioning

Do not call acceptor_cancel() if the provisioning has been completed,
either fail or success. Acceptor automatically takes care of cleanup
on completion, either successful or not.

4 years agomesh: Fix Relaying for multiple nodes
Brian Gix [Fri, 18 Jan 2019 17:39:44 +0000 (09:39 -0800)]
mesh: Fix Relaying for multiple nodes

Relay is now a cooperation between all the nodes on the daemon.
If any one or more nodes have relay enabled and a received packet
is addressed to a Group, or a non-present Unicast address, then the
packet's TTL is decremented and it is resent.

Change-Id: I27d5555a9d530fc91a0c8f835feba9f2563ff68d
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Cleanup PB-ADV transport on Prov Close
Brian Gix [Mon, 14 Jan 2019 22:52:15 +0000 (14:52 -0800)]
mesh: Cleanup PB-ADV transport on Prov Close

PB-ADV always used for provisioning, so must always  be cleaned up.

Change-Id: I37bc5f68e032b32942b0e909d3836d260a5c2f1e
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Clean up when finishing the Join call
Inga Stotland [Sat, 12 Jan 2019 02:40:55 +0000 (18:40 -0800)]
mesh: Clean up when finishing the Join call

Consolidate multiple instances where the pending Join data is freed
into calling one function free_pending_join_call().

Also, add checks for NULL data in cleanup functions for storage, agent
and provisioning acceptor.

Change-Id: I7a93d4f003f090f705be2f1f7af96349d10bdd1c
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Fix reading device UUID from Join() call
Inga Stotland [Sat, 12 Jan 2019 02:40:54 +0000 (18:40 -0800)]
mesh: Fix reading device UUID from Join() call

Supply correct parameters to l_dbus_message_iter_get_fixed_array
to get the location from where to read UUID value.

Change-Id: I0e2af0142882efb4d1079953a2a380dd9606dbdd
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: remove uneeded BDADDR type check
Brian Gix [Thu, 10 Jan 2019 23:22:28 +0000 (15:22 -0800)]
mesh: remove uneeded BDADDR type check

BT_HCI_EVT_LE_ADV_REPORT only comes from legal LE events

Change-Id: Ib98dcba6afb307fca4d5cc07ba1ff5d2fd1129bd
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Sample Mesh Joiner (provision acceptor)
Inga Stotland [Fri, 14 Dec 2018 22:19:08 +0000 (14:19 -0800)]
mesh: Sample Mesh Joiner (provision acceptor)

This implements a simple test to excercise Join() method
of org.bluez.mesh.Network interface.

Change-Id: I7c35ba8d979ac19ab2ca07b32551fae39dea9cd4
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Sample On/Off Client and Server
Inga Stotland [Fri, 14 Dec 2018 22:14:19 +0000 (14:14 -0800)]
mesh: Sample On/Off Client and Server

These tests excercise the following methods:
interface org.bluez.mesh.Network - Attach()
interface org.bluez.mesh.Node - Send(), Publish()

Change-Id: Ibeb7ed009000d6cf92e6927fefd2d8466a2df3da
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Sample Provisioning Agent
Inga Stotland [Fri, 14 Dec 2018 22:13:25 +0000 (14:13 -0800)]
mesh: Sample Provisioning Agent

This implements a simple provisioning agent to test
org.bluez.mesh.ProvisionAgent interface.

Change-Id: Ia9e3b842abe98cbb9fb1c22bc0e489a07c18b564
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Add default location for Mesh Node storage
Inga Stotland [Fri, 14 Dec 2018 22:09:20 +0000 (14:09 -0800)]
mesh: Add default location for Mesh Node storage

Change-Id: I3f1581a7bce759df96c9df111aaaf5df73bb4f8c
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Update init for D-Bus and multi-node support
Inga Stotland [Fri, 14 Dec 2018 22:08:23 +0000 (14:08 -0800)]
mesh: Update init for D-Bus and multi-node support

This adds D-Bus initialization, modifications for mulitple nodes and
optional control of storage directory location.

Change-Id: I4f1a637a2e27e23ffb797f14bb60552f130ac531
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Clean up debug logging and comment style
Brian Gix [Fri, 14 Dec 2018 22:07:46 +0000 (14:07 -0800)]
mesh: Clean up debug logging and comment style

Change-Id: I1c104b78e2009624cc80687c22f5cdc41d664560
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Clean up App Key configuration and storage
Inga Stotland [Fri, 14 Dec 2018 22:07:19 +0000 (14:07 -0800)]
mesh: Clean up App Key configuration and storage

Fix miscellaneous issues: use l_debug instead of l_info for debug logs;
remove "local" from functions names (this handles only local app keys);
add missing App Key index initialization.

Change-Id: I337234997deea5113521ac930aa9321ae1d8e2b6
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Implement Provisioning Agent D-Bus interface
Inga Stotland [Fri, 14 Dec 2018 22:06:18 +0000 (14:06 -0800)]
mesh: Implement Provisioning Agent D-Bus interface

This implements the time limited and user interaction D-Bus API as
required for Out-Of-Band authentication during provisioning, and as
described in doc/mesh-api.txt.

Change-Id: I1953ddeb53428c180677a9f25a0912df700d3de2
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Restructure model services for multiple nodes
Inga Stotland [Fri, 14 Dec 2018 22:05:36 +0000 (14:05 -0800)]
mesh: Restructure model services for multiple nodes

This handles checking that incoming Mesh messages obey all
authentication rules regarding subscriptions and encryption
key bindings on a per node basis, before forwarding via D-Bus
to external applications that are authorized to handle them.

Change-Id: Ief00a963ad88fddb580fc2ab369f99ae5c4bfd99
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Add support for storage of multiple nodes
Inga Stotland [Fri, 14 Dec 2018 22:05:04 +0000 (14:05 -0800)]
mesh: Add support for storage of multiple nodes

Add functionality to support storage of multiple subnets, model
subscriptions and publications per mesh node.

Change-Id: I0313f81cd16da18b621d08154489645aa06c7f42
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Restructure I/O for multiple controllers
Brian Gix [Fri, 14 Dec 2018 22:04:25 +0000 (14:04 -0800)]
mesh: Restructure I/O for multiple controllers

Restructured access to Bluetooth Controllers to allow the usage of
multiple controllers, and potentially functionality tailored to Mesh
specific features.

Change-Id: I159e9ec0e2e314cf810c45e89645f8c8edeb0df1
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Add multi-node support to Config Server model
Inga Stotland [Fri, 14 Dec 2018 22:03:10 +0000 (14:03 -0800)]
mesh: Add multi-node support to Config Server model

The Config Server model is rewritten to allow control of mutiple nodes
on the local device. The updates to a node configuration (e.g., keys,
model subscriptions/publications, etc.) as set by a remote Config Client
are routed to a properly addressed node and stored in a protected
configuration file corresponding to that node.

Change-Id: I15e2ef8e1144fa85c9ec60991385b276ea36c6ce
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Implement org.bluez.mesh.Network API
Inga Stotland [Fri, 14 Dec 2018 22:01:50 +0000 (14:01 -0800)]
mesh: Implement org.bluez.mesh.Network API

This implements the following methods of org.bluez.mesh.Network
interface: Join(), Attach(), Cancel(). The methods are described in
doc/mesh-api.txt document.

Also, add changes to reflect that the single daemon now handles multiple
local mesh nodes.

Change-Id: Ic1cfd06b7d808957fcac1b4b06f2cc48b970b454
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Re-arrange provisioning for DBus API
Brian Gix [Fri, 14 Dec 2018 22:00:56 +0000 (14:00 -0800)]
mesh: Re-arrange provisioning for DBus API

This restructures provisioning so that it is a service of high level
d-Bus based API and may be potentially used on mulitple provisioning
transports.

Change-Id: I895d87a41a940474c47b1911e2b1f95a79d061a4
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Add hex string and debug logging utilities
Inga Stotland [Fri, 14 Dec 2018 22:00:30 +0000 (14:00 -0800)]
mesh: Add hex string and debug logging utilities

This adds frequently used functionaility for logging and
saving/retrieval of long (128+ bit) hexidecimal data.

Change-Id: I1dfeeeea4f0d968b0f1b053edd8f312e73adf61d
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Set unchanging variables to const
Brian Gix [Fri, 14 Dec 2018 21:59:46 +0000 (13:59 -0800)]
mesh: Set unchanging variables to const

Change-Id: I361ae143a3e65778e90bfa379adae33cec0d1e7a
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Rewrite Controler interface for full init
Brian Gix [Fri, 14 Dec 2018 21:58:26 +0000 (13:58 -0800)]
mesh: Rewrite Controler interface for full init

Functionaility has been added to allow a BT 4.0 or later controller
to be used for Advertising based Mesh usage, regardless of how it
was previously initialized.

Change-Id: I85c70ef84b534f0ab5ff1df88374349521dc7647
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Implement provisioning initiator side
Brian Gix [Fri, 14 Dec 2018 21:57:23 +0000 (13:57 -0800)]
mesh: Implement provisioning initiator side

This functionaility (originally found in provision.c) was rewritten
as the Initiator side only of the provisioning procedure.  If the
local device owns and controls access to a mesh network, this is the
side of the provisioning procedure that it must use to bring new
unprovisioned devices into the network as Nodes.

Change-Id: Ib17a26a63298d2d00ad362c9b55a44a4d142079a
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Implement provisioning acceptor
Brian Gix [Fri, 14 Dec 2018 21:56:34 +0000 (13:56 -0800)]
mesh: Implement provisioning acceptor

This implements acceptor side of the provisioning procedure when an
unprovisioned device is brought into an existing mesh network by a
remote Provisioner. Upon the successful completion of the procedure
the device becomes a participating mesh node in thie network.

Change-Id: I48dd146273be968edcf707526380505f829ba3fa
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Add direction agnostic PB-ADV implementation
Brian Gix [Fri, 14 Dec 2018 21:55:56 +0000 (13:55 -0800)]
mesh: Add direction agnostic PB-ADV implementation

Originally found in prov.c, this file implements the PB-ADV
provisioning transport.  It may be used by either the
Acceptor or the Initiator side of the Provisioning procedure,
but only one session may be active at a time.

Change-Id: I13c6f05eaa6d574b3b8b43715221e8c5ed909419
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Rewrite Network layer for multiple nodes
Brian Gix [Fri, 14 Dec 2018 21:55:14 +0000 (13:55 -0800)]
mesh: Rewrite Network layer for multiple nodes

The Network layer of the Mesh Daemon has access to all
network keys that have been entrusted to Nodes on the local
device, and acts as a MUX by forwarding incoming messages
to some, all or none of the local Nodes, based on addressing
and keys.

It also is reponsible for for applying Network layer encryption
to outgoing messages, and for relaying messages based on TTL.

Change-Id: I41f5ebc5902ff67caa3e28754360db2b81e1ed6d
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Add org.bluez.mesh.Node D-Bus API support
Inga Stotland [Fri, 14 Dec 2018 21:54:17 +0000 (13:54 -0800)]
mesh: Add org.bluez.mesh.Node D-Bus API support

Add support for maintaining multiple local nodes within a single daemon.
A mesh node is an adressable entity in Bluetooth mesh. A local mesh
capable device may have multiple distinct representations as a mesh
node on different mesh networks. Each such representation (aka "node
configuration") maintains runtime storage of encryption/decryption
keys, model subscriptions and publications, etc.

Also, implement D-Bus methods for org.bluez.mesh.Node interaface:
Send(), Publish(), VendorPublish()

Also, add support for generating temporary mesh node entity for Join()
method and verification of credentials for Attach() method

Change-Id: Iaacde1ab11c7859f5b2c9714d66046768c351c66
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Rewrite storage for multiple nodes
Inga Stotland [Fri, 14 Dec 2018 21:53:19 +0000 (13:53 -0800)]
mesh: Rewrite storage for multiple nodes

Multiple node configurations are now stored in priviledged location
to prevent unauthorized access to the security material entrusted to
each node.
Default storage location is /var/lib/bluetooth/mesh.

Change-Id: I18e2100e344c697cf564dbcb2a20f69b06b09379
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Internal errors
Inga Stotland [Fri, 14 Dec 2018 21:52:39 +0000 (13:52 -0800)]
mesh: Internal errors

Add error codes that map to specific faults that may occur while
using the mesh D-Bus API.

Change-Id: I6aa57abd0303a87c900bf448e54595ffe1789776
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Add utilities for DBus support
Inga Stotland [Fri, 14 Dec 2018 21:48:59 +0000 (13:48 -0800)]
mesh: Add utilities for DBus support

These files implement helper routines for common D-Bus functionality.

Change-Id: Ic6d828ebbc828d40ca103476974cded374cdd79c
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Structural changes for mesh
Brian Gix [Fri, 14 Dec 2018 21:46:45 +0000 (13:46 -0800)]
mesh: Structural changes for mesh

Delete composition.json since it not used for initialization anymore.
Delete btmesh.c as it is not used anymore.
Delete display.c and display.h, move retained functionality to util.c
Delete prov.c, move retained PB-ADV functionality to pb-adv.c
Delete provision.c, split retained functionality between
prov-acceptor.c and prov-initiator.c

Change-Id: I419cc368361b8b339138bbbe4525cb5599c70383
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agodoc: Update mesh Agent API
Inga Stotland [Mon, 3 Dec 2018 03:29:50 +0000 (19:29 -0800)]
doc: Update mesh Agent API

Change enumerated values to strings in method parameters, and
corrected formatting for 80 character terminals.

Change-Id: I42bbbbfde235ae1389979c3b7176ae4266e3f719
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agodoc: Initial Bluetooth Mesh API
Inga Stotland [Tue, 20 Nov 2018 07:29:05 +0000 (23:29 -0800)]
doc: Initial Bluetooth Mesh API

This decribes proposed D-Bus based API for Bluetooth Mesh
implementation.

Change-Id: Ib8949de722335c0247ab147755d333259b1708b7
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Avoid loop variable initial declarations
Marcel Holtmann [Tue, 4 Dec 2018 16:30:42 +0000 (17:30 +0100)]
mesh: Avoid loop variable initial declarations

Change-Id: I68cfa8352c77ff8c562096bd822742a86056a6f5
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agobuild: Add missing mesh/appkey.h header file
Marcel Holtmann [Mon, 3 Dec 2018 20:18:23 +0000 (21:18 +0100)]
build: Add missing mesh/appkey.h header file

Change-Id: I78422ddc220bd213787e7777939be25aecea996c
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Fix various compiler warnings
Marcel Holtmann [Mon, 3 Dec 2018 18:54:33 +0000 (19:54 +0100)]
mesh: Fix various compiler warnings

Change-Id: I5fc0e3d8b16da52e3669803d6905e85656c31860
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Up-rev ELL dependancies to >= 0.14
Brian Gix [Thu, 22 Nov 2018 19:37:32 +0000 (11:37 -0800)]
mesh: Up-rev ELL dependancies to >= 0.14

Change-Id: Ic057c4ea331156e8694104da225681fdb6b887fd
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomeshctl: Switch from write to sendmsg for Acquire*
Luiz Augusto von Dentz [Mon, 19 Nov 2018 15:35:54 +0000 (17:35 +0200)]
meshctl: Switch from write to sendmsg for Acquire*

Use sendmsg with MSG_NOSIGNAL to prevent crashes involving SIGPIPE.

Change-Id: I25fde6c1e91642a887c4705d4861d01fb134bf95
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Refactor friend.c and net.c for central key DB
Brian Gix [Tue, 18 Sep 2018 19:40:08 +0000 (12:40 -0700)]
mesh: Refactor friend.c and net.c for central key DB

To enable multiple local nodes and friendships to
coexist, and minimize redundant encryption processing

Change-Id: I41ef270909c3d38391f31a922d48d35da2d56b10
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Add centralized caching Net Key management
Brian Gix [Fri, 7 Sep 2018 21:45:04 +0000 (14:45 -0700)]
mesh: Add centralized caching Net Key management

Change-Id: I804c51cbe75d8ea0a42b7982a37aef8311de6b0c
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Add clean up on start up failure
Inga Stotland [Fri, 7 Sep 2018 23:25:44 +0000 (16:25 -0700)]
mesh: Add clean up on start up failure

Call bt_shell_clanup if failed to start the tool.

Change-Id: I58a85628546e20a51065ab02b54f2145a8425d57
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Add start up management command chain
Inga Stotland [Wed, 5 Sep 2018 00:20:34 +0000 (17:20 -0700)]
mesh: Add start up management command chain

This allows co-existense of meshd and bluetoothd. meshd will
automatically take control of the first available LE-capable
controller that is powered down.

Change-Id: If5f27e4215ace969e37f72928259fb35923d4a24
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agotools/meshctl: Fix default directory for JSON files
Inga Stotland [Wed, 29 Aug 2018 18:25:55 +0000 (11:25 -0700)]
tools/meshctl: Fix default directory for JSON files

This fixes the name of default directory that contains sample JSON files.
README file is updated to describe the default location.

Change-Id: Ie702dd3079df95d043196bbf5a3f85d54077369b
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Fix uninitilized error
Luiz Augusto von Dentz [Fri, 24 Aug 2018 14:49:02 +0000 (17:49 +0300)]
mesh: Fix uninitilized error

This fixes the following error:

mesh/cfgmod-server.c: In function ‘cfg_srv_pkt’:
mesh/cfgmod-server.c:103:5: error: ‘pub’ may be used uninitialized in
this function [-Werror=maybe-uninitialized]

Change-Id: I18473c1c16bd02b208d679422cd4ed354108b77d
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Fixed warning-to-error from GCC 8.1.1
Brian Gix [Thu, 23 Aug 2018 20:08:54 +0000 (13:08 -0700)]
mesh: Fixed warning-to-error from GCC 8.1.1

Fixed compiler flagged unsafe usage of strncpy

Change-Id: Ie69c5914eb48a608e2252794e0e5b87135ff5211
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agoAUTHORS: add Mesh maintaining authors
Brian Gix [Wed, 22 Aug 2018 19:10:55 +0000 (12:10 -0700)]
AUTHORS: add Mesh maintaining authors

Change-Id: Ifb1b521d786562e1ba64fa1e032007254909c6c6
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agoMakefile for meshd
Inga Stotland [Sat, 14 Jul 2018 19:59:03 +0000 (12:59 -0700)]
Makefile for meshd

Tizen Change: Currently mesh daemon build is disabled

Change-Id: I85bc5d9c11e39115024b0bb498aafb462d912e73
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Sample device composition in JSON format
Inga Stotland [Sat, 14 Jul 2018 19:59:02 +0000 (12:59 -0700)]
mesh: Sample device composition in JSON format

This is a sample unprovisioned device composition described
in JSON format.

Change-Id: I52ce0e669c18237fb50f1fa5d035ae076dd26f6f
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Read and write mesh configuration in JSON format
Inga Stotland [Sat, 14 Jul 2018 19:59:01 +0000 (12:59 -0700)]
mesh: Read and write mesh configuration in JSON format

This adds implementation for parsing and writing Mesh configuration
into JSON format. Also, parse stored unprovisioned device composiotion.

Change-Id: Ia280ef53a7f170001494d15bd70b1d884cdabb58
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Mesh config server model
Inga Stotland [Sat, 14 Jul 2018 19:59:00 +0000 (12:59 -0700)]
mesh: Mesh config server model

Change-Id: Ib400910064ff64cdcb8f323675e4be4aa656aee8
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Source code for handling access layer mux/demux
Inga Stotland [Sat, 14 Jul 2018 19:58:59 +0000 (12:58 -0700)]
mesh: Source code for handling access layer mux/demux

Change-Id: Ia5cac2a4c9751bee26026db54384846c435bcc49
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Source files for mesh access layer and utilities
Inga Stotland [Sat, 14 Jul 2018 19:58:58 +0000 (12:58 -0700)]
mesh: Source files for mesh access layer and utilities

This adds initial implementation of BT Mesh access layer
functionality plus utilities.

Change-Id: Ib83a570b34c334153c0174d2bd1dbf9cebce4cc3
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Header files for mesh access layer and utilities
Inga Stotland [Sat, 14 Jul 2018 19:58:57 +0000 (12:58 -0700)]
mesh: Header files for mesh access layer and utilities

This adds initial implementation of Mesh access layer functionality

Change-Id: I142ef204a0efffe279e2b7cf3208f018f83d6b50
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Add Accessors to Transport layer data
Brian Gix [Sat, 14 Jul 2018 19:58:56 +0000 (12:58 -0700)]
mesh: Add Accessors to Transport layer data

Change-Id: Icefad134ee878cc4866ccb27c9d65e83e503097f
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Upper and Lower mesh transport
Brian Gix [Sat, 14 Jul 2018 19:58:55 +0000 (12:58 -0700)]
mesh: Upper and Lower mesh transport

Change-Id: I0624c9f43ecde27c00d3003954c642d99df4cc34
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Provisioning logic for mesh
Brian Gix [Sat, 14 Jul 2018 19:58:54 +0000 (12:58 -0700)]
mesh: Provisioning logic for mesh

Change-Id: I1393239458d07d69a23770a229836b5f0663f8cd
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Initial Mesh Friendship support
Brian Gix [Sat, 14 Jul 2018 19:58:53 +0000 (12:58 -0700)]
mesh: Initial Mesh Friendship support

Change-Id: Ie0293ff6312d2987dbb120936e059e99f70bfa48
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Infrastructure for Mesh daemon
Brian Gix [Sat, 14 Jul 2018 19:58:52 +0000 (12:58 -0700)]
mesh: Infrastructure for Mesh daemon

Change-Id: I0738f7295f69a8229e3a09f67ae6399b6839e8b1
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Mesh crypto support
Brian Gix [Sat, 14 Jul 2018 19:58:51 +0000 (12:58 -0700)]
mesh: Mesh crypto support

Change-Id: Ieffb5c2aff17ee823a770362ca71c1afea064f9f
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Shared private meshd interfaces
Brian Gix [Sat, 14 Jul 2018 19:58:50 +0000 (12:58 -0700)]
mesh: Shared private meshd interfaces

Change-Id: I5cfc75e29a139410c74aa82c4272f284171b2405
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agotools/mesh: Fix reclaiming address range
Inga Stotland [Wed, 15 Aug 2018 20:16:52 +0000 (13:16 -0700)]
tools/mesh: Fix reclaiming address range

The computations for reclaiming released unicast addresses back
into address pool were off by 1. Also, the adjacent pools need
to be merged, if the released range fills the gap between two
address pools.

Change-Id: If420d6a914067880250d78f6de955a071fcf5fe7
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agotools: Move meshctl sources under tools/mesh directory
Inga Stotland [Fri, 22 Jun 2018 06:32:00 +0000 (23:32 -0700)]
tools: Move meshctl sources under tools/mesh directory

This is a temporary location until the unified mesh solution is provided

Change-Id: I1496ad64c492442a12e0920f67a34fc48297a088
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agotools: Move meshctl tool under tools directory
Inga Stotland [Fri, 22 Jun 2018 06:31:59 +0000 (23:31 -0700)]
tools: Move meshctl tool under tools directory

Change-Id: I17f7a3e16b325614ad68f537ee5d7152ec64e006
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Add ELL support in Bluez build 08/220208/1
Anupam Roy [Fri, 13 Dec 2019 10:25:48 +0000 (15:55 +0530)]
mesh: Add ELL support in Bluez build

Note: In Tizen bluez, ELL will be built internally.
BLE mesh modules like mesh-cfgclient & bluetooth-mesh daemon
will be linked against the librarties generated by ELL build.

This patch refers to following upstream patch.

==================================================================
 commit 0093cd61b1e4f199bca45f8c2f8eb2d5a30e847d
 Author: Marcel Holtmann <marcel@holtmann.org>
 Date:   Tue Dec 4 16:59:01 2018 +0100

 build: Add support for internal and external ELL configuration
==================================================================

Change-Id: I232c2737964e0c6d56abc7a794f9f75606dc6472
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: add source for ell shared library 07/220207/1
Anupam Roy [Fri, 13 Dec 2019 10:03:35 +0000 (15:33 +0530)]
mesh: add source for ell shared library

Change-Id: I5951addf984e0e67bf8d3dcf89b89ba648c14064
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agomesh: Add ELL support in Bluez 06/220206/1
Anupam Roy [Fri, 13 Dec 2019 09:30:21 +0000 (15:00 +0530)]
mesh: Add ELL support in Bluez

This is a pre-requisute patch which adds ELL
source & headers inside Tizen bluez source.

In Tizen bluez, ELL will be built internally.
BLE mesh modules like mesh-cfgclient & bluetooth-mesh daemon
will be linked against the libraries generated by ELL build.

Note: ELL source build will be enabled in next patchset

Change-Id: I91d4a31326810820ed644816cfba8fd8ae93952d
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
4 years agoAdd check logic of browsing_io before channel shutdown 36/219436/4 accepted/tizen/5.5/unified/20191210.221211 submit/tizen_5.5/20191206.000647
Wootak Jung [Thu, 5 Dec 2019 01:05:53 +0000 (10:05 +0900)]
Add check logic of browsing_io before channel shutdown

Dec 05 09:38:13 localhost bluetoothd[2772]: GLib: g_io_channel_shutdown:
assertion 'channel != NULL' failed
Dec 05 09:38:13 localhost bluetoothd[2772]: GLib: g_io_channel_unref:
assertion 'channel != NULL' failed

Change-Id: Ife5a32397567a16806cfb6c15598ef88b6a438ee

4 years agoMerge "Remove unnecessary method calls" into tizen
Pyun DoHyun [Thu, 5 Dec 2019 04:19:07 +0000 (04:19 +0000)]
Merge "Remove unnecessary method calls" into tizen

4 years agoRemove unnecessary method calls 87/219287/1
Wootak Jung [Wed, 4 Dec 2019 04:52:15 +0000 (13:52 +0900)]
Remove unnecessary method calls

Calling Release() method generates below unnecessary dbus error.
Moreover, no need to call this method because cleanup process is
already done.

Dec 04 09:57:15 localhost dbus[2637]: [system] Rejected send message,
1 matched rules; type="error", sender=":1.3" (uid=122 pid=2562 comm=
"/usr/bin/pulseaudio ") interface="(unset)" member="(unset)" error n
ame="org.bluez.MediaEndpoint1.Error.NotImplemented" requested_reply=
"0" destination=":1.207" privilege="(n/a)" (uid=551 pid=3891 comm="/
usr/libexec/bluetooth/bluetoothd -d -C ") rule(<deny send_destinatio
n="org.bluez" />)

Feb 26 23:56:47 localhost dbus[2521]: [system] Rejected send message,
1 matched rules; type="error", sender=":1.59" (uid=651 pid=3025 comm=
"/usr/bin/sapd ") interface="(unset)" member="(unset)" error name="or
g.freedesktop.DBus.Error.UnknownMethod" requested_reply="0" destinati
on=":1.334" privilege="(n/a)" (uid=551 pid=8104 comm="/usr/libexec/bl
uetooth/bluetoothd -d -C ") rule(<deny send_destination="org.bluez" />)

Change-Id: I6ad605d2621be1e7a2800cd11217d157da86607a

4 years agoCalls sd_notify(STOPPING=1) to ensure systemd's operation 81/219181/1
DoHyun Pyun [Tue, 3 Dec 2019 01:52:33 +0000 (10:52 +0900)]
Calls sd_notify(STOPPING=1) to ensure systemd's operation

Change-Id: I287a8f72156c2f386a8e824f2099abec2757e761
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>