Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2510016pxb; Thu, 11 Feb 2021 14:26:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJxatO+TPekaX1hvTwkvpZLA5ya/dd97mHO3W9EYUm6NRBzXH3NGV4RUGH0BWgmbxuiUxr/u X-Received: by 2002:aa7:d58b:: with SMTP id r11mr281551edq.241.1613082391029; Thu, 11 Feb 2021 14:26:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613082391; cv=none; d=google.com; s=arc-20160816; b=OSovFOJdwBwboElzFR0kGoOqAO7pzesSXVhS7N/jY1IZC3GMtL4kfCqN8UU0lSQm5k aqY7/xGZ+lavIRMYB2j5p568wqz6G489lxkue7dAA0nhs/eIa3pTTxMfyDKBsZ+JBgkT g7dNI2zqaoPM0qZ9F+57/RN2+6KYXMr6OXLVmSdROXEKGAi2nKqzBXQbKijVLL7PmX63 qKJPya1no8DONehg70GYKjyj1aGYXAfZX/wdZ8ZePsJLn6aTYPg8aXLmwFapE8dxWyVI NSRSt7Fo7Z/+rRsmlbiUku1D2OHcKvOoVreU/DYngP3id0cHpXbjHVf2z7A7UyluS9LZ pDZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=nzfvuAhwqLuwW+cgGiGO/89FlOQxbs/3qlDQdY4OPR0=; b=tqhg93Z/4elwUX4wBOJZYv/bvMZx6H+sga8njwNelyFVfyIax5Vpt0DmoqatNynXWj 8WXRlMQTgX9GbdCPWbxxC5Ez8JQ6JWabDD0qRY39YpWm90E/v1Twbsiz8VsQmPjOx+IP DkVhHTHCGBCDGzkQoaOVFnBE32U5uAJ8yNpHwWcErhkZr6O9wyXmTko/3ZCOy2dUj2bT Dh0t6cGq8yNXnM3AOoFoLuTzO7xUihh2LEqnyj3fLK76VG2TwAbrdpu+GeYUsNTu1Tno y7l53LpCeSw/YcK9zrloGe/0hIKd79gka3Oe6dqgY+YFkAwf/ZnDWaHbFodvZCLZW3mD vTNA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e22si5336454edu.9.2021.02.11.14.25.48; Thu, 11 Feb 2021 14:26:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230015AbhBKWXv (ORCPT + 99 others); Thu, 11 Feb 2021 17:23:51 -0500 Received: from mga07.intel.com ([134.134.136.100]:1738 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230080AbhBKWXJ (ORCPT ); Thu, 11 Feb 2021 17:23:09 -0500 IronPort-SDR: JfNbUWUJG1nTupVKlG16+5RXPy1zjWYSyYbQh5WxbB/swFJCZsk5OEGsjI7f37lW/VW9MLr6No H0BxqXyIFo9Q== X-IronPort-AV: E=McAfee;i="6000,8403,9892"; a="246392981" X-IronPort-AV: E=Sophos;i="5.81,171,1610438400"; d="scan'208";a="246392981" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Feb 2021 14:22:01 -0800 IronPort-SDR: X8td3B/+fMnHk0RuGkNRaf7cI1lZFLtVxGqekCRucC2Jufh0AWsXO6zrdKR+pv76oS11AZomaH G42o3gEp5h+g== X-IronPort-AV: E=Sophos;i="5.81,171,1610438400"; d="scan'208";a="381070074" Received: from binman-mobl4.amr.corp.intel.com (HELO istotlan-desk.intel.com) ([10.251.152.23]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Feb 2021 14:22:00 -0800 From: Inga Stotland To: linux-bluetooth@vger.kernel.org Cc: brian.gix@intel.com, Inga Stotland Subject: [PATCH BlueZ 4/4] tools/mesh-cfg-client: Date: Thu, 11 Feb 2021 14:21:43 -0800 Message-Id: <20210211222143.39986-5-inga.stotland@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210211222143.39986-1-inga.stotland@intel.com> References: <20210211222143.39986-1-inga.stotland@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org 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