Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1861102pxa; Thu, 6 Aug 2020 18:39:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrpBaYU9SUMjjCjoHVeg0QLSAdVWnxxtArSuyGP/O6PIoxDh0CNEGuJFfqNuZ7inSuAZm6 X-Received: by 2002:a17:907:20e6:: with SMTP id rh6mr6997392ejb.301.1596764363380; Thu, 06 Aug 2020 18:39:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596764363; cv=none; d=google.com; s=arc-20160816; b=JamUduzHOiEle+KeKyIfD/AuExM6vejDLUbJ3x4/zm9u9QADK2xNFqQhA+axwIBZu9 41pUFXf30P/yJRGBh4N+COj5L/9wM3ZUJ9xLVKe+Dx8t60bhohvD0cvphcCp2hofMjwG QOp+iu5dPiL6ZZI6QowNT1JgHQOtYVkMd0ZVOWF2v4Q0QjIknML32k8lZH//wM936inL JX4SOphH9AEzqEDqRwFoWPY6ROzhJJqpEhBZD+X7PjIrTAi88+F7Jq8gGoBnw5pmuQRI nH0JZgKkBKUcF58r2QRQuap1f4Kpg1FficmOBAV9EJw59m1EU9sfPUSxJHdgbxaGDyyp 9tFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=YKLh63uX3aB0JYU2aJ/g894AlPUP1xE7xGdjGkvtGiQ=; b=DZkdUpeiZS9yTQ53OurBKYi+7AR+r1YCYORz5YbUH8BX8p6xzt9uiAOxfFzI+6kMJM fhg1JSn52YZw1wKzJzYRs5CD3YEErU/7kUAvtGKvsOOfssvuedt/mSsN0OjN2mIO5tOB ugGPT+AUDKZRiIQmJKCZEnjELN/JWZ5SNnvyeg8+IQN5uIKDwpuHKArZvghKJAqdq6wH Jws3bi9Z3zIgcy27M5iA+7ydrM7UW6dv3UDZd/Szd+lrEeTJTvYsqBqXSU8uZ5HgHRUQ nYUQ28Zete7YSBRBQQF/u87K5Xopf0PsUwBvLrGnZbCPCVfCPJzg+rVARq3rQyjDn/gW fa/w== 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 ch15si2826428ejb.539.2020.08.06.18.38.43; Thu, 06 Aug 2020 18:39:23 -0700 (PDT) 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 S1725947AbgHGBik (ORCPT + 99 others); Thu, 6 Aug 2020 21:38:40 -0400 Received: from mga18.intel.com ([134.134.136.126]:43991 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726055AbgHGBik (ORCPT ); Thu, 6 Aug 2020 21:38:40 -0400 IronPort-SDR: ZhO1qK3v0M8UvGVylBiQeE+p+s/1AXu4WvB2oxZPsKKw80M8NFCb8tF5QOtJ5MBZ4Q3mgVHe1a OI+YHt6N1+gw== X-IronPort-AV: E=McAfee;i="6000,8403,9705"; a="140558039" X-IronPort-AV: E=Sophos;i="5.75,443,1589266800"; d="scan'208";a="140558039" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Aug 2020 18:38:39 -0700 IronPort-SDR: qyNlTQOi2tGnFqTthXPQL+HdbKtTsaFNNi0lL0lUCAFWhz4jYO7hyJ9AzoZ7ko/fZshmhiBRDo 8eBfFb98kMlA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,443,1589266800"; d="scan'208";a="397442075" Received: from unknown (HELO ingas-nuc1.intel.com) ([10.254.119.50]) by fmsmga001.fm.intel.com with ESMTP; 06 Aug 2020 18:38:39 -0700 From: Inga Stotland To: linux-bluetooth@vger.kernel.org Cc: brian.gix@intel.com, Inga Stotland Subject: [PATCH BlueZ v5 03/10] mesh: Clean up handling of config node identity message Date: Thu, 6 Aug 2020 18:38:27 -0700 Message-Id: <20200807013834.123263-4-inga.stotland@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200807013834.123263-1-inga.stotland@intel.com> References: <20200807013834.123263-1-inga.stotland@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This modification allows using a single point for sending out the composed status messages by the Config Server. --- mesh/cfgmod-server.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/mesh/cfgmod-server.c b/mesh/cfgmod-server.c index 992279165..82938dc83 100644 --- a/mesh/cfgmod-server.c +++ b/mesh/cfgmod-server.c @@ -777,11 +777,7 @@ static bool cfg_srv_pkt(uint16_t src, uint16_t dst, uint16_t app_idx, break; case OP_NODE_IDENTITY_SET: - if (size != 3 || pkt[2] > 0x01) - return true; - - n_idx = l_get_le16(pkt); - if (n_idx > 0xfff) + if (size != 3) return true; /* Currently setting node identity not supported */ @@ -789,18 +785,15 @@ static bool cfg_srv_pkt(uint16_t src, uint16_t dst, uint16_t app_idx, /* Fall Through */ case OP_NODE_IDENTITY_GET: - if (size < 2) + if (opcode == OP_NODE_IDENTITY_GET && size != 2) return true; n_idx = l_get_le16(pkt); - if (n_idx > 0xfff) + if (n_idx > NET_IDX_MAX) return true; n = mesh_model_opcode_set(OP_NODE_IDENTITY_STATUS, msg); - - status = mesh_net_get_identity_mode(net, n_idx, &state); - - msg[n++] = status; + msg[n++] = mesh_net_get_identity_mode(net, n_idx, &state); l_put_le16(n_idx, msg + n); n += 2; -- 2.26.2