diff mbox series

[BlueZ,3/4] test/test-mesh: Generate correct value for Device UUID

Message ID 20210211222143.39986-4-inga.stotland@intel.com (mailing list archive)
State New, archived
Headers show
Series Use compliant UUID for mesh | expand

Commit Message

Stotland, Inga Feb. 11, 2021, 10:21 p.m. UTC
This ensures that the value of Device UUID when invoking
Join method is compliant with RFC 4122.
---
 test/test-mesh | 5 +++++
 1 file changed, 5 insertions(+)

Comments

MichaƂ Lowas-Rzechonek Feb. 12, 2021, 10:54 a.m. UTC | #1
On 02/11, Inga Stotland wrote:
> This ensures that the value of Device UUID when invoking
> Join method is compliant with RFC 4122.
> ---
>  test/test-mesh | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/test/test-mesh b/test/test-mesh
> index 9e4783734..a478843a3 100755
> --- a/test/test-mesh
> +++ b/test/test-mesh
> @@ -889,6 +889,11 @@ class MainMenu(Menu):
>  
>  		uuid = bytearray.fromhex("0a0102030405060708090A0B0C0D0E0F")
>  		random.shuffle(uuid)
> +		uuid[6] &= 0x0f;
> +		uuid[6] |= 4 << 4;
> +		uuid[8] &= 0x3f;
> +		uuid[8] |= 0x80;
> +

https://docs.python.org/3/library/uuid.html


>  		uuid_str = array_to_string(uuid)
>  
>  		print(set_yellow('Joining with UUID ') + set_green(uuid_str))
> -- 
> 2.26.2
>
diff mbox series

Patch

diff --git a/test/test-mesh b/test/test-mesh
index 9e4783734..a478843a3 100755
--- a/test/test-mesh
+++ b/test/test-mesh
@@ -889,6 +889,11 @@  class MainMenu(Menu):
 
 		uuid = bytearray.fromhex("0a0102030405060708090A0B0C0D0E0F")
 		random.shuffle(uuid)
+		uuid[6] &= 0x0f;
+		uuid[6] |= 4 << 4;
+		uuid[8] &= 0x3f;
+		uuid[8] |= 0x80;
+
 		uuid_str = array_to_string(uuid)
 
 		print(set_yellow('Joining with UUID ') + set_green(uuid_str))