Inga Stotland [Tue, 30 Jun 2020 18:56:14 +0000 (11:56 -0700)]
doc/mesh-api: Add dictionary to model properties
This changes the signature of "Models" and "VendorModels" properties
on org.bluez.mesh.Element1 interface to contain a dictionary with
model options.
Models: signature change "aq" -> "a(qa{sv})"
VendorModels: signature change "a(qq)" -> "a(qqa{sv})"
Currently, the defined keywords for the options dictionary are
"Publish" - indicates whether the model supports publication mechanism.
If not present, publication is enabled.
"Subscribe" - indicates whether the model supports subscription mechanism.
If not present, subscriptions are enabled.
The dictionary allowed to be empty.
Change-Id: I7c4bd0f21c1a6c8c3d889b76433ec61ac6081598
Signed-off-by: anuj.bhumiya <anuj.bhumiya@samsung.com>
Inga Stotland [Fri, 26 Jun 2020 21:59:07 +0000 (14:59 -0700)]
mesh: Clean up config model publication set
No functioal changes. Make code more readable, plus style fixes.
Change-Id: I10e04a4cc446145b59c5acc2c8b4bd5896b2afa5
Signed-off-by: anuj.bhumiya <anuj.bhumiya@samsung.com>
Brian Gix [Mon, 22 Jun 2020 18:00:04 +0000 (11:00 -0700)]
mesh: Fix memory leak when queuing OB pkts rapidly
If a new packet for outbound delivery is queued during the last
transmission of the only other packet being sent, the prior
packet got forgotten and leaked. This fix correctly deletes the prior
packet, but also makes sure it is given the proper oportunity for
transmission.
Change-Id: I1e05a8d55f9a8ee92b049be5bbcd24969a1b10d4
Signed-off-by: anuj.bhumiya <anuj.bhumiya@samsung.com>
Inga Stotland [Fri, 19 Jun 2020 21:26:55 +0000 (14:26 -0700)]
tools/mesh-cfgclient: add list of blacklisted addresses
This adds a concept of "blacklisted" addresses. that a provisioner is
not allowed to assign to newly added mesh nodes.
An address may be "blacklisted" is a node has been removed from the network
(e.g., after node reset procedure). This ensures that the addresses are not
reused for provisioning new nodes to prevent a potential communication
problem due to saved RPL entries associated with these addresses in the
rest of the mesh network. The address is "cleared", when IV index updates
at least twice.
Change-Id: I672c71cd18d6fc987a8ee3f8d27514b752b925e0
Signed-off-by: anuj.bhumiya <anuj.bhumiya@samsung.com>
Inga Stotland [Fri, 19 Jun 2020 21:26:54 +0000 (14:26 -0700)]
tools/mesh-cfgclient: get/set IV index
This adds keeping track of IV index changes.
The updates are detected by observing PropertiesChanged signal
on local node's object path and reading "IvIndex" property
Change-Id: I40996e727f9f638e384a7c64d4a9cd606e00511c
Signed-off-by: anuj.bhumiya <anuj.bhumiya@samsung.com>
Inga Stotland [Fri, 19 Jun 2020 21:26:53 +0000 (14:26 -0700)]
mesh: Emit PropertiesChanged when IV Index changes
This adds emitting of PropertiesChanged signal whenever the
mesh IV index is updated to indicate that the vlaues of "IvIndex"
property has been modified.
Change-Id: I7ce2a982348e7ed92185bccd745c9050f778bc11
Signed-off-by: anuj.bhumiya <anuj.bhumiya@samsung.com>
Michał Lowas-Rzechonek [Wed, 17 Jun 2020 20:26:57 +0000 (22:26 +0200)]
mesh: Replace BeaconFlags with just IvUpdate
To import nodes, applications need just IvIndex and IvUpdate. KeyRefresh
phase in under provisioner's control, so we don't need to expose it.
Moreover, BeaconFlags property dealt just with the primary net key, and
each subnet key is refreshed separately.
Change-Id: Ia0f878b4531932fc32ddd490eb4684fcff1c1b93
Signed-off-by: anuj.bhumiya <anuj.bhumiya@samsung.com>
Brian Gix [Tue, 16 Jun 2020 18:14:36 +0000 (11:14 -0700)]
mesh: Add deferral of Attach() and Leave() if busy
We require the successful return of JoinComplete() method before
handling subsequent Attach() or Leave() method calls. To simplify the
construction of Applications, we will accept one of these calls up to 1
second prior to receiving the final return status of JoinComplete,
which tells us that the Application is ready to use the node.
If the node is still not ready after the deferral, Attach and/or Leave
will fail.
Change-Id: I874b8f8243d17f862fbaa0f7b91b7b1fc627c137
Signed-off-by: anuj.bhumiya <anuj.bhumiya@samsung.com>
Michał Lowas-Rzechonek [Mon, 15 Jun 2020 12:41:08 +0000 (14:41 +0200)]
mesh: Rename IVUpdate import flag to IvUpdate
Name change for consistency with "IvIndex" property.
Change-Id: I7af9b75553a73cb13feee63614a2501a73074513
Signed-off-by: anuj.bhumiya <anuj.bhumiya@samsung.com>
Inga Stotland [Thu, 11 Jun 2020 18:30:38 +0000 (11:30 -0700)]
mesh: Delete unused structures/functions
This deletes unused functions and structures in net.c & net.h.
Plus, some style cleanup.
Change-Id: Ic03ac2b38811c404579f904c311aba47dec982a1
Signed-off-by: anuj.bhumiya <anuj.bhumiya@samsung.com>
Michał Lowas-Rzechonek [Mon, 15 Jun 2020 11:11:52 +0000 (13:11 +0200)]
mesh: Fix updating CID, PID, VID & CRPL on node attach
In
8a382262125787caf38a1f800ec8956a1bf71d85, we wanted to allow the
application to update certain composition fields. This patch makes it
work.
Change-Id: I4323cf58605b0961cb46aba06d4355603f61d2cf
Signed-off-by: anuj.bhumiya <anuj.bhumiya@samsung.com>
Inga Stotland [Wed, 10 Jun 2020 17:11:21 +0000 (10:11 -0700)]
mesh: Add "node is busy" check for Leave() & Attach()
This introduces the following behavior change for those methods
on Network interface that specify node token as an input parameter
Leave() method:
If Leave method is called for a node that is being processed as a result
of a Create, Import, Join or Attach method calls in progress, node removal
is not allowed and org.bluez.mesh.Error.Busy error is returned.
Attach() method:
If Attach method is called for a node that is being processed as a result
of a Create, Import or Join method calls in progress, node attachment
is not allowed and org.bluez.mesh.Error.Busy error is returned.
Change-Id: I994d81ef27eb6e7e2423a6504fcf3396ea039a15
Signed-off-by: anuj.bhumiya <anuj.bhumiya@samsung.com>
Inga Stotland [Wed, 10 Jun 2020 17:11:20 +0000 (10:11 -0700)]
mesh: Add timeout to GetManagedObjects call
Switch to using dbus_send_with_timeout when making a request
to get managed objects from an application.
Change-Id: I5c95b22e0cafa36133ffb5bff1e76764fb4cf398
Signed-off-by: anuj.bhumiya <anuj.bhumiya@samsung.com>
Inga Stotland [Wed, 10 Jun 2020 17:11:19 +0000 (10:11 -0700)]
mesh: Add destroy callback to dbus_send_with_timeout()
This adds a destroy callback as a function parameter to
dbus_send_with_timeout() to allow automatic release of user data
on either reply or timeout.
Change-Id: Id97ac8108066c58130a2c1ee629d197a8ad8cb67
Signed-off-by: anuj.bhumiya <anuj.bhumiya@samsung.com>
Inga Stotland [Wed, 10 Jun 2020 17:11:18 +0000 (10:11 -0700)]
mesh: Make "Busy" and "InProgress" to be distinct errors
This separates "Busy" and "InProgress" error codes:
MESH_ERROR_IN_PROGRESS maps to org.bluez.mesh.Error.InProgress
MESH_ERROR_BUSY maps to org.bluez.mesh.Error.Busy
Minor API change:
UpdateAppKey() returns "InProgress" error instead of "Busy"
Change-Id: I4d30be4542e6f8c5130dab24a056f6a94877da5c
Signed-off-by: anuj.bhumiya <anuj.bhumiya@samsung.com>
Inga Stotland [Wed, 10 Jun 2020 17:11:17 +0000 (10:11 -0700)]
mesh: Delete unused function
This deletes unused function node_is_provisioned()
Change-Id: I5f5b51e411252137fcfc7e3e01f75b6ab979fb0f
Signed-off-by: anuj.bhumiya <anuj.bhumiya@samsung.com>
Brian Gix [Mon, 8 Jun 2020 23:07:45 +0000 (16:07 -0700)]
mesh: Fix clean-up introduced bug
Before the clean-up we were making a useless check of an otherwise
unused boolean (net->provisioner) to determine if we should decode with
device keys (which was incorrect). This was replaced by a check the
node type (node->provisioner). However, the check was incorrect in the
first place, and prevents provisioner nodes from decrypting non device
key messages.
Change-Id: Ia6c8a52afbfe03599884a29d71003a60231f71cb
Signed-off-by: anuj.bhumiya <anuj.bhumiya@samsung.com>
Inga Stotland [Fri, 5 Jun 2020 21:31:43 +0000 (14:31 -0700)]
mesh: Remove unused/redundant functions
This removes mesh_net_provisioner_mode_set (unused) and
mesh_net_provisioner_mode_get (duplicates node_is_provisioner)
Change-Id: I9fe41d0c30828fa4faa4a9757b0c4a5e81146b43
Signed-off-by: anuj.bhumiya <anuj.bhumiya@samsung.com>
Michał Lowas-Rzechonek [Tue, 31 Mar 2020 09:04:00 +0000 (11:04 +0200)]
mesh: Fix FPE in overcommit logic.
During overcommit, mesh_config_save is called in asynchronous mode to
avoid blocking Send() calls. This means that update of cfg->write_time
is scheduled via l_idle_oneshot, so if the next Send() gets scheduled
first, the code may see elapsed time of zero.
If this happens, then the overcommit logic was already executed and the
overcommit is pending, so we can just return.
Change-Id: I13bd46cd94e4a415ebcf2a97cff283bab2d635f4
Signed-off-by: anuj.bhumiya <anuj.bhumiya@samsung.com>
Inga Stotland [Sun, 31 May 2020 04:41:28 +0000 (21:41 -0700)]
mesh: Remove unused functions from net.c
The folllowing functionsa are not being used anywhere in the code and
have been removed:
mesh_net_flush()
mesh_net_prov_caps_get()
mesh_net_priv_key_get()
mesh_net_priv_key_set()
mesh_net_prov_rand()
mesh_net_prov_uni()
mesh_net_id_uuid_set()
mesh_net_test_addr()
mesh_net_test_mode()
mesh_net_uni_range_set()
mesh_net_uni_range_get()
mesh_net_set_window_accuracy()
Change-Id: Id8226cd2349d4a8b5dbd2e95ff976b5d2c04a692
Signed-off-by: anuj.bhumiya <anuj.bhumiya@samsung.com>
Inga Stotland [Sun, 31 May 2020 04:41:27 +0000 (21:41 -0700)]
mesh: Clean up style in net.c
Change-Id: Iba040f18c86f7d66cdef68ab455e472ef7d13973
Signed-off-by: anuj.bhumiya <anuj.bhumiya@samsung.com>
Inga Stotland [Sun, 31 May 2020 04:41:26 +0000 (21:41 -0700)]
mesh: Remove debug-only related callback for packet send
This removes callback for sending every single access layer packet
since the callback does nothing but print debug satement. This
functionality is mature enough not to require such heavy debugging.
Change-Id: I033c970953b21a1f10701d919bc4b2f8789bf86d
Signed-off-by: anuj.bhumiya <anuj.bhumiya@samsung.com>
Inga Stotland [Sun, 31 May 2020 04:41:25 +0000 (21:41 -0700)]
mesh: Debug output clean up
This changes l_info() to l_debug() for recurring cases and
removes some excessive debug output.
Change-Id: Ic9ff25a75b549a55c273112fe8aec7830aeb64ff
Signed-off-by: anuj.bhumiya <anuj.bhumiya@samsung.com>
Inga Stotland [Sun, 31 May 2020 04:41:24 +0000 (21:41 -0700)]
mesh: Helper packet print should depend on debug setting
This changes the utility function print_packet() to check if
daemon is running in debug mode.
Change-Id: Ib23f995a3e89297ad239a4a3557bb6b7600b47ed
Signed-off-by: anuj.bhumiya <anuj.bhumiya@samsung.com>
Prathyusha N [Tue, 24 Mar 2020 19:27:17 +0000 (00:57 +0530)]
mesh: Handle close for Acceptor
Provision complete callback is handled in provision failure case.
If link closed received abruptly with reason success, triggered
provision complete callback. Removed session timeout and session
free as they are handled in pb_adv_unreg.
Change-Id: Ib1ec9d21b2ed848475f79866f8ff2a9aae92cbc3
Signed-off-by: anuj.bhumiya <anuj.bhumiya@samsung.com>
Wootak Jung [Thu, 8 Oct 2020 00:57:47 +0000 (09:57 +0900)]
Allow AcquireNotify without CCC
This patch fixes this behavior so that AcquireNotify
immediately registers the callback and returns success for
characteristics with no CCC
Change-Id: I4077ec021b52cb88cd302a94b5ceaedf15ab833d
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
Michael Nosthoff [Fri, 24 Jul 2020 14:03:06 +0000 (16:03 +0200)]
main: add missing comma after AlwaysPairable
Commit
1880b2990866 ("core: Add AlwaysPairable to main.conf") added a new
key to supported_options but didn't add a comma. This leads to the
following error message on startup if the key 'PairableTimeout' is pesent:
Unknown key PairableTimeout for group General in /etc/bluetooth/main.conf
This probably also leads to ignoring the setting.
Fixes:
1880b2990866 ("core: Add AlwaysPairable to main.conf")
Change-Id: I193e6da4956605a932f08d2f4ec3000e23fc2bb5
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
Anupam Roy [Mon, 14 Sep 2020 05:24:17 +0000 (10:54 +0530)]
Dont remove connected device at discovery cleanup
It is possible that a device is already connected
as a temporary device, using a BLE random address.
In such situation, adapter should not remove that
device during discovry cleanup action.
This patch skips removing device if device is
already connected.
Change-Id: I93dc0003e0b1a6917c6a3d9ebc93f04c89205346
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Deokhyun Kim [Tue, 25 Aug 2020 06:44:37 +0000 (15:44 +0900)]
set_advertising returns in_progress error even if the restart is scheduled by le connection.
le_discovering should be set before remove_watch is called
[Model] 5.5
[BinType] AP
[Customer] OPEN
[Issue#] P200824-01952
[Request] PLM
[Occurrence Version] R825USQE1BTH8
[Problem] set_advertising fails
[Cause & Measure] advertising is already stopped by le connection.
And the restart is scheduled with 300ms delay.
set_advertising returns in_progress error even if the restart is scheduled
by le connection.
[Checking Method] Try to stop advertising right after le is connected.
[Team] Bluetooth
[Developer] Deokhyun Kim
[Solution company] Samsung
[Change Type] Specification change
Change-Id: I7fef2e0b5fba1219dfe8f02b223d870450ccb651
Signed-off-by: Deokhyun Kim <dukan.kim@samsung.com>
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
Deokhyun Kim [Fri, 24 Jul 2020 05:06:43 +0000 (14:06 +0900)]
Clear le scan resources when it's stopped by kernel
Change-Id: I76412a0d5c1fa924027c5e96cd0f812bfbb556a6
Signed-off-by: Deokhyun Kim <dukan.kim@samsung.com>
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
Anupam Roy [Thu, 20 Aug 2020 15:34:50 +0000 (21:04 +0530)]
mesh: Add api to release node dbus resources
Currently, there is no way to release the node
and attach it back without disconnection of
dbus client. It is possible that dbus client
is owner of multiple mesh nodes and it intends
to stop using one or multiple nodes & re-attach
them back without disconnecting from dbus.
This patch introduces a Release API through which
dbus client can request to release the node's
dbus resources. dbus client can attach the node
after releasing it at any point of time.
Change-Id: I9ffb2588f1c1dc5d2ccbe45ab5c447ed916c593f
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Abhay Agarwal [Fri, 14 Aug 2020 16:19:36 +0000 (21:49 +0530)]
mesh: Update capabilities of bluetooth-mesh
This patch updates bluetooth-mesh capabilities to allow network_fw
user to launch bluetooth-mesh daemon on HCI RAW socket.
Change-Id: I009c7356fb34f748e672d715b831c1967bf6aea2
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Abhay Agarwal [Mon, 15 Jun 2020 08:40:47 +0000 (14:10 +0530)]
mesh: Add support for meshd to use RAW channel
This patch adds an option to launch meshd with HCI RAW
channel instead of HCI user channel.
This will enable simultaneous operation of meshd with
bluetoothd when HCI user channel can not be created due
to non-availability of independent HCI controller.
Change-Id: I484c478208376ad0e1f1bd8a7b648494ae3f71fb
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
DoHyun Pyun [Thu, 30 Jul 2020 05:21:09 +0000 (14:21 +0900)]
Remove unnecessary dbus config rules
Change-Id: I3292894c38b24c3a1117320d92f83786f7ec3556
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
Pyun DoHyun [Wed, 29 Jul 2020 06:52:13 +0000 (06:52 +0000)]
Merge "Revert dbus rule for mesh with send_destination" into tizen
Pyun DoHyun [Mon, 29 Jun 2020 22:41:15 +0000 (22:41 +0000)]
Merge "a2dp: Store Delay Reporting capability" into tizen
Luiz Augusto von Dentz [Mon, 18 May 2020 20:02:03 +0000 (13:02 -0700)]
a2dp: Store Delay Reporting capability
This stores Delay Reporting capability so it is properly restored when
loading from cache.
Change-Id: Iaa25bb13efb2d64f719e7213e13211daabf5f981
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
DoHyun Pyun [Thu, 25 Jun 2020 01:10:21 +0000 (10:10 +0900)]
Remove bluez-devel and libbluetooth rpm
Bluez testing tools only use libbluetooth.so. So we
don't need to provide it as the developement package.
Change-Id: I47960e8eb3c4bb8137ea4561458714d47ce6302f
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
DoHyun Pyun [Mon, 22 Jun 2020 23:18:16 +0000 (08:18 +0900)]
Revert dbus rule for mesh with send_destination
When we remove the original rules, some method calls
are rejected by 'AccessDenied' error.
Change-Id: Ifc5f04455c412be9da7d94cb5b9a69e8eb412804
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
DoHyun Pyun [Tue, 16 Jun 2020 03:31:41 +0000 (12:31 +0900)]
Modify mesh dbus configs
To avoid the dbus check error, remove send interface lines
You mustn't use send_interface without send_destination or
send_destination_prefix, unless you limit the rule to only
signals with send_type="signal"
Change-Id: I5960bf0a9a99d745ad4c1c6a175f93e246f0ab14
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
DoHyun Pyun [Fri, 5 Jun 2020 04:53:20 +0000 (13:53 +0900)]
Modify the security option for bluetooth-meshd
Change-Id: I8452eb5b07daa57c60f6bdbdb251781a6855058a
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
Brian Gix [Fri, 22 May 2020 21:07:52 +0000 (14:07 -0700)]
mesh: Destroy PB-ADV queue when provisioning done
Change-Id: I4468a47480bf7653e90d9396627a63acf16f367f
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Brian Gix [Fri, 22 May 2020 19:50:32 +0000 (12:50 -0700)]
mesh: Fix leaked message reference
Change-Id: I5184625d2b6d443f44e6819c64f0b738bfdfa7ee
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Brian Gix [Fri, 22 May 2020 19:50:07 +0000 (12:50 -0700)]
mesh: Fix leaked mesh_net allocation
Change-Id: I0eef7ea2f02e0b3263ffd06c181f6895e6f66bb1
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Brian Gix [Fri, 22 May 2020 18:40:40 +0000 (11:40 -0700)]
mesh: Fix using uninitialized bytes
Fixes two problems found with static analysis
Change-Id: I66cef81aad17068d50f182b241b7acc6f0ff73f4
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Inga Stotland [Fri, 22 May 2020 00:35:01 +0000 (17:35 -0700)]
mesh: Clean up Join() method
This consolidates various places where a pending response
to Join() is created and makes sure that l_dus_message_unref()
is called correctly.
Change-Id: I494c602d206eaf35c9b1603b8b6444a0c30912f7
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Inga Stotland [Fri, 22 May 2020 00:35:00 +0000 (17:35 -0700)]
mesh: Fix memory leak in Create, Import & Attach methods
This ensures that every time l_dbus_message_ref() is used to preserve
a message for a pending method reply, there is a matching call to
l_dbus_message_unref().
Change-Id: I5c6846f9ab9ca11d23c7729933af0e2945d015c1
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Inga Stotland [Fri, 22 May 2020 00:34:59 +0000 (17:34 -0700)]
mesh: Clean up Attach() method call
This consolidates error return form one place: off a callback
with unsuccessful status.
Change-Id: I3c39a8bb7e6198f730ce8c1a8f7da97e43f65823
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Inga Stotland [Fri, 22 May 2020 00:34:58 +0000 (17:34 -0700)]
mesh: Clean up Import() method call
This removes unnecessary failing conditions in Import() call and
simplifies iterations through "flags" dictionary.
Change-Id: I7388fdffc3ba599b626a3c4f362a0869cd5f55c4
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Inga Stotland [Fri, 22 May 2020 00:34:57 +0000 (17:34 -0700)]
mesh: Create a queue of pending requests in mesh_init()
This removes unnnecessary checking for queue existence every time
either Attach(), Create() or Import() methods are called.
Change-Id: Icb85c67267594b9fa9f6a11c6f00a35eee8f9fc9
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Inga Stotland [Fri, 22 May 2020 00:34:56 +0000 (17:34 -0700)]
mesh: Remove unused function prototypes from node.h
Change-Id: I69310c1cf2f0dbbe4624505f8ac2b60598db2693
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Inga Stotland [Fri, 22 May 2020 00:34:55 +0000 (17:34 -0700)]
mesh: Add finalization of a newly created node
When a new node is created as a result of successful completion
of either Join() or Create() or Import() methods and has been
confirmed via successful token delivery to the application,
clean up node's D-Bus resources (application path, element paths, etc)
that have been gathered during the initial GetMAnagedObjects() call.
Also, remove the agent instance associaed with the new node.
These resources will be re-populated after the Attach() call
verifies the node's integrity.
Change-Id: Icaf8b5f6d747cb82ac6443550393dc00d36af2e2
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Inga Stotland [Fri, 22 May 2020 00:34:54 +0000 (17:34 -0700)]
mesh: Remove agent when freeing node's dynamic resources
This adds clean up of node's agent instance when node's dynamic
resources are freed.
Change-Id: I588153a99aa27284704b849265b9dcc1ebba3cfa
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Inga Stotland [Fri, 22 May 2020 00:34:53 +0000 (17:34 -0700)]
mesh: Free allocated agent in mesh_remove_agent()
This adds previously missing call to free memory allocated
for agent structure.
Change-Id: Ibdb5336c5dfd52ad16b2718efea54692be76c72c
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Inga Stotland [Fri, 22 May 2020 00:34:52 +0000 (17:34 -0700)]
mesh: Remove unused structure member
This removes unused "agent" member from join_data structure.
Change-Id: I58446ca4058a394f3f1a0b4fac6f01be0c0cb3d0
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Brian Gix [Wed, 20 May 2020 22:14:38 +0000 (15:14 -0700)]
mesh: Fix double-free
This fixes a double-free error when destroying the NVM storage of a mesh node.
Cleanly handle two distinct scenarios:
1. When the node is being deleted at runtime. This causes release of
both dynamic memory and NVM storage.
2. During shutdown, we release dynamic memory only.
Change-Id: Ib69263c627e08f396d2f5dacbc04b4cfe0aace35
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Inga Stotland [Fri, 15 May 2020 17:41:56 +0000 (10:41 -0700)]
mesh: Fix segfault caused by re-enabling of HCI controller
This fixes the crash that occurs when a controller used by bluetooth-meshd
is removed and then added back again.
Also, correctly restart scanning when the controller is re-enabled.
Backtrace:
0x00005618e754d040 in ?? ()
0x00005618e6e12d9a in io_ready_callback () at mesh/mesh.c:174
0x00005618e6e3d2c8 in l_queue_foreach () at ell/queue.c:441
0x00005618e6e37927 in request_complete () at src/shared/mgmt.c:261
Change-Id: I360e9b1e4c39898d8b3c695e58f03cb89cf8076e
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Brian Gix [Sat, 16 May 2020 01:22:03 +0000 (18:22 -0700)]
mesh: Fix valgrind memory leak warnings
These warnings are caused by not completely freeing memory allocations
at shutdown, and are not serious, but they make valgrind output cleaner.
Change-Id: Ib08bb727fee9ea6dccd5e484bcd5d2f969b80a19
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Brian Gix [Sat, 16 May 2020 01:22:02 +0000 (18:22 -0700)]
mesh: Fix valgrind memory leaks
These memory leaks are ones that will compound over time with node
creation and deletion.
Change-Id: I67f757af13ea4d90676756ee6e1b786cefddef46
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Inga Stotland [Sat, 9 May 2020 00:00:24 +0000 (17:00 -0700)]
mesh: Remove redundant call to save node configuration
This removes a redundant call to save node configuration in
add_local_node(): there is a number of unconditional calls to
mesh_config_write_<some_node_Setting>() within this function
which would result in the node configuration being saved implicitly.
Change-Id: I6ffb8eea7f627c734c2728940f9a24223ad19e8c
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Inga Stotland [Sat, 9 May 2020 00:00:23 +0000 (17:00 -0700)]
mesh: Allow updating CID, PID, VID & CRPL on node attach
This allows to update settings of the following composition fields
when an existing node (application) attaches to the daemon:
Company ID (CID), Product ID (PID), Versioin ID (VID),
CRPL (replay protection depth)
Change-Id: I674c7f04f4d6c11c7b8feaca08fd6b1ccb9af9c6
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Inga Stotland [Sat, 9 May 2020 00:00:22 +0000 (17:00 -0700)]
mesh: Avoid saving duplicate fields in node config
This modifies miscellaneous utility functions in mesh-config-json.c:
when writing a new value to a node configuration file, delete
the existing field containing an old value first.
Change-Id: Iaed77e58eb33bbb3193d366ee909c75306ab40fc
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Inga Stotland [Sat, 9 May 2020 00:00:21 +0000 (17:00 -0700)]
mesh: On node attach, verify element/model composition only
When attaching an existing node, verify only the "elements" part
of device composition, i.e., skip verification of CID/PID/VID, CRPL
and features.
Change-Id: I0cc22ce1fe0128bdbb93abe2811ef5558807b2c4
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Inga Stotland [Fri, 8 May 2020 02:45:48 +0000 (19:45 -0700)]
tools/mesh-cfgclient: Save node's composition in config
Store remote node's composition after successful completion
of "composition-get" command (config menu).
Show model IDs when printing node info for "list-nodes" command
(main menu).
Change-Id: I679efd9c7214f2dc1132988395b312178eddf6ea
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Inga Stotland [Wed, 6 May 2020 21:44:49 +0000 (14:44 -0700)]
tools/mesh-cfgclient: Fix model app list parsing
This fixes parsing of Model AppKey List & Vendor Model Appkey List
messages: taking into account the packt that AppKey indices are parked
two in three octets.
Also, when printing key indices, print in both decimal and hexadecimal
formats.
Change-Id: Iad95817a4f2f0789838f6701045959d7597d00c4
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Inga Stotland [Tue, 5 May 2020 17:43:03 +0000 (10:43 -0700)]
tools/mesh-cfgclient: Fix saving KR phase to config file
This eliminates extra write of KR phase when loading keys
from the configuration file on initialization.
Change-Id: If49adbfa1373be304b2a2396d2736a2727d2e8ce
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Inga Stotland [Wed, 29 Apr 2020 20:20:54 +0000 (13:20 -0700)]
mesh: Fix publication setup for vendor models
This fixes model ID generation when processing Config Pub Set
message. Also, cleanup some debug prints.
Change-Id: Ie92943fdc7e33f55b271d56fc06dfcce30cf92ff
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Inga Stotland [Wed, 29 Apr 2020 18:05:41 +0000 (11:05 -0700)]
mesh: Fix adding virtual subscription to a vendor model
This fixes a case when a configuration server receives a virtual
subscription add/overwrite command targeting a vendor model.
Correctly set "vendor" argument before trying to save the updated
subscrition to configuration file.
Change-Id: I7ff5ca02e20819b316ef2f3b62e7ff01092d3070
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Brian Gix [Tue, 21 Apr 2020 20:08:37 +0000 (13:08 -0700)]
test/mesh: Remove Provisioner interface
This change removes the Provisioner Initiator from the python test
script, along with the menu commands for create, scan and add. This
makes it a cleaner Python3 example of a simple On/Off node, and a
fuller featured Provisioner/Config Client still exists in the tools
subdirectory.
Change-Id: I020fd501df2342eac4f8f9bc46de49ec2497a172
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Brian Gix [Tue, 21 Apr 2020 16:09:51 +0000 (09:09 -0700)]
test/mesh: Fix token format to use all 16 digits
Change-Id: I15c592d706056406645bfacc0be31b0b96c557d3
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Brian Gix [Fri, 17 Apr 2020 18:57:21 +0000 (11:57 -0700)]
mesh: Fix GCC 10.0 warnings
Change-Id: I4cb7bdc28d642357131dacff6457cd0aa752ecac
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Brian Gix [Tue, 14 Apr 2020 08:55:57 +0000 (10:55 +0200)]
mesh: Add Time-outs to critical dbus send-with-replies
JoinComplete() dbus method calls are the only time that node tokens are
delivered to client Applications, so if the call fails for any reason
(including time-outs) the daemon has a way to clean-up the stale unused
node data.
Change-Id: I9a524fc93a2987ec4d3480c6caaa10726d9d77c6
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Przemysław Fierek [Tue, 14 Apr 2020 08:55:56 +0000 (10:55 +0200)]
tools/mesh-cfgclient: Add waiting for 'JoinComplete'
Change-Id: I762a640cbb3ed8cb0834121bfb8b1ab3d73232c9
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Przemysław Fierek [Tue, 14 Apr 2020 08:55:55 +0000 (10:55 +0200)]
mesh: Change API to deliver tokens via JoinComplete
This patch changes Import and CreateNetwork API to deliver tokens via
the JoinComplete method call. When application doesn't raise any error
during handling JoinComplete then it is assumed that the token has been
saved, otherwise when application replies with an error message then the
node is removed.
Change-Id: I76b7e61ede93aac732bb24ff6948ff75108d939e
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Michał Lowas-Rzechonek [Tue, 14 Apr 2020 08:55:54 +0000 (10:55 +0200)]
doc/mesh: Change API to deliver tokens via JoinComplete
If Application is not be able to reliably store the token, the daemon
will end up with a uncontrollable node in its database.
Let's fix the issue by always delivering tokens using JoinComplete call,
and expecting a reply - if the application return an error, daemon will
get rid of the node.
Change-Id: I82ed48f64b9bd8d6b77c99eb28d470fd58f97148
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Przemysław Fierek [Thu, 9 Apr 2020 19:47:30 +0000 (21:47 +0200)]
mesh: Fix invalid app_path on 'Join'
This patch fixes invalid app_path on 'Join' method call - the daemon
tried to use the value of app_root API argument, while it should use
path discovered by scanning result of GetManagedObjects() call.
Change-Id: I4a7c8587d06e16aca7a6a081a6711a9fec52e872
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Rafał Gajda [Tue, 7 Apr 2020 09:32:51 +0000 (11:32 +0200)]
mesh: Ignore beacons with IVU if IV already updated
When daemon receives beacon with IV=n+1, IVU=False it will
start sending messages with new IV and set sequence to 0.
However if daemon receives another beacon with IV=n+1, IVU=True it
will go back to sending messages with old IV=n (IVU set to True).
Because sequence number has been reset those messages will be dropped
by replay protection and node will lose communication.
Once IV is updated daemon should not go back to using the old value.
This patch adds beacon rejection if IV has already been updated.
Change-Id: I32a19c26d3fbbd7b281fdc4a12fa0dd369173517
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Brian Gix [Tue, 7 Apr 2020 17:01:55 +0000 (10:01 -0700)]
tools/mesh-cfgclient: Default to highest security
To encourage best practices, we request the highest level of
security available in common between provision initiator and
acceptor.
Change-Id: Ibf539b8800d57fee9b851dbc22a367964e99f1bf
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Brian Gix [Tue, 7 Apr 2020 16:10:33 +0000 (09:10 -0700)]
unit: Exit test-mesh-crypto on any detected fail
Unit test would signal failures if run on commandline, but not if
run as part of a unit test sweep. This change forces an exit(1) on
any detected fail, and is caught by test suite runner.
Change-Id: Ice205022416bbcb91bd937a035e288bae1c2fc81
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Michał Lowas-Rzechonek [Thu, 26 Mar 2020 21:17:05 +0000 (22:17 +0100)]
mesh: Remove redundant code from mesh/crypto
- Remove application_encrypt/application_decrypt
- Make mesh_crypto_privacy_counter private, add mesh_crypto_pecb
- Make *_nonce functions private and align their implementation to be
more consistent
- Refactor network_encrypt/network_decrypt to use *_nonce functions and
rename them to packet_encrypt/packet_decrypt
- Refactor packet_encode/packet_decode
Change-Id: If342e994774714a75bdd0ae90766d1ec7b750b79
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Inga Stotland [Fri, 3 Apr 2020 01:26:55 +0000 (18:26 -0700)]
tools/mesh-cfgclient: Store "index" as integer in config
Write "index", "elementIndex", "boundNetKey" as integers
rather than hex strings in configuration file.
Change-Id: I824e548dfc5742f839f5e64513d283f2e849205b
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Inga Stotland [Fri, 3 Apr 2020 01:26:54 +0000 (18:26 -0700)]
tools/mescfg-client: Use local routines for config write
This removes dependencies on internal structures of
mesh/mesh-config-json.c.
Change-Id: Ibd8c2f2bf132d70faadd4591ff8fec755ab20096
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Inga Stotland [Thu, 2 Apr 2020 00:04:36 +0000 (17:04 -0700)]
mesh: Fix segfault related to idle config write
If node configuration is completely removed from the system,
remove all pending writes to the configuration file.
Fixes the segfault below:
mesh/cfgmod-server.c:node_reset() Node Reset
mesh/mesh-config-json.c:mesh_config_destroy() Delete node config /var/lib/bluetooth/mesh/
02040d0a060e0a08090b0103070f050c
mesh/util.c:del_fobject() RM /var/lib/bluetooth/mesh/
02040d0a060e0a08090b0103070f050c/rpl/
00000000/0001
mesh/util.c:del_fobject() RMDIR /var/lib/bluetooth/mesh/
02040d0a060e0a08090b0103070f050c/rpl/
00000000
mesh/util.c:del_fobject() RMDIR /var/lib/bluetooth/mesh/
02040d0a060e0a08090b0103070f050c/rpl
mesh/util.c:del_fobject() RM /var/lib/bluetooth/mesh/
02040d0a060e0a08090b0103070f050c/node.json.bak
mesh/util.c:del_fobject() RM /var/lib/bluetooth/mesh/
02040d0a060e0a08090b0103070f050c/node.json
mesh/util.c:del_fobject() RMDIR /var/lib/bluetooth/mesh/
02040d0a060e0a08090b0103070f050c
Segmentation fault
Program terminated with signal SIGSEGV, Segmentation fault.
0x0000563a35df2ed0 in ?? ()
0x00007fd6b131689f in json_object_to_json_string_length (jso=jso@entry=0x563a35dd8d30, flags=flags@entry=2,
Change-Id: Id92320eb3f05f4bda52cff1b6e41c5345bf1df2f
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Inga Stotland [Thu, 2 Apr 2020 00:04:35 +0000 (17:04 -0700)]
mesh: Move SEQ_MASK define in mesh-defs.h
Change-Id: I1ec86a2033ab3e864ac5c4132afa4f0802305579
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
Deokhyun Kim [Mon, 18 May 2020 04:29:51 +0000 (13:29 +0900)]
Fix typo of variable in set_le_batching_param_complete
Change-Id: Ia5b041d9d0c00e08d4a3310297205b1a71e5289a
Signed-off-by: Deokhyun Kim <dukan.kim@samsung.com>
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
Deokhyun Kim [Thu, 14 May 2020 05:30:29 +0000 (14:30 +0900)]
Handle not_supported case of BLE batching
Change-Id: I0b08db175fda9a662ee532067ebf5f537cca8aff
Signed-off-by: Deokhyun Kim <dukan.kim@samsung.com>
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
injun.yang [Thu, 14 May 2020 02:28:40 +0000 (11:28 +0900)]
Fix : Handle service changed indication properly
[Model] All
[BinType] AP
[Customer] OPEN
[Issue#] P200504-04947
[Request] Internal
[Occurrence Version] N/A
[Problem] GATT service browsing failed.
[Cause & Measure] Ignore service indication during browsing.
Some characteristics what is not included form the primary service is found.
So unable to insert characteristic to GATT DB.
Handle the indication before starting svc browsing.
[Checking Method] n/a
[Team] Convergence BT
[Developer] Injun Yang
[Solution company] Samsung
[Change Type] Specification change
Change-Id: I809beeb51a7d88dfc0cc15b062ab8f7e372b7ccc
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
Szymon Janc [Tue, 7 Apr 2020 01:29:06 +0000 (03:29 +0200)]
gatt: Fix AcquireWrite and AcquireNotify server support
Register read handler only for notify IO and handle socket
disconnection in sock_io_read.
Change-Id: I69349f7570aea4370bfb85809a3078886b7560e3
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
injun.yang [Mon, 13 Apr 2020 03:07:23 +0000 (12:07 +0900)]
Set the permission of CCC descriptior properly
[Model] All
[BinType] AP
[Customer] OPEN
[Issue#] N/A
[Request] Internal
[Occurrence Version] N/A
[Problem] Non bonded device can access to CCCD which have
encrypted_authenticated permission
[Cause & Measure] Even though application set encrypted_authenticated
permission to CCCD, bluez set it as read & write permission
[Checking Method] Register gatt server app which have
encrypted_authenticated permiion on descriptor
[Team] Convergence BT
[Developer] Injun Yang
[Solution company] Samsung
[Change Type] Specification change
Change-Id: If6e718946a1e14297f6bd8c7af232d7425947746
Anupam Roy [Thu, 2 Apr 2020 14:36:29 +0000 (14:36 +0000)]
Merge "tools/mesh-cfgclient: Add commands for Key Refresh Phase" into tizen
Anupam Roy [Thu, 2 Apr 2020 14:36:24 +0000 (14:36 +0000)]
Merge "tools/mesh-cfgclient: Save subnet key refresh phase" into tizen
Anupam Roy [Thu, 2 Apr 2020 14:35:10 +0000 (14:35 +0000)]
Merge "mesh: Clear prov capabilities structure before reading" into tizen
Anupam Roy [Thu, 2 Apr 2020 14:35:02 +0000 (14:35 +0000)]
Merge "doc/mesh-api: OOB Information field is 16 bit, not 32" into tizen
Anupam Roy [Thu, 2 Apr 2020 14:34:47 +0000 (14:34 +0000)]
Merge "mesh: Honor provisioner's capabilities" into tizen
Anupam Roy [Thu, 2 Apr 2020 14:34:38 +0000 (14:34 +0000)]
Merge "mesh: Refresh provisioner's capabilities" into tizen
Anupam Roy [Thu, 2 Apr 2020 14:34:29 +0000 (14:34 +0000)]
Merge "mesh: Clean up naming of provisioning callbacks" into tizen
Anupam Roy [Thu, 2 Apr 2020 14:34:20 +0000 (14:34 +0000)]
Merge "mesh: Remove unused 'server' argument" into tizen
Anupam Roy [Thu, 2 Apr 2020 14:33:43 +0000 (14:33 +0000)]
Merge "tools/mesh-cfgclient: Display unprovisioned OOB data" into tizen
Anupam Roy [Thu, 2 Apr 2020 14:33:34 +0000 (14:33 +0000)]
Merge "tools/mesh-cfgclient: Fix SIGSEGV" into tizen
Anupam Roy [Thu, 2 Apr 2020 14:33:05 +0000 (14:33 +0000)]
Merge "mesh: Add net key index to sar structure" into tizen