* [PATCH BlueZ v2 0/4] Use compliant UUID for mesh
@ 2021-02-12 21:42 Inga Stotland
2021-02-12 21:42 ` [PATCH BlueZ v2 1/4] doc/mesh-api: Add notion of Device UUID compliance Inga Stotland
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Inga Stotland @ 2021-02-12 21:42 UTC (permalink / raw)
To: linux-bluetooth; +Cc: brian.gix, michal.lowas-rzechonek, Inga Stotland
v2: Incorporate Michał's suggestion to use Python's uuid module
functions.
************
Mesh profile spec states that the values use for Device UUIDs
folow format and generation procedures outlined in RFC 4122.
This patch set addresses this requirement.
Inga Stotland (4):
doc/mesh-api: Add notion of Device UUID compliance
mesh: Add validation of Device UUID value
test/test-mesh: Generate correct value for Device UUID
tools/mesh-cfg-client:
Makefile.am | 6 ++++--
doc/mesh-api.txt | 9 ++++++---
mesh/mesh.c | 18 +++++++++---------
test/test-mesh | 7 +++----
tools/mesh-cfgclient.c | 6 +++---
tools/mesh/mesh-db.c | 2 +-
6 files changed, 26 insertions(+), 22 deletions(-)
--
2.26.2
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH BlueZ v2 1/4] doc/mesh-api: Add notion of Device UUID compliance
2021-02-12 21:42 [PATCH BlueZ v2 0/4] Use compliant UUID for mesh Inga Stotland
@ 2021-02-12 21:42 ` Inga Stotland
2021-02-12 21:55 ` Use compliant UUID for mesh bluez.test.bot
2021-02-12 21:42 ` [PATCH BlueZ v2 2/4] mesh: Add validation of Device UUID value Inga Stotland
` (3 subsequent siblings)
4 siblings, 1 reply; 7+ messages in thread
From: Inga Stotland @ 2021-02-12 21:42 UTC (permalink / raw)
To: linux-bluetooth; +Cc: brian.gix, michal.lowas-rzechonek, Inga Stotland
Add requirement that the value of Device UUID supplied in
CreateNetwork/Join/Import methods should be compliant with
RFC 4122.
---
doc/mesh-api.txt | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/doc/mesh-api.txt b/doc/mesh-api.txt
index 254ccbd7f..f2c6b9e5c 100644
--- a/doc/mesh-api.txt
+++ b/doc/mesh-api.txt
@@ -27,7 +27,8 @@ Methods:
The uuid parameter is a 16-byte array that contains Device UUID.
This UUID must be unique (at least from the daemon perspective),
therefore attempting to call this function using already
- registered UUID results in an error.
+ registered UUID results in an error. The composition of the UUID
+ octets must be in compliance with RFC 4122.
When provisioning finishes, the daemon will call either
JoinComplete or JoinFailed method on object implementing
@@ -149,7 +150,8 @@ Methods:
The uuid parameter is a 16-byte array that contains Device UUID.
This UUID must be unique (at least from the daemon perspective),
therefore attempting to call this function using already
- registered UUID results in an error.
+ registered UUID results in an error. The composition of the UUID
+ octets must be in compliance with RFC 4122.
The other information the bluetooth-meshd daemon will preserve
about the initial node, is to give it the initial primary
@@ -179,7 +181,8 @@ Methods:
The uuid parameter is a 16-byte array that contains Device UUID.
This UUID must be unique (at least from the daemon perspective),
therefore attempting to call this function using already
- registered UUID results in an error.
+ registered UUID results in an error. The composition of the UUID
+ octets must be in compliance with RFC 4122.
The dev_key parameter is the 16-byte value of the dev key of
the imported mesh node.
--
2.26.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH BlueZ v2 2/4] mesh: Add validation of Device UUID value
2021-02-12 21:42 [PATCH BlueZ v2 0/4] Use compliant UUID for mesh Inga Stotland
2021-02-12 21:42 ` [PATCH BlueZ v2 1/4] doc/mesh-api: Add notion of Device UUID compliance Inga Stotland
@ 2021-02-12 21:42 ` Inga Stotland
2021-02-12 21:42 ` [PATCH BlueZ v2 3/4] test/test-mesh: Generate correct value for Device UUID Inga Stotland
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Inga Stotland @ 2021-02-12 21:42 UTC (permalink / raw)
To: linux-bluetooth; +Cc: brian.gix, michal.lowas-rzechonek, Inga Stotland
Validate that the value of Device UUID supplied in
CreateNetwork/Join/Import methods is compliant with RFC 4122.
---
Makefile.am | 6 ++++--
mesh/mesh.c | 18 +++++++++---------
2 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index d0f979586..86f3409c3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -134,7 +134,8 @@ ell_headers = ell/util.h \
ell/base64.h \
ell/asn1-private.h \
ell/cert-private.h \
- ell/pem-private.h
+ ell/pem-private.h \
+ ell/uuid.h
ell_sources = ell/private.h ell/missing.h \
ell/util.c \
@@ -169,7 +170,8 @@ ell_sources = ell/private.h ell/missing.h \
ell/gvariant-private.h \
ell/gvariant-util.c \
ell/siphash-private.h \
- ell/siphash.c
+ ell/siphash.c \
+ ell/uuid.c
ell_libell_internal_la_SOURCES = $(ell_headers) $(ell_sources)
endif
diff --git a/mesh/mesh.c b/mesh/mesh.c
index f29e8b6be..62d650328 100644
--- a/mesh/mesh.c
+++ b/mesh/mesh.c
@@ -533,7 +533,7 @@ static struct l_dbus_message *join_network_call(struct l_dbus *dbus,
void *user_data)
{
const char *app_path, *sender;
- struct l_dbus_message_iter iter_uuid;
+ struct l_dbus_message_iter iter;
uint32_t n;
l_debug("Join network request");
@@ -543,14 +543,13 @@ static struct l_dbus_message *join_network_call(struct l_dbus *dbus,
"Provisioning in progress");
if (!l_dbus_message_get_arguments(msg, "oay", &app_path,
- &iter_uuid))
+ &iter))
return dbus_error(msg, MESH_ERROR_INVALID_ARGS, NULL);
join_pending = l_new(struct join_data, 1);
- if (!l_dbus_message_iter_get_fixed_array(&iter_uuid,
- &join_pending->uuid, &n)
- || n != 16) {
+ if (!l_dbus_message_iter_get_fixed_array(&iter, &join_pending->uuid, &n)
+ || n != 16 || !l_uuid_is_valid(join_pending->uuid)) {
l_free(join_pending);
join_pending = NULL;
return dbus_error(msg, MESH_ERROR_INVALID_ARGS,
@@ -785,8 +784,8 @@ static struct l_dbus_message *create_network_call(struct l_dbus *dbus,
&iter_uuid))
return dbus_error(msg, MESH_ERROR_INVALID_ARGS, NULL);
- if (!l_dbus_message_iter_get_fixed_array(&iter_uuid, &uuid, &n)
- || n != 16)
+ if (!l_dbus_message_iter_get_fixed_array(&iter_uuid, &uuid, &n) ||
+ n != 16 || !l_uuid_is_valid(uuid))
return dbus_error(msg, MESH_ERROR_INVALID_ARGS,
"Bad device UUID");
@@ -835,8 +834,9 @@ static struct l_dbus_message *import_call(struct l_dbus *dbus,
return dbus_error(msg, MESH_ERROR_INVALID_ARGS, NULL);
if (!l_dbus_message_iter_get_fixed_array(&iter_uuid, &uuid, &n) ||
- n != 16)
- return dbus_error(msg, MESH_ERROR_INVALID_ARGS, "Bad dev UUID");
+ n != 16 || !l_uuid_is_valid(uuid))
+ return dbus_error(msg, MESH_ERROR_INVALID_ARGS,
+ "Bad device UUID");
if (node_find_by_uuid(uuid))
return dbus_error(msg, MESH_ERROR_ALREADY_EXISTS,
--
2.26.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH BlueZ v2 3/4] test/test-mesh: Generate correct value for Device UUID
2021-02-12 21:42 [PATCH BlueZ v2 0/4] Use compliant UUID for mesh Inga Stotland
2021-02-12 21:42 ` [PATCH BlueZ v2 1/4] doc/mesh-api: Add notion of Device UUID compliance Inga Stotland
2021-02-12 21:42 ` [PATCH BlueZ v2 2/4] mesh: Add validation of Device UUID value Inga Stotland
@ 2021-02-12 21:42 ` Inga Stotland
2021-02-12 21:42 ` [PATCH BlueZ v2 4/4] tools/mesh-cfg-client: Inga Stotland
2021-02-16 19:55 ` [PATCH BlueZ v2 0/4] Use compliant UUID for mesh Gix, Brian
4 siblings, 0 replies; 7+ messages in thread
From: Inga Stotland @ 2021-02-12 21:42 UTC (permalink / raw)
To: linux-bluetooth; +Cc: brian.gix, michal.lowas-rzechonek, Inga Stotland
This ensures that the value of Device UUID when invoking
Join method is compliant with RFC 4122.
---
test/test-mesh | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/test/test-mesh b/test/test-mesh
index 9e4783734..fbf2476bf 100755
--- a/test/test-mesh
+++ b/test/test-mesh
@@ -887,12 +887,11 @@ class MainMenu(Menu):
print(set_error('Provisioning agent not found'))
return
- uuid = bytearray.fromhex("0a0102030405060708090A0B0C0D0E0F")
- random.shuffle(uuid)
- uuid_str = array_to_string(uuid)
+ uuid_bytes = uuid.uuid4().bytes
+ uuid_str = array_to_string(uuid_bytes)
print(set_yellow('Joining with UUID ') + set_green(uuid_str))
- mesh_net.Join(app.get_path(), uuid,
+ mesh_net.Join(app.get_path(), uuid_bytes,
reply_handler=join_cb,
error_handler=join_error_cb)
--
2.26.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH BlueZ v2 4/4] tools/mesh-cfg-client:
2021-02-12 21:42 [PATCH BlueZ v2 0/4] Use compliant UUID for mesh Inga Stotland
` (2 preceding siblings ...)
2021-02-12 21:42 ` [PATCH BlueZ v2 3/4] test/test-mesh: Generate correct value for Device UUID Inga Stotland
@ 2021-02-12 21:42 ` Inga Stotland
2021-02-16 19:55 ` [PATCH BlueZ v2 0/4] Use compliant UUID for mesh Gix, Brian
4 siblings, 0 replies; 7+ messages in thread
From: Inga Stotland @ 2021-02-12 21:42 UTC (permalink / raw)
To: linux-bluetooth; +Cc: brian.gix, michal.lowas-rzechonek, Inga Stotland
Make sure that the values of Device UUID supplied in
CreateNetwork and AddRemoteNode methods are compliant with
RFC 4122.
Also, use a compliant value for Mesh UUID.
---
tools/mesh-cfgclient.c | 6 +++---
tools/mesh/mesh-db.c | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/mesh-cfgclient.c b/tools/mesh-cfgclient.c
index 28465a679..1eeed2a1a 100644
--- a/tools/mesh-cfgclient.c
+++ b/tools/mesh-cfgclient.c
@@ -731,7 +731,7 @@ static void create_net_setup(struct l_dbus_message *msg, void *user_data)
struct l_dbus_message_builder *builder;
/* Generate random UUID */
- l_getrandom(app.uuid, sizeof(app.uuid));
+ l_uuid_v4(app.uuid);
builder = l_dbus_message_builder_new(msg);
@@ -899,7 +899,7 @@ static void cmd_import_node(int argc, char *argv[])
/* Device UUID */
req->data1 = l_util_from_hexstring(argv[1], &sz);
- if (!req->data1 || sz != 16) {
+ if (!req->data1 || sz != 16 || !l_uuid_is_valid(req->data1)) {
l_error("Failed to generate UUID array from %s", argv[1]);
goto fail;
}
@@ -1298,7 +1298,7 @@ static void add_node_setup(struct l_dbus_message *msg, void *user_data)
struct l_dbus_message_builder *builder;
uuid = l_util_from_hexstring(str, &sz);
- if (!uuid || sz != 16) {
+ if (!uuid || sz != 16 || !l_uuid_is_valid(uuid)) {
l_error("Failed to generate UUID array from %s", str);
return;
}
diff --git a/tools/mesh/mesh-db.c b/tools/mesh/mesh-db.c
index d86913006..46f0c6075 100644
--- a/tools/mesh/mesh-db.c
+++ b/tools/mesh/mesh-db.c
@@ -1407,7 +1407,7 @@ bool mesh_db_create(const char *fname, const uint8_t token[8],
if (!add_u8_8(jcfg, "token", token))
goto fail;
- l_getrandom(uuid, 16);
+ l_uuid_v4(uuid);
if (!add_u8_16(jcfg, "uuid", uuid))
goto fail;
--
2.26.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* RE: Use compliant UUID for mesh
2021-02-12 21:42 ` [PATCH BlueZ v2 1/4] doc/mesh-api: Add notion of Device UUID compliance Inga Stotland
@ 2021-02-12 21:55 ` bluez.test.bot
0 siblings, 0 replies; 7+ messages in thread
From: bluez.test.bot @ 2021-02-12 21:55 UTC (permalink / raw)
To: linux-bluetooth, inga.stotland
[-- Attachment #1: Type: text/plain, Size: 656 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=433001
---Test result---
##############################
Test: CheckPatch - PASS
##############################
Test: CheckGitLint - FAIL
Output:
tools/mesh-cfg-client:
1: T3 Title has trailing punctuation (:): "tools/mesh-cfg-client:"
##############################
Test: CheckBuild - PASS
##############################
Test: MakeCheck - PASS
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH BlueZ v2 0/4] Use compliant UUID for mesh
2021-02-12 21:42 [PATCH BlueZ v2 0/4] Use compliant UUID for mesh Inga Stotland
` (3 preceding siblings ...)
2021-02-12 21:42 ` [PATCH BlueZ v2 4/4] tools/mesh-cfg-client: Inga Stotland
@ 2021-02-16 19:55 ` Gix, Brian
4 siblings, 0 replies; 7+ messages in thread
From: Gix, Brian @ 2021-02-16 19:55 UTC (permalink / raw)
To: linux-bluetooth, Stotland, Inga; +Cc: michal.lowas-rzechonek
Patchset Applied
On Fri, 2021-02-12 at 13:42 -0800, Inga Stotland wrote:
> v2: Incorporate Michał's suggestion to use Python's uuid module
> functions.
>
> ************
> Mesh profile spec states that the values use for Device UUIDs
> folow format and generation procedures outlined in RFC 4122.
> This patch set addresses this requirement.
>
>
> Inga Stotland (4):
> doc/mesh-api: Add notion of Device UUID compliance
> mesh: Add validation of Device UUID value
> test/test-mesh: Generate correct value for Device UUID
> tools/mesh-cfg-client:
>
> Makefile.am | 6 ++++--
> doc/mesh-api.txt | 9 ++++++---
> mesh/mesh.c | 18 +++++++++---------
> test/test-mesh | 7 +++----
> tools/mesh-cfgclient.c | 6 +++---
> tools/mesh/mesh-db.c | 2 +-
> 6 files changed, 26 insertions(+), 22 deletions(-)
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-02-16 19:56 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-12 21:42 [PATCH BlueZ v2 0/4] Use compliant UUID for mesh Inga Stotland
2021-02-12 21:42 ` [PATCH BlueZ v2 1/4] doc/mesh-api: Add notion of Device UUID compliance Inga Stotland
2021-02-12 21:55 ` Use compliant UUID for mesh bluez.test.bot
2021-02-12 21:42 ` [PATCH BlueZ v2 2/4] mesh: Add validation of Device UUID value Inga Stotland
2021-02-12 21:42 ` [PATCH BlueZ v2 3/4] test/test-mesh: Generate correct value for Device UUID Inga Stotland
2021-02-12 21:42 ` [PATCH BlueZ v2 4/4] tools/mesh-cfg-client: Inga Stotland
2021-02-16 19:55 ` [PATCH BlueZ v2 0/4] Use compliant UUID for mesh Gix, Brian
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).