Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1937290rwb; Thu, 29 Sep 2022 04:18:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7fv4b1QZthjd1LzPP3/5Y3BbJaNtkEmajCHK6NwG4AqQb7YTlGPsj+zLMzdrq44qQgZ0ai X-Received: by 2002:a17:907:2cd5:b0:77c:b9cb:bdac with SMTP id hg21-20020a1709072cd500b0077cb9cbbdacmr2374937ejc.265.1664450288747; Thu, 29 Sep 2022 04:18:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664450288; cv=none; d=google.com; s=arc-20160816; b=X4l5SsOUxSkYCJOm/BvgNzKfeQHvqK7OAEMpqqUhfc97wr2Ql3g1t0tid161AVz3jb msKa6Y4UCAUFH8Sl3+MXEcAjmRVFAoSJLTkqkF/I5c3cQMjjFgj/Rt3tXObwYpl5oIA/ f7fjxv+7psNDv5OJ7PlvB0WwvYNQkl5xBWiCDtmPSnwYk8B8QYCPOluuI/HtWmRhqg4J vOLbLGIi6PpYKpTPUlOJLGAc+TP2tDn+fnWlf+4Mj58au9cDVBdrt0EsQhlh1NRZtPD+ wiUjRwFC8iFnPdmqcgv08hh30Gs/Nq6YqQfUuwfzPNlTrHvPadQjBp8Z6k40HSRW5Ukd Tciw== 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; bh=G7OszJgdaDL+PdXeDd9QSLMTh0VppvJTj8TvzKDpBjs=; b=LqGbSTCk9XCr5iceCVog5vB2ZRonjrekv9qEZNs8sg7ATBxG6ZpjDgqQ27xS7Tv4pJ w9pdAsGkNfPv2Qvj/z/ECGjuiOdM5bxuNqAg1AAD7Z+hHhhNbKlM0Y5yC9Dx1LmqFwV3 SLVlzq3cpQg8ioaFcNPPUy7uq4uMStWaeIzDxNGADCuO31t/MIAG7YTIKLe70EdwzQmU bUkc6y4l5bbK5olvEMK8/Rxi7Zn/OWWr5sR7txa6oBo4HBh3SxTSjRg5WfbLchsuOZmW CrpNhHzdM41SZJ9pLp3MP9clZVb8/linKCxYZyviQJiwrGxKl2Hj/+/Fslymp2NIhO+u uvlg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sg40-20020a170907a42800b0073d6e50e564si7556421ejc.348.2022.09.29.04.17.43; Thu, 29 Sep 2022 04:18:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235166AbiI2LEN (ORCPT + 99 others); Thu, 29 Sep 2022 07:04:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235197AbiI2LEM (ORCPT ); Thu, 29 Sep 2022 07:04:12 -0400 Received: from voyager.loytec.com (voyager.loytec.com [88.198.4.4]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECE198E0FE for ; Thu, 29 Sep 2022 04:04:10 -0700 (PDT) Received: from 212-17-98-152.static.upcbusiness.at ([212.17.98.152] helo=lexx.office.loytec.com) by voyager.loytec.com with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1odrKq-0007JU-0k for linux-bluetooth@vger.kernel.org; Thu, 29 Sep 2022 13:04:08 +0200 Received: from loytec-dev-vm.delta.corp ([10.101.25.21]) by lexx.office.loytec.com (8.15.2/8.15.2/Some OS 1.2.3-4.5) with ESMTP id 28TB45CF3109252; Thu, 29 Sep 2022 13:04:06 +0200 From: Isak Westin To: linux-bluetooth@vger.kernel.org Cc: Isak Westin Subject: [PATCH BlueZ 1/4] mesh: Ignore Secure Network Beacon from subnet Date: Thu, 29 Sep 2022 13:03:41 +0200 Message-Id: <20220929110344.26130-2-isak.westin@loytec.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220929110344.26130-1-isak.westin@loytec.com> References: <20220929110344.26130-1-isak.westin@loytec.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 212.17.98.152 X-SA-Exim-Mail-From: isak.westin@loytec.com X-SA-Exim-Scanned: No (on voyager.loytec.com); SAEximRunCond expanded to false X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org If this node is a member of a primary subnet and receives a Secure Network beacon on a secondary subnet with an IV Index greater than the last known IV Index of the primary subnet, the Secure Network beacon shall be ignored. See MshPRFv1.0.1 section 3.10.5. --- mesh/net.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/mesh/net.c b/mesh/net.c index 7fec98531..dc3d1fd80 100644 --- a/mesh/net.c +++ b/mesh/net.c @@ -2708,7 +2708,7 @@ static void process_beacon(void *net_ptr, void *user_data) struct net_beacon_data *beacon_data = user_data; uint32_t ivi; bool ivu, kr, local_kr; - struct mesh_subnet *subnet; + struct mesh_subnet *subnet, *primary_subnet; ivi = beacon_data->ivi; @@ -2723,6 +2723,17 @@ static void process_beacon(void *net_ptr, void *user_data) if (!subnet) return; + /* + * @MshPRFv1.0.1 section 3.10.5: IV Update procedure + * If this node is a member of a primary subnet and receives a Secure + * Network beacon on a secondary subnet with an IV Index greater than + * the last known IV Index of the primary subnet, the Secure Network + * beacon shall be ignored. + */ + primary_subnet = get_primary_subnet(net); + if (primary_subnet && subnet != primary_subnet && ivi > net->iv_index) + return; + /* Get IVU and KR boolean bits from beacon */ ivu = beacon_data->ivu; kr = beacon_data->kr; -- 2.20.1