Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp46062pxa; Tue, 18 Aug 2020 15:23:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdgRIP0goWtjAV4JNyn1ENvmjy9C0TTtFgNO+oXhOfiz8ic3dbkMfziyWcjCriMAzz+4NC X-Received: by 2002:a05:6402:1386:: with SMTP id b6mr21717356edv.296.1597789403988; Tue, 18 Aug 2020 15:23:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597789403; cv=none; d=google.com; s=arc-20160816; b=N5IoJX6Z9+V1phrJqGYssdxYXcmLtJrR9xhbSTQ21q1x2zXb4+2uy2ICZfSYkzYCv7 o1WvlwzrR5/LaBWhYunkGHpUnNhZFvrOcH++USYjeCMWPjpfMyAxP8CxYGGXD02zE/oP KEuyu1DNJWdkznoN9tMAxmd2aF8fvTHDg9hqF4hKYp5vpM7QhRZaGhsujYpBwyNRNgTM tWAhTbYMvdf5T+uQZpDeqlIr4lEy/002SZYM2Sr15FSY6G95e4/kbpIt90CEJYKuOx8j RcTz+KqvlrpcLPGpPJeVzStflzK/9YKjz/XI3DqC8ZrnzmPFJ2IM4R3YxtIdwPcUZf1T 1aaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=FYtJMSiaeJH7IXvCDbPfb1tnoQG/ZO0BhA+N6aMOSJU=; b=eYvN57IDpKKoj7GaXPbAWHol8vv8YkpaNq/Zi8AimtICR5qUr1F+WUwkBZ89+mqWFy iFXY0o/u7/AUaw6X9rtm+KPr+l44ZX39Lp85uPVKJjq0ifOIeW9vwNjhuoZtsr6npace ae3+9byL1TVEF7o3D/gKlFwOyS3cH2XEOcRVPKPxoV9EXkF6dSoUaCJIIm8pc3yiJp6o NEiH+Ofopx40Oc8oj7LVxF/lQPR0Hl98wIaIU5yRLly1T7un1mbl3CSVhCtb9UYSQka9 U3uyLmD8Jc3opuxIhnb/xvhysIigHsFGsaI9lE3nlFyZSF2DB1xVaiyFt8cOQBcoWvPO YVuQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 25si17206243ejl.76.2020.08.18.15.22.39; Tue, 18 Aug 2020 15:23:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726807AbgHRWWL (ORCPT + 99 others); Tue, 18 Aug 2020 18:22:11 -0400 Received: from mga11.intel.com ([192.55.52.93]:11540 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726539AbgHRWWK (ORCPT ); Tue, 18 Aug 2020 18:22:10 -0400 IronPort-SDR: 1MvmYClBNo3BUix5PZO0yBa8VRgvbNKJO9qLrrMVRtoAbc13WjNCMLW5Ho4prmiESQzJ+TA8Q3 Z55nvmUPMDDg== X-IronPort-AV: E=McAfee;i="6000,8403,9717"; a="152634881" X-IronPort-AV: E=Sophos;i="5.76,329,1592895600"; d="scan'208";a="152634881" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Aug 2020 15:22:09 -0700 IronPort-SDR: Jdcjc6bvwcySXLaDcnnQPXaLA53jNVFaXNsf95PByCDEI0SNE9AEV8/ysrfUl97LdQ2tCH9G3U a2zIal+yhD+g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,329,1592895600"; d="scan'208";a="336764503" Received: from ypeng18-mobl.ger.corp.intel.com (HELO ingas-nuc1.intel.com) ([10.255.230.245]) by orsmga007.jf.intel.com with ESMTP; 18 Aug 2020 15:22:09 -0700 From: Inga Stotland To: linux-bluetooth@vger.kernel.org Cc: brian.gix@intel.com, Inga Stotland Subject: [PATCH BlueZ 1/2] mesh: Always set net modes based on node feature settings Date: Tue, 18 Aug 2020 15:22:07 -0700 Message-Id: <20200818222208.50938-1-inga.stotland@intel.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org The network settings such as relay, beacon, proxy and friend are always set based on local node feature settings. This change makes the net modes intialization unconditional, to include the "No Support" setting on node level which should result in the disabled mode in net.c --- mesh/node.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/mesh/node.c b/mesh/node.c index 1eeffeb8b..ebc111a62 100644 --- a/mesh/node.c +++ b/mesh/node.c @@ -399,24 +399,16 @@ static bool init_storage_dir(struct mesh_node *node) static void update_net_settings(struct mesh_node *node) { - uint8_t mode; + struct mesh_net *net = node->net; - mode = node->proxy; - if (mode == MESH_MODE_ENABLED || mode == MESH_MODE_DISABLED) - mesh_net_set_proxy_mode(node->net, mode == MESH_MODE_ENABLED); + mesh_net_set_proxy_mode(net, node->proxy == MESH_MODE_ENABLED); - mode = node->friend; - if (mode == MESH_MODE_ENABLED || mode == MESH_MODE_DISABLED) - mesh_net_set_friend_mode(node->net, mode == MESH_MODE_ENABLED); + mesh_net_set_friend_mode(net, node->friend == MESH_MODE_ENABLED); - mode = node->relay.mode; - if (mode == MESH_MODE_ENABLED || mode == MESH_MODE_DISABLED) - mesh_net_set_relay_mode(node->net, mode == MESH_MODE_ENABLED, + mesh_net_set_relay_mode(net, node->relay.mode == MESH_MODE_ENABLED, node->relay.cnt, node->relay.interval); - mode = node->beacon; - if (mode == MESH_MODE_ENABLED || mode == MESH_MODE_DISABLED) - mesh_net_set_beacon_mode(node->net, mode == MESH_MODE_ENABLED); + mesh_net_set_beacon_mode(net, node->beacon == MESH_MODE_ENABLED); } static bool init_from_storage(struct mesh_config_node *db_node, -- 2.26.2