From patchwork Wed Sep 21 11:16:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isak Westin X-Patchwork-Id: 608021 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 09BF4C32771 for ; Wed, 21 Sep 2022 11:17:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229562AbiIULRi (ORCPT ); Wed, 21 Sep 2022 07:17:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229498AbiIULRh (ORCPT ); Wed, 21 Sep 2022 07:17:37 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05olkn2072.outbound.protection.outlook.com [40.92.89.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E84C474DF for ; Wed, 21 Sep 2022 04:17:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iRrufS0PwTIxbP+Bne5WHr7UbmMRgt+UG17AVYzqwqsTCZxSSw4C3Po0uv35X16spB9hAnn3ZLFIzZ4tsgUbmCsLU1VqcG63HVRJkhQqvZSPjEdOiHwYbPUAsaEfHEqQuct0kFa+pgPD8/ld2DXbW8SxTwtpNxQD1q5iSKnMMVV6tEoDEF5rCUoViE9TCUGSZVL9H/xV0myiA4EsxUTVwXRaf7jhViQLT4yr6JhHu367C7yRGWQAclCMu7q+UeEtIXRVs6qPJ4BhvihmzwTHH9MmmibG/39PEJMxGMHZPQ7XtV5NSQsGrcyBE4fH5Tgj4VeL0A68qARVjWlMoClamA== 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=oAUGaGvj1fNBNw45lWPL119ZdRatFg5f3vjGJ9nXgilqIo/D8ljZUyyvJyfq7mG1hH1kZZBU4E9FxTxJp/QF7ES89lPplIXmgtpzYv6I5hRry3D0hn7t4lcIQ+0gSoNZAx6xBjCNQ5naXX3rtcmRdBMS0Izo69yGHkpTHaBrTNJT3nt9bX+x6vBZ6/RpcfPsr28sMDSPBygQsbhiP4Q2BcI1djqJ3gj64uT5Ic9BvoqKYCj2v3N4ofGttItnCXTw7+1qyEtZTTnFDebXD5gAOKl/IdjcVGqhf0B1b98cNwM0Y6Opg+n9CdgWO9YPgEdAKjnda6+xVkX2IqD7OASqMg== 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=lw0gnn3wmo0BlvYb8gBOkoblDQyTvMNIj9f9uRtCvNt+EdaF4y3FWPWHsvbSt3US2lvYuBEgXIQVrKlTUHZgF+Isc2Vc3fqqwJtbGVVTP0HrhfC0Jcv7wriO+8f5PSGXsb8NiqdQlr/4h87yteM2udSKUfvpyWVaGsXJ7EtdUa8HrkM9fM2X4eBdkWVnFjdJrwmFa0DRUMJTG0kioJWwqLZfKVVe0TYv2Sx3+8K1xzgHGAJ916H+Rk0Td1uh67PTDpIy1xTymhf+dPWzfyg4Yna/5h5vBK/Zhne6u6ZjKqeKviDnSv4p0YvyvNvyvD5BFk6LHWGMo/KAgX5CREcGqw== Received: from VI1PR09MB4239.eurprd09.prod.outlook.com (2603:10a6:800:12f::23) by PR3PR09MB5361.eurprd09.prod.outlook.com (2603:10a6:102:178::18) 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 11:17:34 +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 11:17:34 +0000 From: Isak Westin To: linux-bluetooth@vger.kernel.org Cc: Isak Westin Subject: [PATCH BlueZ v2 1/3] mesh: Add interface output filter Date: Wed, 21 Sep 2022 13:16:28 +0200 Message-ID: X-Mailer: git-send-email 2.20.1 X-TMN: [Yqm0oVuzcWaAYLyiIkJlT0Gx/Ae0Wjh1] X-ClientProxiedBy: ZRAP278CA0017.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:10::27) To VI1PR09MB4239.eurprd09.prod.outlook.com (2603:10a6:800:12f::23) X-Microsoft-Original-Message-ID: <20220921111630.23589-1-isak.westin@hotmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR09MB4239:EE_|PR3PR09MB5361:EE_ X-MS-Office365-Filtering-Correlation-Id: 60599494-9dd3-4faa-bb7b-08da9bc2e1fb X-MS-Exchange-SLBlob-MailProps: ZILSnhm0P3lUkjXuSDdeTQka1McTh6g4T9kseV1SDoA75ob2ERencravVQwr6+olSKJ23MJOXZJ0b66FXNNpoEUs+fN1kv/rLUFiXylS/EKYTISaRLwAJqKVTuJZ4MItWZDatfyUo/Wr9+AI5TFO9TFJ1Mga+QMERXXpwcW5QId8ZCr45exJYQAey3GhtkRLOaKUyNAqzbdKr4d1WT+xkE7JWw9S8KwyhMNy7KV02WXqcYT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yUgiXoWHBK9A2REu+1p2hDK5mkF7KY+V3jcewv+PFXOllZi4eQNO4t2yLJPwtH1LYGjtB3FY4St1Q9vidSTy1gqJmUgl24v7qtSUgOpzryC5LExM/dh+jDNDO1XRAEumUDKwgjQrRnlHWs6JqBDtkWLFJMcNFoZRUTjH5SSvceP4/iYVupd9LM6krCHONmZZJKalTNe7XLLy+S1Z7Y4wc65QMQixfMciIhPsAAMGVodYivlHwPoGQAji56BnWNtZ2TAe2QqTpsnpEopDlBtYHD4KpiLr1qHO63fHZOKecJ8+iLTdqHCSmxPIm9u0+lPbkk0IE0OpFeyVI5MhQeZqUhs0vWzBbLzUm+KoSLdHdCT1Ro8tYuNkLj20EwQV2bVmYmMGEgegn06A1oA81qBh7U+Y+ITP8InZ2/diCwluvzTaoM238nUuGkkIfb5dZLsoDlA9//TACLGT0cJdSuPYgkMKRJ1wA== X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-64da6.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 60599494-9dd3-4faa-bb7b-08da9bc2e1fb X-MS-Exchange-CrossTenant-AuthSource: VI1PR09MB4239.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2022 11:17:34.6803 (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: PR3PR09MB5361 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 11:16:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isak Westin X-Patchwork-Id: 609218 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 90D6BECAAD8 for ; Wed, 21 Sep 2022 11:17:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229610AbiIULRm (ORCPT ); Wed, 21 Sep 2022 07:17:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229545AbiIULRl (ORCPT ); Wed, 21 Sep 2022 07:17:41 -0400 Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-oln040092069091.outbound.protection.outlook.com [40.92.69.91]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 810EB7756F for ; Wed, 21 Sep 2022 04:17:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T/3RaeG63tDBtl3jlHV0B1B6eW9Xzdr6PSiczvkjCc1RMRrEH0ITfgrmVDr7dXH4w5kKwOvpez4Ndwjfq8H/2oAkUcexRMc607UeOeIAzMi5sTGQpxeh8ysFdXJQtm56oJ6IQVI3NAxzkjKF25XicT8Des2BwvUn0cGKzV+CKXsXz0xqaq6QYRiZykK5rE7Cgu5lyksSmDJyvjZy7rgEwbgB6UjXSxG+mpQhkGby1pQMFLWmOf7lGJJwYN4KjCzOw5ErznG6rCSjmxYtHpZ9Vk/SGwpD9GNXqJ+1hrX07BlBxu90UrSnV65MJS+ozoDX7AW3X5wEkG6flvhyi1u3vA== 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=Dr9l7AIIPCk+EeoqyB01vF9Fi1ucpPBAGwWASqexoE8=; b=cXvf5moIWla3hFe02a8MCGufVasW4/Md+gJqzmDRljpMiI9+LFQZk68n3sJqVPNtDfkuvs+PrLrw6GpegIN7ce+cCh1121iamMRrc84fWOCRvHzrf+cmTMTJXj085W/jn0bckCV/YTR/wsLn2t4pSHwMpbXdqir6GlD2qCMhsUHvbRXZ8vOWUv8aXm1/ggUrzem8aBo07QX7XRf6bRHLAYHc/w8SRHvDYE//U++f9TNqFHxGSz5YX4JWU9UMYGiTlcyRHISfuEXc0KRG4q7FBZc7Tb8YAua73NRZfCuXld7iSPxUE2VUM6tq8DzS31czicODYRE+FjG1tnNtfDk6aQ== 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=Dr9l7AIIPCk+EeoqyB01vF9Fi1ucpPBAGwWASqexoE8=; b=qhYK+KhwEU83ZpWCgeWApzWciMJsTJGiKszKaFPGy4DZaMbzm9FyaEK8aKFX5+3RdrCclTA/ixEFA8Df+hf7d8stjOGPwmry1mY11rwLtJtTkDuZQPVBgBPSYYMUWb94m/XSD/sdrohkOAhHtFWgfxudLwdXpFIm0/EHnws1EPWq+TW6v00zGf9iAj9CL4cjNOqjpKS/BQUYngzuUoGTjU3JfMniXWHuomk9Vr+1pZ0b29fDRB5eBgGq9WKdoEZz7sTurd6EjiGwF8JztASJ1eKgxiRmv0l0Yu+BAsl3qTzPd37yBO+m1rtbrYbinWk5tu7wbx2XUCQFjxrUIAaXXA== Received: from VI1PR09MB4239.eurprd09.prod.outlook.com (2603:10a6:800:12f::23) by AS2PR09MB6342.eurprd09.prod.outlook.com (2603:10a6:20b:579::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.16; Wed, 21 Sep 2022 11:17:38 +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 11:17:38 +0000 From: Isak Westin To: linux-bluetooth@vger.kernel.org Cc: Isak Westin Subject: [PATCH BlueZ v2 2/3] mesh: Do not accept publication for unbound appkey Date: Wed, 21 Sep 2022 13:16:29 +0200 Message-ID: X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220921111630.23589-1-isak.westin@hotmail.com> References: <20220921111630.23589-1-isak.westin@hotmail.com> X-TMN: [nTm4Bam/qFbLim2/3u2CkZN9GoEB92Xu] X-ClientProxiedBy: ZRAP278CA0017.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:10::27) To VI1PR09MB4239.eurprd09.prod.outlook.com (2603:10a6:800:12f::23) X-Microsoft-Original-Message-ID: <20220921111630.23589-2-isak.westin@hotmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR09MB4239:EE_|AS2PR09MB6342:EE_ X-MS-Office365-Filtering-Correlation-Id: 9e742cf7-d1b3-498f-73e1-08da9bc2e420 X-MS-Exchange-SLBlob-MailProps: ZILSnhm0P3lUkjXuSDdeTQka1McTh6g4fbbaNHcFdNnzsfNEqlJinPcbRlCG85P9V7MKfdaLCQ41HWzHgKgtwl2cz9+gnaedJ27vaFF9XlXc4LhClvqDs0C5jMwC93QFG9xf/td+q+bQNnu+ab7sPGll0Wk9ozNeM5nthjIja8knVcmoj6K/7PPzUouI4WdjuXS63gYJnQjn69/wiFvluB4Hyci3zzWEhDcm0QXQHN4toeY/ek7viseA3gXYMFYKlGuJKHYV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QKk2cDRk0rsnSodebmjaHc0FtgFMcpGmym9r/g4L38E+wJZjeAZv+tzhh1YJS6GEdqcwQRKFFejPul8l3cR9zLsh9CTxymL0JwaOaI0M1ZODAPWhTw1INrJLDFwL1sSvrEAd7xi1Ss84poHRE1Fyu/5DeIa2L2SUTtKBv7iMBqpwLvBZSYEIsB8SxnBImD4nIwT70QHSDQGgydSQ3fSqjcu+d0ykXQYMuEJZpxC/ZunHqVTba9ObERngYpqtLwcwcxWnLgr8Kv8yxuxtJPgPYteSEWFNW9nyVHeOCcuNRhaIe4Tia/YQpitYV+3ovIDfoAEfvw9RlirWh6FnBv0F//hjHsTtW6BWVlz1snhTHU8B2/xdYLUHzCuWN9573tue0N5pN3aGnx2CXsZmgMklzY4HmHASJRiUSpJu0PA3kAdkK0nUS3N3Nnfoqvv2g== X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-64da6.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 9e742cf7-d1b3-498f-73e1-08da9bc2e420 X-MS-Exchange-CrossTenant-AuthSource: VI1PR09MB4239.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2022 11:17:38.2607 (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: AS2PR09MB6342 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..d48e6ef12 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 11:16:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isak Westin X-Patchwork-Id: 608020 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 7B5BFECAAD8 for ; Wed, 21 Sep 2022 11:17:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229673AbiIULRq (ORCPT ); Wed, 21 Sep 2022 07:17:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229545AbiIULRp (ORCPT ); Wed, 21 Sep 2022 07:17:45 -0400 Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-oln040092069090.outbound.protection.outlook.com [40.92.69.90]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 374EF77E80 for ; Wed, 21 Sep 2022 04:17:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cCJrRDcUzvgcVOQ5SpTxHAXnCJE7GC4it+lToKjjR3GPjA3W5hxZFAKjTgL4mCBUk7K6290Y4mrfK6oJdMabR9OTG2CykP9K+h6vqUYzL4PqNscOK1XbpnsfHclv1vWMQWctzPl+FzE/LQl9sB/dCEBJs2fxauHvL/xye5RbhUiTc4e+L+dXn3k/IgysHO26ocHwlPbkxjX0ep3vJVoID0toY/4qu1vfU5ZnMAAqg9wwoTfhzef+dQzLbOTdv1UdDCiF6ZdsCBh7Sowev90e0vx0HoOKw2/O66K/TQ4wn8yc9t5CcWQYA7YIq9txZ48B7s4Y9OPGu1rzysYKavViDg== 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=gZhWbCTFZfDgHJpRDmlsCZ69+oKNTCbjVXP/y1zLYchGOwlDImbniUgvB5bd4ShtAkTjYNrUfcqPC06QoUW+BoOxnBteTHvh3cTa32vMsvPWV+NqogNZmscJEZT1WZVDtIdiqwmy4LBP7V0XL+1OQoast0mfyX91YLKPExEdVbba6fp+LO2qS5jujk2p/3F+bdFCq2eShVMx/dP2clzc+66ghiCaEihEtgkG41KhqU7BtGMQmnXNdJJxEx675HcZfpuIA69Ohsfgqk1Y/BX1CpZ+X8vD2Mf7jf4/ZaiQx4hTiwrz1xy79HUh7K/L1G8KODegkO/ZIK0Reig9xPyj2Q== 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=kdbu3kCVrCE6OkBkwt02C2MG2cV+WclauPTmMshEIJNL6tqo8PSbK7EVnsQEZBluL/s1m0zoDuSPiNsWN7BGe0E5lMn4nTgNeptrsrlq8G1xlXdqGhEX0/YtRSEwD9v2jg8sa2a6SBXCutV36LWt/hofrtcmqmFFbEQ8aOuhX45pBFmd7/VT7wofXcW5CBuDCeVfqXMF79YWo1sKKhSKqPsCCGUECHfQuS0z5iQ8DcJp0N17L6qfok6COt3MBNP1lSWzxlXpt6lLlSQOuEd50MQBke3nIDZVCx6YZGa6cXCYVpiY5C3R4F8goVET+rsCBRG7abo/pHh5aBr3YV4qOw== Received: from VI1PR09MB4239.eurprd09.prod.outlook.com (2603:10a6:800:12f::23) by AS2PR09MB6342.eurprd09.prod.outlook.com (2603:10a6:20b:579::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.16; Wed, 21 Sep 2022 11:17:42 +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 11:17:42 +0000 From: Isak Westin To: linux-bluetooth@vger.kernel.org Cc: Isak Westin Subject: [PATCH BlueZ v2 3/3] mesh: Remove RFU check for publication set Date: Wed, 21 Sep 2022 13:16:30 +0200 Message-ID: X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220921111630.23589-1-isak.westin@hotmail.com> References: <20220921111630.23589-1-isak.westin@hotmail.com> X-TMN: [PAhrjtARE4Q2MIuCt2aIWBPoqNGmZN46] X-ClientProxiedBy: ZRAP278CA0017.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:10::27) To VI1PR09MB4239.eurprd09.prod.outlook.com (2603:10a6:800:12f::23) X-Microsoft-Original-Message-ID: <20220921111630.23589-3-isak.westin@hotmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR09MB4239:EE_|AS2PR09MB6342:EE_ X-MS-Office365-Filtering-Correlation-Id: 0a2fad3f-34b2-425a-6289-08da9bc2e685 X-MS-Exchange-SLBlob-MailProps: ZILSnhm0P3l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UXsC3ilK7IGK3FqcS/dZUE5e2TlPgcn75B+0idPzWC7vSsyAMQzrQYcTIwgmbHjktKS3B5REZyy8lzMksJL1IyPV/9695DsrMaqIhjfIwrBSYTI9/2u7gSWwpMQ3NLEmVnfxQKRFbmGgajVNNGrevfGbIWhySEmRei1l3zzk9xzjVFQli4tHPaeHvPMuyTUMte5EfaBtm9n5ivUjDRDDdAYvGEgizL+yrN8RP9oB7kiST+xvFiTH7TRILjBd7uVwuPz82gjKz0YCovBZTiHfFww2BvbyWzreTUVGZcd1CyLqNqkLLuTzWI3bOY0FuP0FPKjrsP5/L0aeOCr3fMac29Xoes16f3A82/mXndqcwdPcozwmNQfl/kfnIxH1IjHaLrIHo1PwVxwUkHzgZvPufHbIrWemqzX42KCUJfwrRDcyIt6VUxdiETYUwyNHV3+LUKrYezTnpEH9CeobVbEAdVd7mXdUFRA17rmfJxbX4j9RJNJpCxjsBKN9l2RjwTUqvyK9ZHtwVuIw/H1KJEsIQC3PUjkxQxShKoN+oCeJmSdrN4seulOjuS18bATMAxgCssJL60GXsRNhvJkIOAMtzt2DdUIQ+tQ8Ww5of5S8FPY5/XPAoF8d27dEkpKB7gzRkwHnx/dmUdr9S09E4aDtCDl9odDk+6Wo91qZCA9KJEm3yAFTEvIzP7xhWQ2knnxg== X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-64da6.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 0a2fad3f-34b2-425a-6289-08da9bc2e685 X-MS-Exchange-CrossTenant-AuthSource: VI1PR09MB4239.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2022 11:17:42.1839 (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: AS2PR09MB6342 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;