Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp797528ybv; Wed, 5 Feb 2020 14:54:26 -0800 (PST) X-Google-Smtp-Source: APXvYqwc3ZUuwOjPW6G5ee98QXp4uNE+2FykI30IkmtRDgjd49sGst3twJVTp8AMiQ/eT9GJ6J8V X-Received: by 2002:aca:2112:: with SMTP id 18mr4538571oiz.155.1580943266418; Wed, 05 Feb 2020 14:54:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580943266; cv=none; d=google.com; s=arc-20160816; b=Sa0gSIYq9oXwr/bkUlZG3YjFd2inNUmaluoZOz0QpGhnAEN13ZSsrCB1ZONYEoCGrp ALVCExBUK/Allc7KyvQLyWFsYANpOq7VP3iQSMeHqm7K4G/Ogi05oFNWaeNYNHnYx8uk N22b6qcY2P/xMiOE/JIewL79hTITqDWsh1w5yuWUWwn8DaiRW48fCPwPa6aBsUB+02NK 3oW2qo8F1/Bsq6V4kQL+I13/hzuIfN73HvkwSdqra7Q4nzCDe+TLuEG7r5kkVaubGr24 n8KjzrOg9CB218nbiXDXF6U2r/54sbN79nCIEOFu1UQgQT6JcgpgBgvFlbc7D7+5uM6c JiYw== 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; bh=XC0nfJm+BtTRHhcJBMdMFyvyApSTrseM/4ZqP4UKjH4=; b=Kmxdr/BtOY87/3u47BUCC/p2MG1+rfklt99cBofrcqkhmeFAwi5wg4GGqD098zSkf3 p7xprnfdlGEq4c/mVJKkWvK/TuNC6DZ3kw4yckPtd4SzDmyY8hzLVZp5uHo48zweMaNs 3FPb+iJLfFas/4PwVeeDzy6TQcDwqZvXpwKNzsULWqr5H+GuPbblworfikNsS2z2CZbT suHdpCNC/aArMY2riyueF63b0ofNkMJH0x30PPfNwGyU4E3/LsZ5eBCmv4gI5ruY7uyX E5VwlEk6hJGV0WwqOcHsPQ7aHoDmNBg+qb5UObcRwwI2xtaQW0/AJdb/gHpcLzCDseuv D0VA== 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 y73si893054oia.246.2020.02.05.14.53.58; Wed, 05 Feb 2020 14:54:26 -0800 (PST) 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 S1727562AbgBEWxp (ORCPT + 99 others); Wed, 5 Feb 2020 17:53:45 -0500 Received: from mga09.intel.com ([134.134.136.24]:6172 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727355AbgBEWxp (ORCPT ); Wed, 5 Feb 2020 17:53:45 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Feb 2020 14:53:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,407,1574150400"; d="scan'208";a="264391692" Received: from ingas-nuc1.sea.intel.com ([10.251.142.16]) by fmsmga002.fm.intel.com with ESMTP; 05 Feb 2020 14:53:44 -0800 From: Inga Stotland To: linux-bluetooth@vger.kernel.org Cc: brian.gix@intel.com, Inga Stotland Subject: [PATCH BlueZ] mesh: Allow to finish key refresh when no AppKeys are stored Date: Wed, 5 Feb 2020 14:53:43 -0800 Message-Id: <20200205225343.6271-1-inga.stotland@intel.com> X-Mailer: git-send-email 2.21.1 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 handles a case when a Key Refresh procedure is in place with no application keys stored in the keyring. When KR procedure is finalized, the check for the presence of AppKeys storage directory does not return failure if the directory does not exist. Also, remove duplicate include. --- mesh/keyring.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mesh/keyring.c b/mesh/keyring.c index 41cb2e980..4a6f9f27d 100644 --- a/mesh/keyring.c +++ b/mesh/keyring.c @@ -24,10 +24,10 @@ #define _GNU_SOURCE #include #include +#include #include #include #include -#include #include @@ -166,7 +166,10 @@ bool keyring_finalize_app_keys(struct mesh_node *node, uint16_t net_idx) snprintf(key_dir, PATH_MAX, "%s%s", node_path, app_key_dir); dir = opendir(key_dir); if (!dir) { - l_error("Failed to App Key storage directory: %s", key_dir); + if (errno == ENOENT) + return true; + + l_error("Failed to open AppKey storage directory: %s", key_dir); return false; } -- 2.21.1