Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp47525pxa; Tue, 18 Aug 2020 15:26:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxs7vKvAA6MzhZI6YASAWzD3W7DAhJe6mrgvi/gwgumiqIxS7mN1TkCLezzlgtIBCtRXk61 X-Received: by 2002:aa7:d145:: with SMTP id r5mr21442134edo.323.1597789587747; Tue, 18 Aug 2020 15:26:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597789587; cv=none; d=google.com; s=arc-20160816; b=KsvRp1svqfyuU8zx9mL3Bm0fFngdbxBuCuFgIsFVH6e1RqXewxFR6puiIoUroaAdg3 Pw6i01m2rcWH7/p2oWmAsmfCkvCI1CHYr5Zu0twPb5oJLyu6Ppt0PssZ5E11jI1JR4Ft md4StN7xW0o7KWyFm6tcS9YOvJykc3YjAiHXC6F0xyb7KhIB3eweaTpMpfZWNcWAuLZP w5nPDSNW1Qp2ur9dAXS3mqxhG1cy/8QZJSpA3/8HGB6VXyc2OCIcZ8NrB1SSjcLNh6B1 WttbXHqWPQn2vC0wTXSEnJT/PnuSSjki8MnGNc/aLOncFxWC02Seo/5mz37UKXPZmMKq Sf1w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=5zMWa3r7MsOnDHeTuB5Xm5QRKgeiWbVD6bmhw7DonRY=; b=vJHSS8uXo9qsxvL2eaeVsBamoC8xLzoRrF/kGYRTHDAkjNo0/Y56jRJ0S75HxoEMmr Ko1mAQycXx2oLfLWtycy8EmsD6T0t7m6vh3ZRVlhTCbKDvalzlDsz86FNCpU0v8ut3oK LSr/uzHM+736vLjf5cqJINMQ7OoNpZ/rWurxxAiJvsCFPtEaTNP4+1q875kQGJy8B4cL NRmd2CFIo62q5GixOqMTycCId9VSeJbkqAr0TNjzZ35mj6AwA6NfnVG5oisC010R6YlE 46TOzUiu+8DW9kuC9nQxJm8iNlT36qY4hslyDwzmc94DlfYhBanX3Api3Od0hTAMCutI yfrA== 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.26.02; Tue, 18 Aug 2020 15:26:27 -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 S1726539AbgHRWWM (ORCPT + 99 others); Tue, 18 Aug 2020 18:22:12 -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 S1726799AbgHRWWL (ORCPT ); Tue, 18 Aug 2020 18:22:11 -0400 IronPort-SDR: aMZj5JUY3UsC/2JfIlu8ibibpx9T+ayS7VtzfdlNiu7zXs7k6arY0bbvP6ey0XzeXUzTc7O8SS SS1QH/IAqt1g== X-IronPort-AV: E=McAfee;i="6000,8403,9717"; a="152634886" X-IronPort-AV: E=Sophos;i="5.76,329,1592895600"; d="scan'208";a="152634886" 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:10 -0700 IronPort-SDR: AiLF9XTtW+fawC+lhHeGYU2SJTHh3Ocy8weAUQD4AO9JTxWgmfCJBLul3D9uZRB2DcYn6yTEaD 9Bv9UQC3a8sA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,329,1592895600"; d="scan'208";a="336764509" 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:10 -0700 From: Inga Stotland To: linux-bluetooth@vger.kernel.org Cc: brian.gix@intel.com, Inga Stotland Subject: [PATCH BlueZ 2/2] mesh: Check for enabled modes when dst is fixed address Date: Tue, 18 Aug 2020 15:22:08 -0700 Message-Id: <20200818222208.50938-2-inga.stotland@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200818222208.50938-1-inga.stotland@intel.com> References: <20200818222208.50938-1-inga.stotland@intel.com> 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 This moves the check for incoming messages addressed to fixed addresses, e.g. RELAY, PROXY, FRIEND. If the corresponding feature is not enabled, the message is not processed. --- mesh/model.c | 21 --------------------- mesh/net.c | 9 +++++++++ 2 files changed, 9 insertions(+), 21 deletions(-) diff --git a/mesh/model.c b/mesh/model.c index 961391f13..b44e2f669 100644 --- a/mesh/model.c +++ b/mesh/model.c @@ -937,27 +937,6 @@ bool mesh_model_rx(struct mesh_node *node, bool szmict, uint32_t seq0, if (!num_ele || IS_UNASSIGNED(addr)) goto done; - /* - * In case of fixed group addresses check if the - * corresponding mode is enabled. - */ - if (dst == PROXIES_ADDRESS && - (node_proxy_mode_get(node) != MESH_MODE_ENABLED)) - goto done; - - if (dst == FRIENDS_ADDRESS && - (node_friend_mode_get(node) != MESH_MODE_ENABLED)) - goto done; - - if (dst == RELAYS_ADDRESS) { - uint8_t cnt; - uint16_t interval; - - if (node_relay_mode_get(node, &cnt, &interval) != - MESH_MODE_ENABLED) - goto done; - } - is_subscription = !(IS_UNICAST(dst)); for (i = 0; i < num_ele; i++) { diff --git a/mesh/net.c b/mesh/net.c index 26440b02d..115a76944 100644 --- a/mesh/net.c +++ b/mesh/net.c @@ -1658,6 +1658,15 @@ static bool msg_rxed(struct mesh_net *net, bool frnd, uint32_t iv_index, } not_for_friend: + if (dst == FRIENDS_ADDRESS && !net->friend_enable) + return false; + + if (dst == RELAYS_ADDRESS && !net->relay.enable) + return false; + + if (dst == PROXIES_ADDRESS && !net->proxy_enable) + return false; + return mesh_model_rx(net->node, szmic, seqAuth, seq, iv_index, net_idx, src, dst, key_aid, data, size); } -- 2.26.2