Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp1802556rwb; Thu, 19 Jan 2023 15:59:04 -0800 (PST) X-Google-Smtp-Source: AMrXdXu/DjptgzQfeA7etOWd346i+Jq0fWq2BTYnYG18WvRXjS49vyeB2KAa52LsZU36oiN0BL9i X-Received: by 2002:a05:6a20:4f01:b0:b9:5fd9:efc9 with SMTP id gi1-20020a056a204f0100b000b95fd9efc9mr1070645pzb.20.1674172743751; Thu, 19 Jan 2023 15:59:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674172743; cv=none; d=google.com; s=arc-20160816; b=pOawOxX3VYPpTkEh5mjyn2g3PMOz2jV00jUSfBztCnZsRu01RUhyd9L4xCx59dV5qU meMhtcXv5lzupmhI6e6dQaXWkOAeESYQ0zhTz6ZdaiDEZXtsVnjXhOzq+ZB3jSd4OR56 cbYkpoNuqEthvgxTuTmgX1bgRaSxdMCNA/aKrdAAiyYiNtly2VKx756J6C00rLq7Xb6m Oh2xoE0qJVtqruqQG62lH+g2dNfi9vhvDnXEk0yVOaUPfBZGw38usFRWZ1IWI/xrfrI/ W8RmtM/UJTNkPb+T+KEnxtDx7Yc1a+nYB6SvOPwFPyBDgNMtZ7dV21XZLutMxwVpbLhe GjLQ== 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 :dkim-signature; bh=WYVOxWJSoQIjBEbbykchz25YyxslhqehlcquO50uVeg=; b=sdYDOuL9JC3DoipZqlIsLH5Ptbl92dl/2oum39OZ7t+mLYRbf/lLyNMYGnhHbXXxt6 0wavO8fO1cmCIV29NUQVQUa96cMzcsUItHwLmg+MC/emN5nXuJtYsibOXtkn1wtbE3pW V/tk2B2971HVIv5C/77CH1PMGBdHCD9Gw9P/y6BqSub8LTY+W70vI5YO/QCuuwLYiMYM j7li1ouo61AUvt/9tkfWaQkXH8o167QL+hxlURLAgPFNEee01iQKrWLKS5qujpj8Qy/w RhesUmkJqELg8k8ePNqnVG/1M7I3/V8wK2Jyj4f9eE9jLVwZAeHUxern4cCROLzbOZ5f Vsrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ovB1F8QI; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a23-20020a63cd57000000b00476cc73fd87si39679556pgj.512.2023.01.19.15.58.50; Thu, 19 Jan 2023 15:59:03 -0800 (PST) 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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ovB1F8QI; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230401AbjASX6a (ORCPT + 99 others); Thu, 19 Jan 2023 18:58:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230374AbjASX63 (ORCPT ); Thu, 19 Jan 2023 18:58:29 -0500 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 330CE9FDCD for ; Thu, 19 Jan 2023 15:58:16 -0800 (PST) Received: by mail-pj1-x102d.google.com with SMTP id x24-20020a17090ab01800b00229f43b506fso2446200pjq.5 for ; Thu, 19 Jan 2023 15:58:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WYVOxWJSoQIjBEbbykchz25YyxslhqehlcquO50uVeg=; b=ovB1F8QIV+m20xrqyY2Rn+PsNimYB0jj5ti70flNUunR8WPt+HbN/MX4dI2SjmaOls XBmTK75njSCJziRasvRtTFsn8azHNOsloEFWMSfGc2FmFNGGCgjwdaFHkSYLjJz1rmOE OiFLshTgaLmQSDcYIsns/CW3qqG1kTynsuTodqbPf/poQ/upV7A1pW7AFGFzaWxRYzxN /Lra01qmMefdSDrXrWuNl1UJbLmaREj0goOUEqxom+KlkZDPpUY+J99vDcrtMIDUZHtP rME+YrdvWMY7e35Y05Hru5Npw8IJI3W6WRvL3ImjMF/WIhOxy8SZQNsv+JF0nDB3+Xt/ fk4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WYVOxWJSoQIjBEbbykchz25YyxslhqehlcquO50uVeg=; b=QRjs5oYmM1nmFYPxuHIbtZaQxrQI7x+csB6GHu0GDHQMwY/8Nckb7ncESIhko1LJaM iTvoIIFt9zGcvGOfB95z2ccEQnF7tQtbRAMUh5OSP9rVlGjazS7wVlnYh/MfDcVrNgN0 BLqOQn2GuGUz4dozZvLEU3cyxJD4+/54o5UnZo/XnRF/ZAhpYiA7eMmMKNSobMdyKpXu Csctdjy1CGzX5KOhCqQy8+SEH1FOQvDSqdvsqRDcrSOHMaX9ROz38b1nFph15j9Li6EI eClN3yiX/BcCNZLzodV+OZ9zWN376FHjP+r9DiLRN5GPpKI64ERHk5eSnMjvo83hh/TO njCQ== X-Gm-Message-State: AFqh2kq0T0FIMXG0jIWVNA9FpsN7FvsOSNGiB65wrao5UaNCsTGfUdSz Z/qjCzoCev1Jl7LWGD554Vqpq0ptbwHKDw== X-Received: by 2002:a17:902:eccd:b0:194:dec8:9824 with SMTP id a13-20020a170902eccd00b00194dec89824mr1607384plh.26.1674172695047; Thu, 19 Jan 2023 15:58:15 -0800 (PST) Received: from fedora.. (97-113-173-242.tukw.qwest.net. [97.113.173.242]) by smtp.gmail.com with ESMTPSA id n10-20020a170902d2ca00b0019460c34839sm14826373plc.185.2023.01.19.15.58.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Jan 2023 15:58:14 -0800 (PST) From: Brian Gix To: linux-bluetooth@vger.kernel.org Cc: Brian Gix Subject: [PATCH BlueZ 12/12] mesh: Switch beaconing net key Date: Thu, 19 Jan 2023 15:57:55 -0800 Message-Id: <20230119235755.46002-13-brian.gix@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230119235755.46002-1-brian.gix@gmail.com> References: <20230119235755.46002-1-brian.gix@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 From: Brian Gix When transitioning from Phase 1 to Phase 2 of a network key and we are beaconing, we need to halt the beaconing on the old key version, and begin beaconing on the new key version. --- mesh/net.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/mesh/net.c b/mesh/net.c index 049f0c44c..de4552343 100644 --- a/mesh/net.c +++ b/mesh/net.c @@ -2625,6 +2625,13 @@ static int key_refresh_phase_two(struct mesh_net *net, uint16_t idx) if (subnet->kr_phase == KEY_REFRESH_PHASE_TWO) return MESH_STATUS_SUCCESS; + /* Stop beaconing on old key */ + if (net->snb_enable) + net_key_beacon_disable(subnet->net_key_tx, false); + + if (net->mpb_enable) + net_key_beacon_disable(subnet->net_key_tx, true); + subnet->key_refresh = 1; subnet->net_key_tx = subnet->net_key_upd; /* @@ -2632,6 +2639,15 @@ static int key_refresh_phase_two(struct mesh_net *net, uint16_t idx) * it hears beacons from all the nodes */ subnet->kr_phase = KEY_REFRESH_PHASE_TWO; + + /* Start beaconing on new key */ + if (net->snb_enable) + net_key_beacon_enable(subnet->net_key_tx, false, 0); + + if (net->mpb_enable) + net_key_beacon_enable(subnet->net_key_tx, true, + net->mpb_period); + refresh_beacon(subnet, net); queue_friend_update(net); -- 2.39.0