Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp2003663ybh; Fri, 13 Mar 2020 11:11:59 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtzTmwu+Ayva3OXYJU3/lnHN8BBUyOCGk300H2NaV3fwN4wR8FmrHkILwBHlQBXx7vG+399 X-Received: by 2002:aca:646:: with SMTP id 67mr6173405oig.4.1584123118850; Fri, 13 Mar 2020 11:11:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584123118; cv=none; d=google.com; s=arc-20160816; b=0vZVdpnfRnBi/2Am24uTkkCFbjk/LFLZJKwW3o0NuuM14ikBZ7VFNqMqh0IpQJ9iV0 FjjUaEO8SBfDlDb6aVSSZvmGtdprgrFviZzHIigPdPku6O2BzjHfULk7Bm/BobgACXdk Eb1eTSLROlFNZUNtK98mf3V0X4U/aRqQK9dS3YOh0fuQ3D7JxVpSoBAnO901FayHkQE4 TBxfbyGB/yVyhGSTPTnI2NtuiTuULsqlv6s0pqOoRldJUAx9P418W1GbKJcxFsWZNIkg TYxHfkfJjHhr2MjMjf5bdAGHiGVxKDiVWWh6bSLvLq4/CthmUI4pQtx6QYPE+g8/XfWr VwvA== 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; bh=TRikmKVtGGHH33WUPfNKxxCiroxROA+wVt1bgLftM4E=; b=pizvKW2ZrgE3Wd+Py1iULHYJY+tQ2QQ3MabFI9KssvHKq5p90QdovPW1xGFhgGlgDq DuObQCl8X3f5yZYFDIshtbmOdgE3afDfyyJWxbHPBMmwapqdWBXiphIknyQTV6Z2wDj/ 65iyCaaudqd12AZHAr5xftY1zsbMO1vdl98TpalQArcysLepJcaUZeFdFoWu6+c25O38 AQQ0ENWTBlQYiu22GCCdqn3Cywgu9llLTqbbNy+vabLUUTuh0AorXTImb0Oi+wW1GJrs DfgKFxNCUUbyrEPPPUH6ug8+8DzmKi2XtIN9Ph+5yx88YRHq2cwugW1focUvpFQqZhPw kYGQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id m126si5018116oig.177.2020.03.13.11.11.45; Fri, 13 Mar 2020 11:11:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 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 S1727148AbgCMSIl (ORCPT + 99 others); Fri, 13 Mar 2020 14:08:41 -0400 Received: from mga06.intel.com ([134.134.136.31]:26967 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726480AbgCMSIl (ORCPT ); Fri, 13 Mar 2020 14:08:41 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Mar 2020 11:08:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,549,1574150400"; d="scan'208";a="266811431" Received: from ingas-nuc1.sea.intel.com ([10.251.23.252]) by fmsmga004.fm.intel.com with ESMTP; 13 Mar 2020 11:08:40 -0700 From: Inga Stotland To: linux-bluetooth@vger.kernel.org Cc: brian.gix@intel.com, Inga Stotland Subject: [PATCH BlueZ 2/2] mesh: Fix processing of Config Node Reset message Date: Fri, 13 Mar 2020 11:08:36 -0700 Message-Id: <20200313180836.23227-3-inga.stotland@intel.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200313180836.23227-1-inga.stotland@intel.com> References: <20200313180836.23227-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 fixes a condition when a node continues processing messages after it has been reset by a remote configuration client. Upon receiving Config Node Reset message, a node deregisters it's message receive callbacks and a complete node removal happens after a grace interval to allow sending of Config Node Reset Status reply. --- mesh/cfgmod-server.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mesh/cfgmod-server.c b/mesh/cfgmod-server.c index a1f682765..6499c3f2f 100644 --- a/mesh/cfgmod-server.c +++ b/mesh/cfgmod-server.c @@ -1223,20 +1223,20 @@ static bool cfg_srv_pkt(uint16_t src, uint16_t dst, uint16_t app_idx, case OP_NODE_RESET: n = mesh_model_opcode_set(OP_NODE_RESET_STATUS, msg); - /* - * Delay node removal to give it a chance to send back the - * status - */ + + /* After reset, node is not processing any incoming messages */ + mesh_net_detach(net); + + /* Delay node removal to give it a chance to send the status */ l_timeout_create(1, node_reset, node, NULL); break; } - if (n) { - /* print_packet("App Tx", long_msg ? long_msg : msg, n); */ + if (n) mesh_model_send(node, dst, src, APP_IDX_DEV_LOCAL, net_idx, DEFAULT_TTL, long_msg ? long_msg : msg, n); - } + l_free(long_msg); return true; -- 2.21.1