--- 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