Anupam Roy [Tue, 17 Dec 2019 14:48:11 +0000 (20:18 +0530)]
mesh: Fix compilation issues
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Inga Stotland [Tue, 4 Jun 2019 06:07:47 +0000 (23:07 -0700)]
build: Add support for systemd bluetooth-mesh service
This adds support for installing systemd bluetooth-mesh service unit
and D-Bus service file that references this systemd unit.
Change-Id: I8306de2261244ead765bdae9b6b7bed00f069a61
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Brian Gix [Fri, 31 May 2019 15:56:43 +0000 (08:56 -0700)]
mesh: ELL encrypt dependancy README section added
Due to known AEAD encryption deficiencies in old versions of the
kernel, we have added a section on identifying and back-porting
mesh to otherwise non-supporting platforms.
Change-Id: I71ecc5164dbd29cc7fd33278712ab746c961fa82
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Brian Gix [Wed, 29 May 2019 17:28:18 +0000 (10:28 -0700)]
mesh: Convert crypto to use ELL wrappers
Use ELL implementations of aead-ccm(aes), ecb(aes) and cmac(aes). These
standard encryption and hashing routines are provided by ELL.
Change-Id: I4c82199cf8a58c6a09de8a8afcc74bb3cf584376
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Jakub Witowski [Fri, 24 May 2019 14:48:10 +0000 (07:48 -0700)]
mesh: Fix long MIC usage in segmented messages
Contrary to the comment, implementation used a 8-byte MIC even if this
generated an additional segment.
Change-Id: I7e718efbe401a3312871f2a4567050dc1805a508
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Brian Gix [Fri, 24 May 2019 14:48:09 +0000 (07:48 -0700)]
mesh: Implement remote dev key methods for keyring
Implements following org.bluez.mesh.Management1 methods:
ImportRemoteNode()
DeleteRemoteNode()
These methods are used to maintain Device Key keyring storage.
Change-Id: I8ea4508ca9e2717e0f2779ebff88ce0b2fa9c0a8
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Brian Gix [Fri, 24 May 2019 14:48:08 +0000 (07:48 -0700)]
mesh: Implement Key Refresh Phasing in keyring
Implements following org.bluez.mesh.Management1 methods:
CompleteAppKeyUpdate()
SetKeyPhase()
These methods are used to maintain Key Refresh settings
in the keyring storage.
Change-Id: Ic987cbb477710b35af4c40b5de60466a8ff2cdd8
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Brian Gix [Fri, 24 May 2019 14:48:07 +0000 (07:48 -0700)]
mesh: Implement App Key keyring storage handling
Implements following org.bluez.mesh.Management1 methods:
CreateAppKey()
ImportAppKey()
UpdateAppKey()
DeleteAppKey()
These methods are used to maintain App Key keyring storage.
Change-Id: I16cf6fb5e503e8474f35f383e8a7129cf4aae335
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Brian Gix [Fri, 24 May 2019 14:48:06 +0000 (07:48 -0700)]
mesh: Implement Net Key keyring storage handling
Implements following org.bluez.mesh.Management1 methods:
CreateSubnet()
ImportSubnet()
UpdateSubnet()
DeleteSubnet()
These methods are used to maintain Net Key keyring storage.
Change-Id: Iff079138608495589063efb57571118975bbe281
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Brian Gix [Fri, 24 May 2019 14:48:05 +0000 (07:48 -0700)]
mesh: Centralize definition of PRIMARY_NET_IDX
Change-Id: I8982c1b778f4990d425e3eed9160fbcaeca5dc85
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Brian Gix [Fri, 24 May 2019 14:48:04 +0000 (07:48 -0700)]
mesh: Add new method for Key Refresh procedure
This adds a new method CompleteAppKeyUpdate() on
org.bluez.mesh.Management1 interface to be used by the application
at the completion of a Key Refresh procedure. This method should
be called for each app key that is being updated during the
procedure, and must be performed prior to changing the phase of
the bound net key to phase 3.
Change-Id: I7bb869c9af78c58df0d567c745026b59fef97ce8
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Steve Brown [Tue, 21 May 2019 20:03:13 +0000 (16:03 -0400)]
meshctl: Retry recvmsg if data is not ready
Commit
d6eec1b67d6d ("meshctl: Switch from write to sendmsg for Acquire*")
causes a regression by returning an error if recvmsg has no data available.
Fix it by retrying until data is received.
Change-Id: I9f950f4ac7688dc3b89ccdc940f3ba60bc781737
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Inga Stotland [Wed, 15 May 2019 19:00:19 +0000 (12:00 -0700)]
mesh: Remove unnecessary includes from .c files
Change-Id: Ifb8be3d309ad1a99b9397f608d9fe1023d6480d8
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Inga Stotland [Wed, 15 May 2019 19:00:18 +0000 (12:00 -0700)]
mesh: Update copyright dates
Change-Id: I66dc7b41b7b09e22b57624493647fe286101e984
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Brian Gix [Wed, 15 May 2019 16:34:17 +0000 (09:34 -0700)]
mesh: Save generated Net and Dev keys in KeyRing
When creating a network from scratch, we need to save all
keys that are created into the KeyRing for use by Config
Client application.
Change-Id: I477c99dbab5973c34059bb63a5b0576034b8b3b4
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Brian Gix [Wed, 15 May 2019 16:34:16 +0000 (09:34 -0700)]
mesh: Fix file open error checking and permissions
Change-Id: Ie3836862c91e779fc208b920071aa970d9681bc3
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Brian Gix [Wed, 15 May 2019 16:34:15 +0000 (09:34 -0700)]
mesh: Add "create" command to test app
Like "join" this command generates a UUID and calls CreateNetwork()
and displays the UUID and token.
Change-Id: I5e28c5ae4acd85fa1547c7f21933bd851f765424
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Inga Stotland [Tue, 14 May 2019 22:54:07 +0000 (15:54 -0700)]
mesh: Add skeleton for org.bluez.mesh.Management1 interface
This adds bare-bones imlementation of methods on org.bluez.mesh.Management1
interface.
Change-Id: If6a00b26a5f5732e005f3ba2ca6f1fb2015dee10
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Inga Stotland [Tue, 14 May 2019 22:54:06 +0000 (15:54 -0700)]
mesh: Add check for org.bluez.mesh.Provisioner1 interface
This adds check for the presence of org.bluez.mesh.Provisioner1
interface when collecting information about mesh application
that is received in callback of GetManagedObjects() method.
Set "provisioner" flag in the node structure to trueto indicate
that the node may act aa a provisioner.
Change-Id: I599740694dde48955e2492acf13d3812d5938828
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Brian Gix [Thu, 9 May 2019 21:33:21 +0000 (14:33 -0700)]
mesh: Add key storage
This implements internal key storage add/delete/fetch for the three
basic key types managed in Mesh: Network, Application and Device.
This key storage is separate from keys assigned to nodes within the
mesh, and are used to support Configuration Client functionality.
Change-Id: Ie582b6c0de2ed81c3b9e35cd5f1fc63674be2334
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Brian Gix [Thu, 9 May 2019 21:33:20 +0000 (14:33 -0700)]
mesh: Reconfigure node storage tree
Add a tree structure to a nodes data storage, in order to safely handle
Replay Protection list, Refactor local Sequence Numbers, and add Key
storage for Config Client nodes.
Change-Id: Ib66ad23430b8fc6c4864f83a69c3afb6ed10b9bf
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Inga Stotland [Wed, 8 May 2019 21:50:08 +0000 (14:50 -0700)]
mesh: Add CreateNetwork method() implementation
This implements CreateNetwork() method on org.bluez.mesh.Network1
interface. Invoking this method generates a self-provisioned
local node associated with a brand new mesh network. This new
network is bare bones: only one network key is defined. The new node
assumes the role of mesh network manager and will be able to use
soon to be implemented methods of org.bluez.mesh.Management1 interface
to provision remote nodes into its network and to add/update/remove
network and application keys.
Change-Id: I2b4e37e98582a272fba9c421c010691a1e921db3
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Michał Lowas-Rzechonek [Wed, 8 May 2019 14:24:45 +0000 (16:24 +0200)]
mesh: Use node uuids as storage directory names
Instead of keeping track of unique 16bit node identifiers, reuse their
UUIDs to create both storage directories and dbus objects.
Because of that:
- UUID is no longer stored in the JSON file, it's inferred from the
directory name instead
- Join(), CreateNetwork() and ImportLocalNode() APIs return an error if
given UUID already registered within the daemon
Change-Id: I86032691fa81003c5503880c4bbf9a76aa7bd26e
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Inga Stotland [Mon, 29 Apr 2019 19:45:09 +0000 (12:45 -0700)]
mesh: Unify processing of GetManagedObjects result
This combines processing of results obtained from GetManagedObjects
request for both Attach() and Join() methods
Change-Id: I4cfc035f5433c4946d9e7eeaf0fdc5298b4b33ed
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Inga Stotland [Mon, 29 Apr 2019 19:45:08 +0000 (12:45 -0700)]
mesh: Consolidate processing of mesh element properties
Consolidate functions to parse and process properties of mesh
element objects. Also, add validation of element composition
when processing Attach() method.
Change-Id: I34fd3db467c75fe80e61e79801e096eeb233136b
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Inga Stotland [Mon, 29 Apr 2019 19:45:07 +0000 (12:45 -0700)]
mesh: Clean up processing of Attach() method
This changes the prototype for the callback function of
Attach() method call: remove unused node_path argument and make the
callback more generalized and re-usable for other method calls.
Change-Id: I6aab7fb6a8afdd32e14f785cb09f15dfbf021816
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Inga Stotland [Mon, 29 Apr 2019 19:45:06 +0000 (12:45 -0700)]
mesh: Remove Node interface if node owner disconnects
This unregisters Node interface associated with a specific node
application when this application disconnects from D-Bus.
Change-Id: Ia01f2b898e2a79c54433fcf6ed46467166aff815
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Brian Gix [Thu, 18 Apr 2019 22:15:18 +0000 (15:15 -0700)]
mesh: Add APIs for Provisioner and Config Client
The added D-Bus APIs enable Applications to function in a Provisioner
Initiator role, and as a Configuration Client.
Change-Id: I9d038b7fded415a3a43e5d41f5c94218fce96e9a
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Inga Stotland [Thu, 18 Apr 2019 04:33:32 +0000 (21:33 -0700)]
mesh: Fix the cleanup of failed Join call
This fixes the accidental swap of conditional checks: on failure,
remove agent info if agent is registered and remove temporary node,
if one has been created.
Change-Id: Ied17e66039641c6133ee3f83e687e9adcff6b22a
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Inga Stotland [Mon, 22 Apr 2019 15:25:55 +0000 (08:25 -0700)]
mesh: Fix structure memeber initialization
This fixes incorrectly reversed assignment of "friend" value in
convert_node_to_storage()
Change-Id: Ief74507a1aa41b3376f42d8ee1d3beccf85fa218
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Inga Stotland [Mon, 22 Apr 2019 04:51:11 +0000 (21:51 -0700)]
mesh: Allow only one app attachment per node
If a node is already attached to an application process,
disallow another appication to attach to the same node.
This means that an Attach() method called with the token
identifying a node that is already in use, returns an error
org.bluez.mesh.Error.AlreadyExists
Change-Id: Ifde6a2c13ed5d0c044086c58bbb5013fe9f8eb59
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Inga Stotland [Thu, 18 Apr 2019 06:31:10 +0000 (23:31 -0700)]
test: Enable test-mesh to send raw vendor commands
This adds a sample vendor model to the first element of the
mesh node. A new menu entry allows to generate and send a raw
vendor command.
Change-Id: Ic620c0f39e44a414b4ef89938026582f2305c2bd
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Inga Stotland [Thu, 18 Apr 2019 06:31:09 +0000 (23:31 -0700)]
test: Drive test-mesh with a string-based menu
Switch to string interactive commands to drive testing
of bluetooth-meshd. Re-work the menu to allow global setting of
destination address and AppKey index for outbound mesh messages.
Change-Id: Id9d8eb5b8b8d8b439ff6f00c6db583f7638af616
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Inga Stotland [Thu, 18 Apr 2019 04:13:06 +0000 (21:13 -0700)]
mesh: Fix network information cleanup
This fixes issues caused by accessing invalidated entries of nets
queue that were left around when removing network info in
mesh_net_detach()
Change-Id: Ic19c0232cbb095a658b8be56ea06f989d07dabfb
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Brian Gix [Mon, 15 Apr 2019 21:16:44 +0000 (14:16 -0700)]
mesh: Fix decryption when on more than one Network
Multiple networks use different IV Index's, so we should only use
decryption cache after successful decoding.
Change-Id: Iddd0841de1471e1f4682aa243ede503747f63bd7
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Brian Gix [Thu, 4 Apr 2019 22:43:14 +0000 (15:43 -0700)]
mesh: Create and store random token per node
Fix issue with device key being used as a token. Token now seperate, and
with a portable representation in the node database.
Change-Id: Iefeaaf2c424e4fd03772be990a7f0ac382df57ea
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Brian Gix [Thu, 21 Mar 2019 20:55:18 +0000 (13:55 -0700)]
mesh: Store node state variables prior to response
Remotely set node state variables need to be saved to the file system
or other NVM prior to returning success status.
Change-Id: I1fc365fbb082e218319526becc02078b3a112ba1
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Brian Gix [Thu, 21 Mar 2019 20:55:17 +0000 (13:55 -0700)]
mesh: Fix json-c calling conventions
Fix issue assuming that failed calls to json_object_object_get_ex() will
always NULL the out parameter. Re-coded to always check the returned
boolean for success or failure.
Change-Id: Ia9f1bb85b443c5b17e8e7e9ddee35f2beca2b763
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Inga Stotland [Fri, 22 Mar 2019 02:26:10 +0000 (19:26 -0700)]
mesh: Fix adding model app key binding
This fixes the situation when a new app key binding is being
added to a model and the list of bindings does not exist yet.
If the list does not exist, it is created and the binding is
added to it.
Also, remove unnecessary memory alloc check when model subscriptions
are added.
Change-Id: I3ee84aefee6acdc45f2c12e5a65c70e9f19669fd
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Inga Stotland [Thu, 21 Mar 2019 07:32:40 +0000 (00:32 -0700)]
mesh: Correctly initialize node's vendor models
This fixes vendor model initialization based on node properties
collected during Join() method call.
Change-Id: Ie7fc4c004717a86086db323d86e1d113a20c03b3
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Stotland, Inga [Mon, 11 Mar 2019 19:00:01 +0000 (12:00 -0700)]
mesh: Fix bug with adding more than one app key
Fixed problem where if the appKeys array already exists, that
new add key requests were rejected.
Change-Id: I416c2b2848ea15e53f9c2ddc168dc928d455466e
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Inga Stotland [Sun, 10 Mar 2019 07:53:13 +0000 (23:53 -0800)]
test: Add unified test for mesh node example app
This adds one script, test-mesh, to replace three test-join,
example-onoff-server and example-onoff-client.
This is menu driven test that allows provisioning (join) and/or
connecting existing (attach) nodes.
Change-Id: Id102fcdc3ee9d4809d12f8b799dfc953341fe114
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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.
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>