From patchwork Wed Sep 21 08:39:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isak Westin X-Patchwork-Id: 609221 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CD53ECAAD8 for ; Wed, 21 Sep 2022 08:40:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229966AbiIUIkh (ORCPT ); Wed, 21 Sep 2022 04:40:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230484AbiIUIkg (ORCPT ); Wed, 21 Sep 2022 04:40:36 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05olkn2034.outbound.protection.outlook.com [40.92.89.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBCBF696D5 for ; Wed, 21 Sep 2022 01:40:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ww0NCLrTt0Pxp2v/PrHg7q1jkWVvPsd9d3jBrRbVWhi0hsDVkIuehCopKBqrLPjwDfXIKvtR237q3WbpKtFv86kQTM1bjqyFLbfCHmCFwjM5Mv3JGtgjVoWlpCht0evMpzQwKFvbf1dcXwAvbXfUpefzetrnuuHV7f7DWrOsgskr7ngopKzjF8SBMNVlOMJkdiYXZxytJ7jxtOQS7eCqFCbiUnL8ofA0A+/SMQUMuZbXgPhDA1kreRfimyYHcO9+uqzSGj2uih4xt7Z9frzODQZO6+A7efU6BJWCrMdlOTh18uJD6hkRvdQUq5Q45Sqi/8GZsC2M3gf2nAjpgsHCSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=un/6I1sRvo0IXfChoTh3yl4ieXK02BsG7ppods++toE=; b=YM7IcsJNMYEDb7GLZGp0VobXPzINnntqlgMaC+jwTjy0d3GehDwpL6DNYAAU8oHQ9NtOq4BoKVnVn/Y82koBx038lexj9OTh7IWUODqZVTna/ll6usviTNLcgZR2snSiqcysPGIZbYoBy7NoAkvNS26T7M9e7zPs+1DLELbYpbOnnrwqZVJjpTLxhTGNyoSvL6emSWLDqF4iqksqHSYOEwwtq137CpSOqMq/YDMrnzWYGCJGrfGj4C5mwMTZBsYfuOYmR1uTp7qU1X/i/UxBsoMMd6pNy3eVbDUD+ksNbkkC0veGz106Tms1r14KXYDDi+QUleOrElz7RqT/00WYfg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=un/6I1sRvo0IXfChoTh3yl4ieXK02BsG7ppods++toE=; b=gtzb5TWhRDWjx4gVOFKjUDYOx61E0CmFjp0RYnqHS60O2Afwv6wpGtaUxDUvwm3NN/l2sA5FZ4D/fY0jctRqD+a1XPvByRPiM2Qv0UuO0GpYiI34OGWjVwEv7+S3rcWtLoCfG/EdCJKaT8utu9AgPmFd1Cc97v28unoXEwpfCZNoyD87R/LN0bJqXCR8rMaO2qkXHXCt7asK4tmRn50KbaG37q6x/6vGNw2bAmb4bxWjat7kh0oxaTmT0UGrDnCEgC+71NtnJgYYt+rvqkd7jz/QgCFsWQCuY8+FUYU4h1C52RzC9ao8278LvXOn+hhDwsUuBXVRNUDKjyCVk+l7NA== Received: from VI1PR09MB4239.eurprd09.prod.outlook.com (2603:10a6:800:12f::23) by DU0PR09MB5693.eurprd09.prod.outlook.com (2603:10a6:10:31e::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5632.18; Wed, 21 Sep 2022 08:40:30 +0000 Received: from VI1PR09MB4239.eurprd09.prod.outlook.com ([fe80::adeb:7a9b:9960:27bf]) by VI1PR09MB4239.eurprd09.prod.outlook.com ([fe80::adeb:7a9b:9960:27bf%2]) with mapi id 15.20.5632.021; Wed, 21 Sep 2022 08:40:30 +0000 From: Isak Westin To: linux-bluetooth@vger.kernel.org Cc: Isak Westin Subject: [PATCH BlueZ 1/3] mesh: Add interface output filter Date: Wed, 21 Sep 2022 10:39:39 +0200 Message-ID: X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220921083941.8461-1-isak.westin@hotmail.com> References: <20220921083941.8461-1-isak.westin@hotmail.com> X-TMN: [1ihb61WIv7VrE2i9Sdq7jI91vEfMEoNV] X-ClientProxiedBy: ZRAP278CA0008.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:10::18) To VI1PR09MB4239.eurprd09.prod.outlook.com (2603:10a6:800:12f::23) X-Microsoft-Original-Message-ID: <20220921083941.8461-2-isak.westin@hotmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR09MB4239:EE_|DU0PR09MB5693:EE_ X-MS-Office365-Filtering-Correlation-Id: 61b54d40-629b-4eff-f267-08da9bacf091 X-MS-Exchange-SLBlob-MailProps: ZILSnhm0P3lUkjXuSDdeTQka1McTh6g4vrkncgELSGOl+nsBWSpgF0aUWAm9RHfFnKkBoweprBXRfAR4Sw8neEjjxbQWZ8wq1dv2N28OweOpxqncPBkibsXhSGbO34O4C+P/GhK6UJQiQBgVsn3Gaq+BWCZhOn9QI5r/LnBXPWUSk7HtNDPJbm6cpWj40D1RRgnXns4c/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c2Lp7/E3QajLLSgrS3yOWy0CZb4TQo07patQto10BlPNH2Hg6xJRD0QEQnU5zUo7c+TmgH8esChlQznf+aQA8wU8yk6EZGGtaHTF+ugaAUSvFFj0h4pTcmUctpe12GoMXcBZnW268h3+rnPhyF9TnRZzUv6u/hJKX3vUfTkRO68oIyetAo8fnboR8wig5FT2OvfmLo3hXjdbpO08j8uTRzzwNxXfYt9csXLQ2/6PO+2yWtgAfWho3vYDxLbRzIDVhV8+WNN7mg/xoCMO5KxXoxqNuRoJr56CyMJD6DRXAjOIAzaZwKQAXXKMC78USc2xTnm56L0744pyWgzMGqa1eUnvzir1e616KKEqkxepNfeDRs2vZpcqtQ1Ld0x911oNEMdqq6wawaEwOLrPS4HQGnXFrf4H5rFzesjxlXkHyxQ2urjr77iBX1ZtBWYBd5SrwgRGa9IVZ+yxGOCcRQ5GuGu4KhvsBsXcmj868Q1Jm64dDT67YEQ== X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-64da6.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 61b54d40-629b-4eff-f267-08da9bacf091 X-MS-Exchange-CrossTenant-AuthSource: VI1PR09MB4239.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2022 08:40:30.1310 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR09MB5693 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org According to the mesh profile (3.4.5.2), if TTL is set to 1 for an outgoing message, that message shall be dropped. --- mesh/net.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/mesh/net.c b/mesh/net.c index e8e6d3a61..699469284 100644 --- a/mesh/net.c +++ b/mesh/net.c @@ -3067,6 +3067,13 @@ void mesh_net_send_seg(struct mesh_net *net, uint32_t net_key_id, uint8_t segO = (hdr >> SEGO_HDR_SHIFT) & SEG_MASK; uint8_t segN = (hdr >> SEGN_HDR_SHIFT) & SEG_MASK; + /* + * MshPRFv1.0.1 section 3.4.5.2, Interface output filter: + * If TTL is set to 1, message shall be dropped. + */ + if (ttl == 1) + return; + /* TODO: Only used for current POLLed segments to LPNs */ l_debug("SEQ: %6.6x", seq + segO); @@ -3135,6 +3142,13 @@ bool mesh_net_app_send(struct mesh_net *net, bool frnd_cred, uint16_t src, (dst >= net->src_addr && dst <= net->last_addr)) return true; + /* + * MshPRFv1.0.1 section 3.4.5.2, Interface output filter: + * If TTL is set to 1, message shall be dropped. + */ + if (ttl == 1) + return true; + /* Setup OTA Network send */ payload = mesh_sar_new(msg_len); memcpy(payload->buf, msg, msg_len); @@ -3206,6 +3220,13 @@ void mesh_net_ack_send(struct mesh_net *net, uint32_t net_key_id, uint8_t pkt_len; uint8_t pkt[30]; + /* + * MshPRFv1.0.1 section 3.4.5.2, Interface output filter: + * If TTL is set to 1, message shall be dropped. + */ + if (ttl == 1) + return; + hdr = NET_OP_SEG_ACKNOWLEDGE << OPCODE_HDR_SHIFT; hdr |= rly << RELAY_HDR_SHIFT; hdr |= (seqZero & SEQ_ZERO_MASK) << SEQ_ZERO_HDR_SHIFT; @@ -3264,6 +3285,13 @@ void mesh_net_transport_send(struct mesh_net *net, uint32_t net_key_id, if (*msg & 0xc0 || (9 + msg_len + 8 > 29)) return; + /* + * MshPRFv1.0.1 section 3.4.5.2, Interface output filter: + * If TTL is set to 1, message shall be dropped. + */ + if (ttl == 1) + return; + /* Enqueue for Friend if forwardable and from us */ if (!net_key_id && src >= net->src_addr && src <= net->last_addr) { uint32_t hdr = msg[0] << OPCODE_HDR_SHIFT; From patchwork Wed Sep 21 08:39:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isak Westin X-Patchwork-Id: 608023 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1943FECAAD8 for ; Wed, 21 Sep 2022 08:40:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230484AbiIUIkk (ORCPT ); Wed, 21 Sep 2022 04:40:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230389AbiIUIki (ORCPT ); Wed, 21 Sep 2022 04:40:38 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05olkn2034.outbound.protection.outlook.com [40.92.89.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 062735C361 for ; Wed, 21 Sep 2022 01:40:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bCk7Nk5cmSvDjYqPm2ctL0Adl+D/tMFJPOrkTIGZkMTPsJ3er29VkYqSER478ANvbzmwvjzVOQEhO7CXJ6JDRJp8DXzUOrmtxpYz0JPh3mnUDLk8uGdq9Q6/u3174NIXwVqcbNqdNp6ZQKOhalhXr7mKtwS02nMIO2+z+r5aJtQNkzdsFoGt35V9y/H0m1/Er0ghz2Lelr2MBcHiwaALWpotv1aQObLGoL0cnkp5C06DNo6m98mM+WSR3ZE+QmUzWGyusU4cMgFvUZ3ru5tFqkFzrRVeBic6nQ96lBMgvmzrb1mKKsjKp5gkJuhroDgLLZpDObie2LU47GP8WU+Guw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=P5uXjaZQyRXarP7Y9PMiCenglPfrhPY5jGIkOCQa1Sw=; b=nSO+djKVtU0D4gSk6Zg1pN95livmz0qX95SBlG1jEydIZW5Lrr3XRSR3dfBeJ9ggOG7d/YQSbmobBDbVYEPneUzH5vRlDEQahn3zNaFYgnzzDp7fhOd5WYy4SZk+F7Z+HXLXlwLtuPGmT8coKFj6zX47ZW6x0nSsfyyQlohsLN73EfrM1Q/5WqDy9Hmm/yU22yHexkokgNtXH8tmbLeY01QlyjlBMs9Stl8dy6AYkhr/MYaOAACpMFMipug5xkxV0DFhS5nWBiQn65vKeKmybhvTeTJOBE3EBGJ+oreXM7Y0loQv8LaHNBTMfGFCy5SjtP0vbIdE0MycWgJad6BueA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=P5uXjaZQyRXarP7Y9PMiCenglPfrhPY5jGIkOCQa1Sw=; b=rr6KhmxWocalCSDd+LEzxiWXs//rdu9VSGJC9Ifv7S3ZgPBo6u8rn4iiwgFk1r6bIqcrs4NQwOMfLsrKsYSRFF33nudaOXqVnk/D4cWIJdIBlSE1XYxoZqr+ewqlteEwYg2zeTK/uEgzf07aGAGQSmSL0sOQWBOqOsN436ZneveuCq+aOJ1kmWRwk/l/WLHqSnBl3IttZfVppPeGXBfISnlNvP7KgRMeHNhrXOn7pkPVVR6+mV+GxxdSGQ5ZWp7WCsCeTOirw75FCDJB7Sel/EQicnjRK6ZusN1W8A0goqek3p1XG5+R3YBdkwmtfY1hRHGwQbuixSE3jv1u1//WFQ== Received: from VI1PR09MB4239.eurprd09.prod.outlook.com (2603:10a6:800:12f::23) by DU0PR09MB5693.eurprd09.prod.outlook.com (2603:10a6:10:31e::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5632.18; Wed, 21 Sep 2022 08:40:33 +0000 Received: from VI1PR09MB4239.eurprd09.prod.outlook.com ([fe80::adeb:7a9b:9960:27bf]) by VI1PR09MB4239.eurprd09.prod.outlook.com ([fe80::adeb:7a9b:9960:27bf%2]) with mapi id 15.20.5632.021; Wed, 21 Sep 2022 08:40:33 +0000 From: Isak Westin To: linux-bluetooth@vger.kernel.org Cc: Isak Westin Subject: [PATCH BlueZ 2/3] mesh: Do not accept publication for unbound appkey Date: Wed, 21 Sep 2022 10:39:40 +0200 Message-ID: X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220921083941.8461-1-isak.westin@hotmail.com> References: <20220921083941.8461-1-isak.westin@hotmail.com> X-TMN: [KaF+parQ2TQjhVyNfNH0rXyHutcJhi+K] X-ClientProxiedBy: ZRAP278CA0008.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:10::18) To VI1PR09MB4239.eurprd09.prod.outlook.com (2603:10a6:800:12f::23) X-Microsoft-Original-Message-ID: <20220921083941.8461-3-isak.westin@hotmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR09MB4239:EE_|DU0PR09MB5693:EE_ X-MS-Office365-Filtering-Correlation-Id: 00cc7ee8-d28b-4714-63d7-08da9bacf27d X-MS-Exchange-SLBlob-MailProps: ZILSnhm0P3lUkjXuSDdeTQka1McTh6g4uhRitKZOWH7RZPMTNYfuYHzfo8yhypC+gnyecp/34vCveu7mx3G/5X43Reui07lZuyTEPtvPjyd52ZDcstIurPvlfvD2GQTXu+tF0aI2rcz9NJVcd0SKyw5OfyMMrstRIaZLThQ1GnBTch/GCc9IIxpPHZTm12yDhegIgTxOUBZZlp7X019G6vc9DzUpkFWvRkrPvN1QXAmMv+cD/t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j0EAUJStPVVmbC9+I5lb1FDEjE7Tp652JE1/wl5OTf/Yu4aps21gaRbV+KJmOHgDJeO7BbVPH9t0n6PVvALb1JHNAGPALJXplkKR9t4nMf6oSjfVEdgzK4B+xeA0JIV7h2i6gfXgSoZJa2MHm8JI+uXXwXLpagaZ1NWWNBc7BcIDfVwbBEPuECbcEPhHvi2Xz4XcRIa6F7nfAkkcienWROKbKWiT1bfuyHgknW/GwfibafAzxs4hgrXmZtyg1+6q63L0VTekh65oRMB7K0LAkXBqM7gSGn9Qld4VgoR7TYGUGonNgGq/oQxwkHpD0D8uoCK9e8DYC9jHTc/ipsBOWhrhoj5M/KXViPfwXIIFoWABrTbeeqrYUEntu3EGPfH1MSwa5ekxOAZEUivHCwCFJuqWSgKE3yvAIfXxwZnZGzwAKj7kTBe45p4UoUOrePpZoX6d1/+GSQ2uheucxg== X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-64da6.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 00cc7ee8-d28b-4714-63d7-08da9bacf27d X-MS-Exchange-CrossTenant-AuthSource: VI1PR09MB4239.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2022 08:40:33.3673 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR09MB5693 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org If a user tries to configure publication of a model with an appkey that is not bound to that model, an error should be returned. --- mesh/model.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mesh/model.c b/mesh/model.c index 82078ed85..46ead30ac 100644 --- a/mesh/model.c +++ b/mesh/model.c @@ -1063,7 +1063,8 @@ int mesh_model_pub_set(struct mesh_node *node, uint16_t addr, uint32_t id, if (!mod->pub_enabled || (mod->cbs && !(mod->cbs->pub))) return MESH_STATUS_INVALID_PUB_PARAM; - if (!appkey_have_key(node_get_net(node), idx)) + if (!appkey_have_key(node_get_net(node), idx) || + !has_binding(mod->bindings, idx)) return MESH_STATUS_INVALID_APPKEY; /* From patchwork Wed Sep 21 08:39:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isak Westin X-Patchwork-Id: 609220 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D998C6FA8E for ; Wed, 21 Sep 2022 08:40:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231250AbiIUIkm (ORCPT ); Wed, 21 Sep 2022 04:40:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230420AbiIUIkj (ORCPT ); Wed, 21 Sep 2022 04:40:39 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-oln040092075044.outbound.protection.outlook.com [40.92.75.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3FCE67465 for ; Wed, 21 Sep 2022 01:40:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gK5zdVYvQBjpsrfMFPMKsCPKfIShYA4i8WrvksoFcbA9OJmk+oU6xXAEYegKo5rqv1GYf3uuSjpXLnQ1vsthUf4ZQepX9MaMHzdH8KiMQ9isffPfnzNFw3pIkbHveBf5Df+uHIY+C44ndZblN5tpmLTbX22KJ6FxiqPqmVz/oNho2aa692gEYAtKDVueQuQDXf0O8cpiY0qv8uEjH0XXJHgCob9ff0I7k30A6+rkdgt/o+qiRIX5T5Y0Fpm03Mc7wcGSk/yHpRPvo3aFs28iIcNmNECZHrL5fel8O3wvNxy1QL4EXp1mh97ourQyhAkAvP929z0B2x45oLoJJQtPJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9VIr6BOpjtw6XqA5OXgagef97VCTzltc8YjKGmXE9do=; b=Z09Ra79k/VrZDxxEy2aiVQTY4DDSfiqBtOS6iaiVWiVms+OKJKMcMV1iaEGoL6powWg8hZMfI/OAslSZ85dPughpYYHcO0ipwVKmBXr3SOgi7UFVYTuq406y+ykIJaaGI9TA1eLd4DZEie8vLsypSVwIz2iHlzw8ZhlwbVaRoq/uGL5dENL3yg2posS+7TVaGcBXe5DsUFS8nV6TEQYGc7VZmHRmPH8y1xcjd5S6F+kJBmnclxrFkxXFcU3bNnH6UHYNfGSqUu9Li9M4j0OAHwKpRb1q0Vh1COJEUG/GyaLIWc5DC4RmzsPe7JF2XjzSlwCPLcp4mX06I7sYDcHayA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9VIr6BOpjtw6XqA5OXgagef97VCTzltc8YjKGmXE9do=; b=aUoK9SCkwa/s5v9iSSi7GdyKXXaodr3SuM2iilI+i/qvDa6CQd0AcxvpG8fO/4YYY2KXJBfggh9OS2DjAbJKeZmoXYAxyeoMMoTDJzwTrvqWBaA3KfLkHoxq41hyB38ydv5wrDEfsCtrRDl6ThhS6CasTrYssIqvLOStZfipHRiS80P/AceTJndk17qAvYjUaUfXN0O0vkooP4TxI/AWGz+W2BFfJMieUwQMMxNR85KSXxgBWbWNrNqoZjv3RGKavAnJHyg//gIHdxkKtc6yDGcsv8M0+/NbQIc09esuDb5YOWmdPDkgQ1wM6ZBYhMQ0Sj2zpj2ACyYSNpy2zNFCvw== Received: from VI1PR09MB4239.eurprd09.prod.outlook.com (2603:10a6:800:12f::23) by GV1PR09MB5852.eurprd09.prod.outlook.com (2603:10a6:150:98::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.15; Wed, 21 Sep 2022 08:40:35 +0000 Received: from VI1PR09MB4239.eurprd09.prod.outlook.com ([fe80::adeb:7a9b:9960:27bf]) by VI1PR09MB4239.eurprd09.prod.outlook.com ([fe80::adeb:7a9b:9960:27bf%2]) with mapi id 15.20.5632.021; Wed, 21 Sep 2022 08:40:35 +0000 From: Isak Westin To: linux-bluetooth@vger.kernel.org Cc: Isak Westin Subject: [PATCH BlueZ 3/3] mesh: Remove RFU check for publication set Date: Wed, 21 Sep 2022 10:39:41 +0200 Message-ID: X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220921083941.8461-1-isak.westin@hotmail.com> References: <20220921083941.8461-1-isak.westin@hotmail.com> X-TMN: [hn5stooQwgq9HoNADnQE42YsH1g2lRVa] X-ClientProxiedBy: ZRAP278CA0008.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:10::18) To VI1PR09MB4239.eurprd09.prod.outlook.com (2603:10a6:800:12f::23) X-Microsoft-Original-Message-ID: <20220921083941.8461-4-isak.westin@hotmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR09MB4239:EE_|GV1PR09MB5852:EE_ X-MS-Office365-Filtering-Correlation-Id: dd20e6b1-bbc0-4f61-7e68-08da9bacf3a2 X-MS-Exchange-SLB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VqExUzj+5oD6w8lcjjyTkq6255GW5Jq1GOLcODkL8YfTybQc2vgoBhhmF7iMtlHnzIymJRiQJlmvvlNP6fQhS4ZNQUqpI091zcae6ynmG1o8wprxA07xALrLcCmgrDcMROIrwBrO9Kj4BD8F4pD8wI79cbkO35vxaf95JttbSokKQj6vhHEbF4TJlnazu5hkANZGX9eabH9E9kfm4oGljxXJzfNLoCKbuYuFV21/Dn6TBZZSQe3c/XY3vs4s7vcTsRppwEI8moQKH2JU37qDud94VyRdC1zgc5v4Nidb+kPdom5ZuUv9FT0XcfotI/kV7YTHtiD8yPLzvRV92vpUCxjLUArIYZq2n6zxXTtatKVCR5YkgfB/keTEJux8JguuAF+zxV0g2XdsKN82sHn4GK48dctmtyQKAvyQ== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: XuxbqUnwX5hGOWOx0n82Zhf8G+NFiyDKVLILYaDzxlDE/HXNex7hoVcxZBN9Kb/JIYgUzV/HVvIrwP3zBF+SOythbNyrHsD16EHWLqtcATAhIZgfrbbat7JQAHh5scYgnRnsExnsjtCIYfu8zaams9qyVWpFh5LrTi4YgTohxaQO0TazRm4aAvHig7eSneONQlbmXhOPIy6yiDzTTNvj/W6VDMStGNtrBqrcWV0c4DgY5ls3SIXsD8BHQGIZuuFRFEwkkrBkgMTVvmYikw0BsrEqRucOGzXJyXrS4n+mpIPEiMMCVEMqhKudMSBibIDn5D3rXkf5g7qAtzFfvr4goy9dlTq1ShttMhTIyjJHmmiPdmk56XZIwjGmS66rGQy25ECn8pFi050tirLJVbUCGZiSyMM3Qz7LMiqeDStfrf2phEIK/VpodL4H1RS2TiU4DL7hWXsZcxk4dbTL9LqM9Zr31C+Bt2Gsw3KbWtMW5JDyvyA1JvBiKX0hqK7Leadz+5Da1kiI8UJSheTHvUcCg/kA2VH+TvzIHi48ePsbuad4+8DcRWapqNSU2zf/3kjfc05VjuK6AcBy42seJCOguVIFWFMElRB/YXhDQCSxQjVCGxPlM3lUlx/1X0m7joHMWwgRO4oo2flKOuElmye3RBGxo3ygmJwX2dxwM0gqMMB68xK1U2x8V0mPzwdItJMJw/8M3l8M/ZxP3KN2hc9cnSoom8qNL0DsiZQgVLdh9MdmrRs9c2a+ijI84mTzh6pM4WtlRqn5N2NZBY1/yE/B8m8viTDgZeJhOkrmj3opndGTNHL+qYBxqkjbTCoehPNVRvNqfeKHZX6BHGa/d7fLY4nJlNw+Sz9/ACRu4D5ZHaDGHzJZ8L473WI2tO9aMXXfzT3yOIhFKL0lO6CEP5Ly1IHiSt0Opvrr9vYMLtFiIg7ynmabXLvOwudNFRF1/Pc0vfH562wfnKF2kss6Pom+9Sa5kG5G+uav0khHFWPfXE5Hn+29HC9bEFDl/U8gt3q5rnt3VboR0PQv4HCoS8N7pqoio+gYhyCyYAfIiSgC8e/YMX9I+ppu3j+dHMi0fKh7MpUbyLijDkELXddL64OzLT3d9FatQVRLStd89FwPRATyGf8fJZIQ6t6fNs+M7PLDvQiHzWgkVrrZ6bpj1Xy8hIJQtqmazf9QL80Ncd2jZAFj4wEkFPVYfmkyh5OjH3Wrr7pK2K5wcMfV7XURPaSWM2UngTQjnzExyMagqOmPGgDe+vnx5brjM0UbB/l274YhLZ0QqKXkkwyaLrjuwlrdBg== X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-64da6.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: dd20e6b1-bbc0-4f61-7e68-08da9bacf3a2 X-MS-Exchange-CrossTenant-AuthSource: VI1PR09MB4239.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2022 08:40:35.2726 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR09MB5852 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org It is not stated in the mesh profile that the RFU bits in a Model Publication Set message have to be zero. In fact, PTS test MESH/NODE/CFG/MP/BV-01-C is sending that command with non-zero RFU and expects a reply. --- mesh/cfgmod-server.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/mesh/cfgmod-server.c b/mesh/cfgmod-server.c index 5eefedc4d..c1e1faa6a 100644 --- a/mesh/cfgmod-server.c +++ b/mesh/cfgmod-server.c @@ -110,8 +110,6 @@ static uint16_t config_pub_set(struct mesh_node *node, const uint8_t *pkt, pkt += (virt ? 14 : 0); idx = l_get_le16(pkt + 4); - if (idx > CREDFLAG_MASK) - return 0; cred_flag = !!(CREDFLAG_MASK & idx); idx &= APP_IDX_MASK;