Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1937406rwb; Thu, 29 Sep 2022 04:18:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM65UirbSvOvgstIJJMQvNq8XpcXBexFOs6CFljR4QIR2WjnNvXi7Am8yFvLa+QITdwF6eEh X-Received: by 2002:a17:907:6d28:b0:782:32ad:7b64 with SMTP id sa40-20020a1709076d2800b0078232ad7b64mr2496430ejc.23.1664450295156; Thu, 29 Sep 2022 04:18:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664450295; cv=none; d=google.com; s=arc-20160816; b=TcxMz1snS9mXKnczfWQ7glt+RyRkDVZBeKdc+OGXm1yooXgsqy9gYlxaV3kc4qgPld /c6tK0AON0uuWn5lZO1EHAE7OF4h40WNl6tHm+nf0hDJjaJslGYNIW/bxGAJgwHOK3Y6 qXThvYBfNReetB8/Ru+Bt21Wi6IjzfjrUGYXC+sXiGz/G7Y9e6xXO9au3ufiMDhU7xy/ BPoOImFRcMHg2+KITuS8AOq8I6KWdTE2KAgUuytNdZSYoR7dIYERZd3fNqVeOCNqm53u hKtFi3pPKKr+PglKZllWhN6fu94MbBq0q3C3Cfajt0STbuPDKn+MnMZ1U2bu9F2CfvzO EC1g== 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=atGc7snD174BBWwxw6BTD7/AcxyQij9uf5um59q7cd0=; b=VVjw25/cIkeNBoWnvn9CRKHiJ6rlJh3Tv/p0ZtP4m/yR3Cqsg1YwMP3Hj30ubzUuDz pO/jj6MnpRhwoTPdyUw2HXDMSNDbOXPaZ1m43fs7PAITRhDHerlefdoTtVzDzQw9dOJ8 Q+UBcBxw4x0KeTzIvxblpbitEwxpp+PDjXoVJrC9KL4lF3ZD1jwc9jNMY07Rb/SS2JwV MDvnffw0XvQcr2cLYYP0qEqlG5HfWx98zxC27m03rchp5kZ6xGcx/eCmL8VgihE4N2UB sb+/3WAVgPeAMNZCK8k2klLggvcsfqNzUHyZ0BGa0aX80MYPrRWmYLkLWOlF/2bayTSr /MIw== 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 go36-20020a1709070da400b00781bf46536bsi3360596ejc.4.2022.09.29.04.17.49; Thu, 29 Sep 2022 04:18:15 -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 S234687AbiI2LEQ (ORCPT + 99 others); Thu, 29 Sep 2022 07:04:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235198AbiI2LEM (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 13DF012BD8F 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 1odrKr-0007Jb-E8 for linux-bluetooth@vger.kernel.org; Thu, 29 Sep 2022 13:04:09 +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 28TB45CG3109252; Thu, 29 Sep 2022 13:04:07 +0200 From: Isak Westin To: linux-bluetooth@vger.kernel.org Cc: Isak Westin Subject: [PATCH BlueZ 2/4] mesh: Ignore SNB with invalid IV Index values Date: Thu, 29 Sep 2022 13:03:42 +0200 Message-Id: <20220929110344.26130-3-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 we are in IV update in progress state, and receive a Secure Network beacon with an IV index equal to last known IV index + 1, and IV update flag set to 1, it should be ignored. See MshPRFv1.0.1 section 3.10.5. --- mesh/net.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mesh/net.c b/mesh/net.c index dc3d1fd80..c225fdb9a 100644 --- a/mesh/net.c +++ b/mesh/net.c @@ -2671,6 +2671,10 @@ static bool update_iv_ivu_state(struct mesh_net *net, uint32_t iv_index, if (iv_index == net->iv_index) return false; + /* Ignore beacon with invalid IV index value */ + if (net->iv_update && iv_index == net->iv_index + 1) + return false; + if (!net->iv_update) { l_debug("iv_upd_state = IV_UPD_UPDATING"); net->iv_upd_state = IV_UPD_UPDATING; -- 2.20.1