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 2/6] mesh: Centralize definition of PRIMARY_NET_IDX
Date: Thu, 23 May 2019 09:13:25 -0700 [thread overview]
Message-ID: <20190523161329.13017-3-brian.gix@intel.com> (raw)
In-Reply-To: <20190523161329.13017-1-brian.gix@intel.com>
---
mesh/mesh-defs.h | 1 +
mesh/node.c | 12 +++++-------
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/mesh/mesh-defs.h b/mesh/mesh-defs.h
index aba0d318f..1a199f156 100644
--- a/mesh/mesh-defs.h
+++ b/mesh/mesh-defs.h
@@ -74,6 +74,7 @@
#define VENDOR_ID_MASK 0xffff0000
+#define PRIMARY_NET_IDX 0x0000
#define MAX_KEY_IDX 0x0fff
#define MAX_MODEL_COUNT 0xff
#define MAX_ELE_COUNT 0xff
diff --git a/mesh/node.c b/mesh/node.c
index 394f5bfa9..e99858623 100644
--- a/mesh/node.c
+++ b/mesh/node.c
@@ -51,7 +51,6 @@
/* Default values for a new locally created node */
#define DEFAULT_NEW_UNICAST 0x0001
#define DEFAULT_IV_INDEX 0x0000
-#define DEFAULT_PRIMARY_NET_INDEX 0x0000
/* Default element location: unknown */
#define DEFAULT_LOCATION 0x0000
@@ -1564,21 +1563,20 @@ static void get_managed_objects_cb(struct l_dbus_message *msg, void *user_data)
/* Generate device and primary network keys */
l_getrandom(dev_key, sizeof(dev_key));
l_getrandom(net_key.old_key, sizeof(net_key.old_key));
- net_key.net_idx = DEFAULT_PRIMARY_NET_INDEX;
- net_key.phase = 0;
+ net_key.net_idx = PRIMARY_NET_IDX;
+ net_key.phase = KEY_REFRESH_PHASE_NONE;
if (!add_local_node(node, DEFAULT_NEW_UNICAST, false, false,
DEFAULT_IV_INDEX, dev_key,
- DEFAULT_PRIMARY_NET_INDEX,
- net_key.old_key))
+ PRIMARY_NET_IDX,
+ net_key.old_key))
goto fail;
if (!keyring_put_remote_dev_key(node, DEFAULT_NEW_UNICAST,
num_ele, dev_key))
goto fail;
- if (!keyring_put_net_key(node, DEFAULT_PRIMARY_NET_INDEX,
- &net_key))
+ if (!keyring_put_net_key(node, PRIMARY_NET_IDX, &net_key))
goto fail;
cb(req->user_data, MESH_ERROR_NONE, node);
--
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 ` Brian Gix [this message]
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 ` [PATCH BlueZ v3 6/6] mesh: Implement remote dev key methods for keyring Brian Gix
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-3-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.