2020-08-06 17:27:56

by Michał Lowas-Rzechonek

[permalink] [raw]
Subject: [PATCH BlueZ] mesh: Allow deleting non-existing app key

Mesh Profile v1.0.1, section 4.3.2.40 Config AppKey Status

(...) The Status Code shall be Success if the received request was
redundant (add of an identical existing key, update of an identical
updated key, or delete of a non-existent key), with no further action
taken.
---
mesh/appkey.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mesh/appkey.c b/mesh/appkey.c
index 45d604007..a4771bd7d 100644
--- a/mesh/appkey.c
+++ b/mesh/appkey.c
@@ -320,7 +320,7 @@ int appkey_key_delete(struct mesh_net *net, uint16_t net_idx,
key = l_queue_find(app_keys, match_key_index, L_UINT_TO_PTR(app_idx));

if (!key)
- return MESH_STATUS_INVALID_APPKEY;
+ return MESH_STATUS_SUCCESS;

if (key->net_idx != net_idx)
return MESH_STATUS_INVALID_NETKEY;
--
2.20.1


2020-08-06 22:48:31

by Gix, Brian

[permalink] [raw]
Subject: Re: [PATCH BlueZ] mesh: Allow deleting non-existing app key

Applied
On Thu, 2020-08-06 at 16:13 +0200, Michał Lowas-Rzechonek wrote:
> Mesh Profile v1.0.1, section 4.3.2.40 Config AppKey Status
>
> (...) The Status Code shall be Success if the received request was
> redundant (add of an identical existing key, update of an identical
> updated key, or delete of a non-existent key), with no further action
> taken.
> ---
> mesh/appkey.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mesh/appkey.c b/mesh/appkey.c
> index 45d604007..a4771bd7d 100644
> --- a/mesh/appkey.c
> +++ b/mesh/appkey.c
> @@ -320,7 +320,7 @@ int appkey_key_delete(struct mesh_net *net, uint16_t net_idx,
> key = l_queue_find(app_keys, match_key_index, L_UINT_TO_PTR(app_idx));
>
> if (!key)
> - return MESH_STATUS_INVALID_APPKEY;
> + return MESH_STATUS_SUCCESS;
>
> if (key->net_idx != net_idx)
> return MESH_STATUS_INVALID_NETKEY;