From: Brian Gix <brian.gix@intel.com>
To: linux-bluetooth@vger.kernel.org
Cc: inga.stotland@intel.com, brian.gix@intel.com
Subject: [PATCH BlueZ v3 6/6] mesh: Implement remote dev key methods for keyring
Date: Thu, 23 May 2019 09:13:29 -0700 [thread overview]
Message-ID: <20190523161329.13017-7-brian.gix@intel.com> (raw)
In-Reply-To: <20190523161329.13017-1-brian.gix@intel.com>
Implements following org.bluez.mesh.Management1 methods:
ImportRemoteNode()
DeleteRemoteNode()
These methods are used to maintain Device Key keyring storage.
---
mesh/manager.c | 38 +++++++++++++++++++++++++++++++++++---
1 file changed, 35 insertions(+), 3 deletions(-)
diff --git a/mesh/manager.c b/mesh/manager.c
index 234ab5e2f..a79189934 100644
--- a/mesh/manager.c
+++ b/mesh/manager.c
@@ -54,18 +54,47 @@ static struct l_dbus_message *add_node_call(struct l_dbus *dbus,
return dbus_error(msg, MESH_ERROR_NOT_IMPLEMENTED, NULL);
}
+
+static struct l_dbus_message *import_node_call(struct l_dbus *dbus,
+ struct l_dbus_message *msg,
+ void *user_data)
+{
+ struct mesh_node *node = user_data;
+ struct l_dbus_message_iter iter_key;
+ uint16_t primary;
+ uint8_t num_ele;
+ uint8_t *key;
+ uint32_t n;
+
+ if (!l_dbus_message_get_arguments(msg, "qyay", &primary, &num_ele,
+ &iter_key))
+ return dbus_error(msg, MESH_ERROR_INVALID_ARGS, NULL);
+
+ if (!l_dbus_message_iter_get_fixed_array(&iter_key, &key, &n)
+ || n != 16)
+ return dbus_error(msg, MESH_ERROR_INVALID_ARGS,
+ "Bad device key");
+
+ if (!keyring_put_remote_dev_key(node, primary, num_ele, key))
+ return dbus_error(msg, MESH_ERROR_FAILED, NULL);
+
+ return l_dbus_message_new_method_return(msg);
+}
+
static struct l_dbus_message *delete_node_call(struct l_dbus *dbus,
struct l_dbus_message *msg,
void *user_data)
{
+ struct mesh_node *node = user_data;
uint16_t primary;
uint8_t num_ele;
if (!l_dbus_message_get_arguments(msg, "qy", &primary, &num_ele))
return dbus_error(msg, MESH_ERROR_INVALID_ARGS, NULL);
- /* TODO */
- return dbus_error(msg, MESH_ERROR_NOT_IMPLEMENTED, NULL);
+ keyring_del_remote_dev_key(node, primary, num_ele);
+
+ return l_dbus_message_new_method_return(msg);
}
static struct l_dbus_message *start_scan_call(struct l_dbus *dbus,
@@ -388,7 +417,10 @@ static void setup_management_interface(struct l_dbus_interface *iface)
{
l_dbus_interface_method(iface, "AddNode", 0, add_node_call, "", "ay",
"", "uuid");
- l_dbus_interface_method(iface, "DeleteRemodeNode", 0, delete_node_call,
+ l_dbus_interface_method(iface, "ImportRemoteNode", 0, import_node_call,
+ "", "qyay", "", "primary",
+ "count", "dev_key");
+ l_dbus_interface_method(iface, "DeleteRemoteNode", 0, delete_node_call,
"", "qy", "", "primary", "count");
l_dbus_interface_method(iface, "UnprovisionedScan", 0, start_scan_call,
"", "q", "", "seconds");
--
2.14.5
next prev parent reply other threads:[~2019-05-23 16:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-23 16:13 [PATCH BlueZ v3 0/6] mesh: Add App and Net Key Refresh keyring back-end Brian Gix
2019-05-23 16:13 ` [PATCH BlueZ v3 1/6] mesh: Add new method for Key Refresh procedure Brian Gix
2019-05-23 16:13 ` [PATCH BlueZ v3 2/6] mesh: Centralize definition of PRIMARY_NET_IDX Brian Gix
2019-05-23 16:13 ` [PATCH BlueZ v3 3/6] mesh: Implement Net Key keyring storage handling Brian Gix
2019-05-23 16:13 ` [PATCH BlueZ v3 4/6] mesh: Implement App " Brian Gix
2019-05-23 16:13 ` [PATCH BlueZ v3 5/6] mesh: Implement Key Refresh Phasing in keyring Brian Gix
2019-05-23 16:13 ` Brian Gix [this message]
2019-05-24 15:07 ` [PATCH BlueZ v3 0/6] mesh: Add App and Net Key Refresh keyring back-end Gix, Brian
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190523161329.13017-7-brian.gix@intel.com \
--to=brian.gix@intel.com \
--cc=inga.stotland@intel.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).