Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp344439ybh; Thu, 12 Mar 2020 03:07:45 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvRprKp8tm7yUrPq71rW+3bRFH+ZztW34qiL6jHgCiQ7fqkdtdWwPttKdXsyuYfB7lhIo/8 X-Received: by 2002:a9d:4c5:: with SMTP id 63mr5488518otm.138.1584007665530; Thu, 12 Mar 2020 03:07:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584007665; cv=none; d=google.com; s=arc-20160816; b=ZgAis6kFlbRg4azCzl9//J0WouohHk2QZNxpHU4H7MQcWYKeLCPaNcZH6iNo75SdSO hP25Xak7mH4K0sWQZPVeVocnS8fCJP9UZ52qvtOjriopS+fxSlt7EAoWPtcvsVGQF7Gk 3uMRJDLW9WwCKrXcqSLMQGQW1nJvdc0kuJ7rxc+zVaaalml0bhMsUjSm/ZT/YuXEJ1kx U8kIzOPUZ0P4TKqxl8+hJxLS8qEiwgTwxL4P+MBbAJjw0r6YwagmYKhFJcqhGTWjE3fj T3LWNvE88dcTCWqAVx3wW8FTL5/eOXVH24gQtI/y3PI6iHPE3xSExfr9EeRpbKfNUTG3 m4BA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=4zBwx/dz5Yma+kmqRs4Q3CZ2L+oCkvmiphJfnBmSHoc=; b=gHqARKT9cjRVfnWWHppRfQFkAyoLrbil1JWbTg/+nUBzLe0EJgCVWHEmgOmyt7hXml 46dyNSt9iPdiRElctpQcwt5KqY24yIqK+jbjXCO5Zrjab/Z+49AEnLMavTlcJ4aUtwkL SRMTaWywZcAikgsZGRvo2PtC4sjzf34VVbYuXfgAqNg/5cXl6zsFLwu+O8Zx8KhKgN74 DuiPVxokCYpbDlCdNPOO55dVkG0jD13LY26FlZXFIMZhH3m41wpDi2GIvSCUqvLLtTlA CoqhiUEm8pnxDRlDFDDAWPYH3rVcLmvXJObzZpdVlim60Eq05BAy2wPKlYJavPDEDz97 Lwsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KTxOM3hq; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l12si2549175otn.101.2020.03.12.03.07.33; Thu, 12 Mar 2020 03:07:45 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KTxOM3hq; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726718AbgCLKHG (ORCPT + 99 others); Thu, 12 Mar 2020 06:07:06 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:43494 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726028AbgCLKHG (ORCPT ); Thu, 12 Mar 2020 06:07:06 -0400 Received: by mail-pf1-f194.google.com with SMTP id c144so3019450pfb.10 for ; Thu, 12 Mar 2020 03:07:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=4zBwx/dz5Yma+kmqRs4Q3CZ2L+oCkvmiphJfnBmSHoc=; b=KTxOM3hqnqbjZqty/iuu7ACE4GoqjlVc3uOc53AEBD7EC1GP2rqCbVZ4dHRpxfGc+/ 9Pc/zYgwknjSJ+5/q+OsFURpaiJy9B+cI0GrQWvWzZdDQR/WR+VliiG7mLcUIjm5IRZL oHjbxdtHd1DW5SgZNe/B1FkQ64/I+ITonr42rgPJBM6P0/2m1diMSjuP3bsLAW6tA0xo mipBPjN66MMOwuY/oqrlZc2bzLEpThVqpHDYnXZnkOCyhVyTE0lzqMQek2vuIkrzNOsb XXtcB/APSOhj5O7e9v2sVXFYM8ZacwzwqAgbG/9v2c5x5EvMl5fs+PT8OIwUytJUtQ7o YRNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4zBwx/dz5Yma+kmqRs4Q3CZ2L+oCkvmiphJfnBmSHoc=; b=UL0CkN/EDAECsZEE55Pv/ccJgh4gAEv/o0GfLwT5XuKoTo3Dp0jlSZMbY7QA+HuMSf frJc+ybp1FjMhIUriqwx1VuBmfxIdpF07dqV+cZQkp5ULt3OhZx2Rwy+Dr02TBYNRG4I WAg90ma4KVCw6eHC3BzvEPJFNcraE0bpJprEAS2XegkSWriTUV4uYqriVYD472aZs6qC PRLcLy9mWTXJVKZuZpoBFcnPw3AVyNqbYe9J0jURJu3KRv7sYx7yrtUeWWu4jQBrHtpW TSUBZ6oRanXW4N5pIAtwwHaD4OFouvgu7i8+CobBUXRaqxkvU1hjuOm41uxa+lydmPH1 3wbQ== X-Gm-Message-State: ANhLgQ35JTdYtke3YnLm0Bcx0lAYFMj9Cbw0R8Yr4uZzwx8PQyBHxchy NVKLIGFTTJYxUAjqDANfmcyESee7W+F9mQ== X-Received: by 2002:aa7:9482:: with SMTP id z2mr2656007pfk.147.1584007624679; Thu, 12 Mar 2020 03:07:04 -0700 (PDT) Received: from nsathish-Latitude-7480.iind.intel.com ([192.55.55.45]) by smtp.gmail.com with ESMTPSA id e9sm10578295pfl.179.2020.03.12.03.07.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Mar 2020 03:07:04 -0700 (PDT) From: Sathish Narsimman X-Google-Original-From: Sathish Narsimman To: linux-bluetooth@vger.kernel.org, nsathish41@gmail.com Cc: chethan.tumkur.narayan@intel.com, Sathish Narsimman , Joy Shermin Subject: [PATCH 4/7] Bluetooth: LL_PRIVACY re-load resolving list Date: Thu, 12 Mar 2020 15:37:51 +0530 Message-Id: <20200312100754.3445-5-sathish.narasimman@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200312100754.3445-1-sathish.narasimman@intel.com> References: <20200312100754.3445-1-sathish.narasimman@intel.com> Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org The patch is used to load the entries in the local IRK to the Bluetooth LE controller resolving list. Signed-off-by: Sathish Narsimman Signed-off-by: Joy Shermin --- include/net/bluetooth/hci_core.h | 1 + net/bluetooth/hci_request.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 43d31a9339a6..46d2d3e10c97 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -1659,6 +1659,7 @@ void hci_copy_identity_address(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *bdaddr_type); int hci_req_update_resolving_list(struct hci_dev *hdev, u8 addr_type, bdaddr_t *bdaddr, u8 irk[16]); +void hci_load_resolving_list(struct hci_dev *hdev); void hci_req_update_resolving_list_local_irk(struct hci_dev *hdev); void hci_req_del_from_resolving_list(struct hci_dev *hdev, u8 addr_type, diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c index 9ffb62178d24..e17db3103a3d 100644 --- a/net/bluetooth/hci_request.c +++ b/net/bluetooth/hci_request.c @@ -1015,6 +1015,35 @@ void hci_req_update_resolving_list_local_irk(struct hci_dev *hdev) hci_req_run(&req, NULL); } +void hci_load_resolving_list (struct hci_dev *hdev) +{ + struct smp_irk *irk; + u8 num = 0; + + /* Nothing to be done if LL privacy is not supported */ + if ( !(hdev->le_features[0] & HCI_LE_LL_PRIVACY) ) + return; + + if ( !hci_dev_test_flag(hdev, HCI_LL_RPA_RESOLUTION) && + ( hci_dev_test_flag(hdev, HCI_LE_ADV) || + hci_dev_test_flag(hdev, HCI_LE_SCAN) || + hci_lookup_le_connect(hdev) ) ) + return; + + /* Load the first le_resolving_list_size entries from IRK + * list in to resolving list. + */ + rcu_read_lock(); + list_for_each_entry_rcu(irk, &hdev->identity_resolving_keys, list) { + if (num++ >= hdev->le_resolv_list_size) + return; + + hci_req_update_resolving_list(hdev, irk->addr_type, &irk->bdaddr, irk->val); + } + + rcu_read_unlock(); +} + void hci_req_del_from_resolving_list(struct hci_dev *hdev, u8 addr_type, bdaddr_t *bdaddr) { struct hci_cp_le_del_from_resolv_list cp; -- 2.17.1