From patchwork Wed Jun 3 17:17:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sathish Narasimman X-Patchwork-Id: 196943 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38CE4C433E0 for ; Wed, 3 Jun 2020 17:14:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1669520674 for ; Wed, 3 Jun 2020 17:14:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AqIZdmER" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726182AbgFCRON (ORCPT ); Wed, 3 Jun 2020 13:14:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726046AbgFCRON (ORCPT ); Wed, 3 Jun 2020 13:14:13 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B8B0C08C5C0 for ; Wed, 3 Jun 2020 10:14:13 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id s10so2220814pgm.0 for ; Wed, 03 Jun 2020 10:14:13 -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=CuTW1YSo6SbIPQ+NugG8xNnabM9kKD5flh82Xdj9G2g=; b=AqIZdmERFi5Y3RTNmnlfaTFzw+mHC3sV9IZZQmeVtkfc7JAOWEyqTcnvfqTZskloHH ZFQ2B9p9hBZMQpah5RhFoOhMVv5JuWjsM//UUoYfEpW6SrOfMZgddyAtauSctTiAxK9W y5zT3y7hi97tMiS04YCJNXhAREml1hsWx0euIi7jAG2HWO33i30d/Ouy1TtSctrHHjkn ZwasvGy8ubqD+KFNusBjQPdTQxjBidoQWJzHL57ZuJmY1N6jdVW9YjGpy1jbtk8EsrjS RH3L47w9b56NjOlTY5bTUioQfBETcFjX6GFHlwlio1215m+Y2KJ1JL4dzc4TTvVvmclC 2gmQ== 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=CuTW1YSo6SbIPQ+NugG8xNnabM9kKD5flh82Xdj9G2g=; b=eRAdYvJEbcixQGIgxHP40UvBd9JFxAeAUQBJRVaSC2pHGtzdpiZZWNiZV7+j1hSiCx dncgqmVdNxPoR8mR4/YdU6MIJbLwmly9t00urWZ8q2a88U9t7PhYn66PbGB+J72pMA52 3eE893cVBWGuyeoQaKNWGNWBgkiNwMd74ga/e7dVUTXf0kl8eh55eCqKCXlc5h5Q/bJ9 L8YDBAtz/boPLHGtNPGcsRFHFpoAHdQnXbzGv7uwCMFpCwQvY1YEPoy3Y2xMia08iQMM nWLIYgPbKqOL9frxyFparxExg+MW0nNWLA+++4SAjzL6h6cfFbJ2qhjf/qqlw7CE086+ HPtg== X-Gm-Message-State: AOAM533Oz7W8zOX8lIDXgmU9ssLAPkmQODwZEFN69y/4x7acVdcXt6Wj OZvzE7BqF/iEFlZlEIKbJy3b0RsbzoQ= X-Google-Smtp-Source: ABdhPJwjJ10+cQMD+6dnq0Dknw1/gJZYKR1on9zzSONDk5w34DQFAdpbYlxP4k6fMHiIgh2WhbFP4g== X-Received: by 2002:a17:90b:252:: with SMTP id fz18mr866840pjb.96.1591204452769; Wed, 03 Jun 2020 10:14:12 -0700 (PDT) Received: from nsathish-Latitude-7480.iind.intel.com ([192.55.55.45]) by smtp.gmail.com with ESMTPSA id x190sm2016770pgb.79.2020.06.03.10.14.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jun 2020 10:14:12 -0700 (PDT) From: Sathish Narasimman X-Google-Original-From: Sathish Narasimman To: linux-bluetooth@vger.kernel.org Cc: Marcel Holtmann , Sathish Narsimman Subject: [PATCH v2 1/7] Bluetooth: Translate additional address type correctly Date: Wed, 3 Jun 2020 22:47:07 +0530 Message-Id: <20200603171713.9882-2-sathish.narasimman@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200603171713.9882-1-sathish.narasimman@intel.com> References: <20200603171713.9882-1-sathish.narasimman@intel.com> Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Marcel Holtmann When using controller based address resolution, then the new address types 0x02 and 0x03 are used. These types need to be converted back into either public address or random address types. Signed-off-by: Marcel Holtmann Signed-off-by: Sathish Narsimman --- include/net/bluetooth/hci.h | 6 ++++-- net/bluetooth/hci_core.c | 9 +++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 16ab6ce87883..1165dfea56a9 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -2268,8 +2268,10 @@ struct hci_ev_le_conn_complete { #define LE_EXT_ADV_SCAN_RSP 0x0008 #define LE_EXT_ADV_LEGACY_PDU 0x0010 -#define ADDR_LE_DEV_PUBLIC 0x00 -#define ADDR_LE_DEV_RANDOM 0x01 +#define ADDR_LE_DEV_PUBLIC 0x00 +#define ADDR_LE_DEV_RANDOM 0x01 +#define ADDR_LE_DEV_PUBLIC_RESOLVED 0x02 +#define ADDR_LE_DEV_RANDOM_RESOLVED 0x03 #define HCI_EV_LE_ADVERTISING_REPORT 0x02 struct hci_ev_le_advertising_info { diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index dbe2d79f233f..f4ceda1f1454 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -3145,6 +3145,15 @@ struct hci_conn_params *hci_pend_le_action_lookup(struct list_head *list, { struct hci_conn_params *param; + switch (addr_type) { + case ADDR_LE_DEV_PUBLIC_RESOLVED: + addr_type = ADDR_LE_DEV_PUBLIC; + break; + case ADDR_LE_DEV_RANDOM_RESOLVED: + addr_type = ADDR_LE_DEV_RANDOM; + break; + } + list_for_each_entry(param, list, action) { if (bacmp(¶m->addr, addr) == 0 && param->addr_type == addr_type) From patchwork Wed Jun 3 17:17:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sathish Narasimman X-Patchwork-Id: 196942 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A8AAC433E0 for ; Wed, 3 Jun 2020 17:14:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5B28C20674 for ; Wed, 3 Jun 2020 17:14:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="at5OV/Ap" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726187AbgFCROW (ORCPT ); Wed, 3 Jun 2020 13:14:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725961AbgFCROV (ORCPT ); Wed, 3 Jun 2020 13:14:21 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2358C08C5C0 for ; Wed, 3 Jun 2020 10:14:21 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id p21so2146419pgm.13 for ; Wed, 03 Jun 2020 10:14:21 -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=KNTecTNnvShK+jbDcWYwGt/NrIa6D+tmpxROB3vM6M8=; b=at5OV/Aphg1X15SJ6Eudv7cdLkdv7OEmmo396zQMsxOfwC/sWeS+XPG4o1UD0SzG6f o6Ukg+ZtxUln86oN8/N40G6gnwv0xDqRSHAn+kRg2JHsiL5dDDBFuDiEDMV2XJGgsCfu mYGTvXQBbgLWAlqgS2rSH8rmvtKjWoLjGVh9Yj6uKQQmz/IyQFUtyFfLeMd1FRfFV3mc iWdhW7r3GSeVXcaKl8wpsavS8HjBmJj5jsrdfsPqUxf7SWZl3Kl2ruS9Cwv4ZHK8kcWa 7RnFZLGn0Hn7iorgCT8l4sPvH6YgTQjsjW73IE2j7iJF3X+nsx3b2A0Zf6VdDSqOZMu5 5E2g== 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=KNTecTNnvShK+jbDcWYwGt/NrIa6D+tmpxROB3vM6M8=; b=F2Y72uy7ZSbUHkELxCnWqJuO2yyJxr8T/alTwy8oQ+tJToYiVm/Vo9kc7EXdip6zli GNarDLAPIWy/XEJnFazTd4ckujrZosFodYbnl+QlK7j8C+1U1Qc8MiUQJNVqGVr3mYur nIqpDQ8CIgTVYIhQizdNbBfiCIb1+3/RrjcEXXlw2bXQdphokUcIqmkvpS71ThvV49PN 81tWIcP9RqyLobIlY/cJBb+in+LhUwThCbiT1vThu3/hsFQNGicXMck+DhTJhIDX6AP6 UwOGtFocAorZkAqnPt8m7pwdNJexdg0Skdbq0fDU+UeGZ5kss1AWOBcM5TFA4OKCrOYH 0TTg== X-Gm-Message-State: AOAM530YwzG1DRhytowvGEAL0ESroe2P+DS2nzXkOzvhuJtUOrCaYKJh 6Dpp/rKzC/Ypy38Siaq2cD0/0NKBhbA= X-Google-Smtp-Source: ABdhPJzPrAn/CfCdGQdubXhoEHCkt0WT4eBfzj6FiObTSH+o1CLa/41tC0gU1QARYqsZ3WqDXKDR8w== X-Received: by 2002:a17:90a:aa83:: with SMTP id l3mr883420pjq.73.1591204460934; Wed, 03 Jun 2020 10:14:20 -0700 (PDT) Received: from nsathish-Latitude-7480.iind.intel.com ([192.55.55.45]) by smtp.gmail.com with ESMTPSA id x190sm2016770pgb.79.2020.06.03.10.14.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jun 2020 10:14:20 -0700 (PDT) From: Sathish Narasimman X-Google-Original-From: Sathish Narasimman To: linux-bluetooth@vger.kernel.org Cc: Marcel Holtmann , Sathish Narsimman Subject: [PATCH v2 3/7] Bluetooth: Update resolving list when updating whitelist Date: Wed, 3 Jun 2020 22:47:09 +0530 Message-Id: <20200603171713.9882-4-sathish.narasimman@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200603171713.9882-1-sathish.narasimman@intel.com> References: <20200603171713.9882-1-sathish.narasimman@intel.com> Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Marcel Holtmann When the whitelist is updated, then also update the entries of the resolving list for devices where IRKs are available. Signed-off-by: Marcel Holtmann Signed-off-by: Sathish Narsimman --- net/bluetooth/hci_request.c | 41 +++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c index 1d885ccd5419..bcd64dec9989 100644 --- a/net/bluetooth/hci_request.c +++ b/net/bluetooth/hci_request.c @@ -695,6 +695,21 @@ static void del_from_white_list(struct hci_request *req, bdaddr_t *bdaddr, bt_dev_dbg(req->hdev, "Remove %pMR (0x%x) from whitelist", &cp.bdaddr, cp.bdaddr_type); hci_req_add(req, HCI_OP_LE_DEL_FROM_WHITE_LIST, sizeof(cp), &cp); + + if (use_ll_privacy(req->hdev)) { + struct smp_irk *irk; + + irk = hci_find_irk_by_addr(req->hdev, bdaddr, bdaddr_type); + if (irk) { + struct hci_cp_le_del_from_resolv_list cp; + + cp.bdaddr_type = bdaddr_type; + bacpy(&cp.bdaddr, bdaddr); + + hci_req_add(req, HCI_OP_LE_DEL_FROM_RESOLV_LIST, + sizeof(cp), &cp); + } + } } /* Adds connection to white list if needed. On error, returns -1. */ @@ -715,7 +730,7 @@ static int add_to_white_list(struct hci_request *req, return -1; /* White list can not be used with RPAs */ - if (!allow_rpa && + if (!allow_rpa && !use_ll_privacy(hdev) && hci_find_irk_by_addr(hdev, ¶ms->addr, params->addr_type)) { return -1; } @@ -732,6 +747,28 @@ static int add_to_white_list(struct hci_request *req, cp.bdaddr_type); hci_req_add(req, HCI_OP_LE_ADD_TO_WHITE_LIST, sizeof(cp), &cp); + if (use_ll_privacy(hdev)) { + struct smp_irk *irk; + + irk = hci_find_irk_by_addr(hdev, ¶ms->addr, + params->addr_type); + if (irk) { + struct hci_cp_le_add_to_resolv_list cp; + + cp.bdaddr_type = params->addr_type; + bacpy(&cp.bdaddr, ¶ms->addr); + memcpy(cp.peer_irk, irk->val, 16); + + if (hci_dev_test_flag(hdev, HCI_PRIVACY)) + memcpy(cp.local_irk, hdev->irk, 16); + else + memset(cp.local_irk, 0, 16); + + hci_req_add(req, HCI_OP_LE_ADD_TO_RESOLV_LIST, + sizeof(cp), &cp); + } + } + return 0; } @@ -772,7 +809,7 @@ static u8 update_white_list(struct hci_request *req) } /* White list can not be used with RPAs */ - if (!allow_rpa && + if (!allow_rpa && !use_ll_privacy(hdev) && hci_find_irk_by_addr(hdev, &b->bdaddr, b->bdaddr_type)) { return 0x00; } From patchwork Wed Jun 3 17:17:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sathish Narasimman X-Patchwork-Id: 196941 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7DA02C433E0 for ; Wed, 3 Jun 2020 17:14:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6071720738 for ; Wed, 3 Jun 2020 17:14:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kNnwPTbk" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726229AbgFCRO3 (ORCPT ); Wed, 3 Jun 2020 13:14:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726226AbgFCRO2 (ORCPT ); Wed, 3 Jun 2020 13:14:28 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1D36C08C5C0 for ; Wed, 3 Jun 2020 10:14:27 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id y18so1034192plr.4 for ; Wed, 03 Jun 2020 10:14:27 -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=6CBbZ9r4eSiZUUGFyvEEYED4UFptLRNF6sdTCpICb7Q=; b=kNnwPTbkTH46n95zn6hqziBPVM9wJFJVDrlvB+FxTPIyAc9TOVwb+UNRfGqNMV2QIU CncI3fX2YD6bTDnXllyfK6l1io5jNo3NppNCdphijC8YuzAbFNyfDzYfylygKasCa/Pb zYnFH2aTwlfIQUD24EmQJkRm1I0JvXYrpgUt1KKlZqi4eFdZF4HUtAfJlVdWX8xHRjSh zkcrnsfTWw/w2wYDlVmBGi8aXdtaLpNLh0ExGot+5Rzlm8Mwwafcl2j8+9PIdpnWc+sN DhVOZYKINf1K1NDpXkfTZeTNEf0P+oqaq6qgrhdNhOOgi8CwmEJ+ltTTZGAIfDZpDZvN OXOQ== 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=6CBbZ9r4eSiZUUGFyvEEYED4UFptLRNF6sdTCpICb7Q=; b=VCipTPZgMzQbHw7dVSYLLVwevfXXC+Rh7Za6PidvnONORVVaYYa1w88k+js5+BcMDt TbW+V7eV9OoT1chZUBpOCnOzb29JpY90vo/5SPTNmP++poH9g4qtpgwkrNCOytlGWf/2 7kH5FOxKZ7dzSH97VC6ymK6nkv/w7jldJLwcXQUg5C5vNruVhUT4OHWOq1Vmz3Q/xnEt oQNIvT4CnckiGP0utPi3F69BUyBSs0f1bWWRWNDe/Vd5I6SBGxj2vs3ngrtxulcdWCgP ckWchN8E6Ze0xn0XXCsxei1lxhBnG7pLJdm4BMlO0sTL7775SpqW5HG2wU80HeF46l0c j8kQ== X-Gm-Message-State: AOAM53383vNsM/Dy6iI+blPaVF2mMF1xjMn1cP/tEhoKASm21IRFmVV0 DMgU8jAyIodbbPpPmRnqOIvNPNabNYs= X-Google-Smtp-Source: ABdhPJzEoahzou9bcXCE8PRgshFSFajcc0GSz9qsT5E2PhEjJHvjcFK9WPTQNEo+srKK/gKmRzGP/Q== X-Received: by 2002:a17:902:7682:: with SMTP id m2mr819735pll.281.1591204467230; Wed, 03 Jun 2020 10:14:27 -0700 (PDT) Received: from nsathish-Latitude-7480.iind.intel.com ([192.55.55.45]) by smtp.gmail.com with ESMTPSA id x190sm2016770pgb.79.2020.06.03.10.14.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jun 2020 10:14:26 -0700 (PDT) From: Sathish Narasimman X-Google-Original-From: Sathish Narasimman To: linux-bluetooth@vger.kernel.org Cc: Sathish Narasimman Subject: [PATCH 5/7] Bluetooth: Let controller creates RPA during le create conn Date: Wed, 3 Jun 2020 22:47:11 +0530 Message-Id: <20200603171713.9882-6-sathish.narasimman@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200603171713.9882-1-sathish.narasimman@intel.com> References: <20200603171713.9882-1-sathish.narasimman@intel.com> Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org When address resolution is enabled and set_privacy is enabled let's use own address type as 0x03 Signed-off-by: Sathish Narasimman --- net/bluetooth/hci_request.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c index bcd64dec9989..6e1036cc8b1e 100644 --- a/net/bluetooth/hci_request.c +++ b/net/bluetooth/hci_request.c @@ -2183,7 +2183,13 @@ int hci_update_random_address(struct hci_request *req, bool require_privacy, if (use_rpa) { int to; - *own_addr_type = ADDR_LE_DEV_RANDOM; + /* If Controller supports LL Privacy use own address type is + * 0x03 + */ + if (use_ll_privacy(hdev)) + *own_addr_type = ADDR_LE_DEV_RANDOM_RESOLVED; + else + *own_addr_type = ADDR_LE_DEV_RANDOM; if (!hci_dev_test_and_clear_flag(hdev, HCI_RPA_EXPIRED) && !bacmp(&hdev->random_addr, &hdev->rpa)) From patchwork Wed Jun 3 17:17:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sathish Narasimman X-Patchwork-Id: 196940 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE814C433DF for ; Wed, 3 Jun 2020 17:14:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CC21F20674 for ; Wed, 3 Jun 2020 17:14:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fiFDCuvx" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726238AbgFCROe (ORCPT ); Wed, 3 Jun 2020 13:14:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726236AbgFCROe (ORCPT ); Wed, 3 Jun 2020 13:14:34 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0ACFBC08C5C0 for ; Wed, 3 Jun 2020 10:14:34 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id o6so2206058pgh.2 for ; Wed, 03 Jun 2020 10:14:34 -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=C5aGJDCTVUf27Q5D9JDTfavbwDNrp4VfqXTMY6QGNOA=; b=fiFDCuvxKqGHpKKO+MMyLyDL5EKslBQuoC5iZdAkp0GX3he7E5Xi6+6MlM6Uzikhvv DFaFPljD77rPgL29PUjFOj/rIk/hAnvCl1bVjWONpMzbNJpcmc+ZnonfnKLhTilZD/e0 TUnzS32K0CaclBAq8eurabFa7Yy6PpWSwGdITZfUcaN25bi0BCWbjHIK9df0/EscmBEp oSEtpl5qaGaGEDNllirEhLt90QzBaj1/fJP5NpOnG3ju+DUUplFx/ofUEnN8oU81MuS3 fRv2+s3WHPbD9st1rzKxJ054ngXLDGAzeEIGzzCxqx/yifaXDaxzQgQIAYHPw3NvKRMS 2ndQ== 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=C5aGJDCTVUf27Q5D9JDTfavbwDNrp4VfqXTMY6QGNOA=; b=i1A0JrS1n30eQyqxfoHD6CSFozTuSClqYhYxClVPUqFg1tW2flcRU4dlJ8atqFbl61 1zuePI6TcdmFJnZr3RzVSb1qI007F448WerpZpFxLV7gZ4T7ex5Bv/bXv97FujW0C0Rz belruLKxYfQliRDMVG+fZ5/l70pu+lB58/OA9/XYeSb9d6xtGA8cMi82W2G1v2Dcpw/C 4MIDYQoORc0Icw7na2LzI0KM/Z20r6jiTYUK0fgkdDTHxwB0K/LtxgM3hPRRqzt/V6Ww PXJUvq/axFmu2wqUq++OyebyHrRTKpDhKu2SDj6u6JuPBOs2bjJq4BU/+3S7wyVwkPYo hFYA== X-Gm-Message-State: AOAM532h7WPRSfgpttdX/m0tA3vEMHWGfIOsS+XA3mJJTFvV3ZyKKjrM tGpg/S/rHJmZlfqhe/6E+UurWQdGbyI= X-Google-Smtp-Source: ABdhPJwFisMy2dylIof5pK6pv7bFWp3eV4AqsrdmCEQXfbwb5rs+INtIRYwZLPVx/zFMR+cBheUx3A== X-Received: by 2002:a17:90b:23c8:: with SMTP id md8mr1002099pjb.72.1591204473343; Wed, 03 Jun 2020 10:14:33 -0700 (PDT) Received: from nsathish-Latitude-7480.iind.intel.com ([192.55.55.45]) by smtp.gmail.com with ESMTPSA id x190sm2016770pgb.79.2020.06.03.10.14.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jun 2020 10:14:32 -0700 (PDT) From: Sathish Narasimman X-Google-Original-From: Sathish Narasimman To: linux-bluetooth@vger.kernel.org Cc: Sathish Narasimman Subject: [PATCH 7/7] Bluetooth: Enable RPA Timeout Date: Wed, 3 Jun 2020 22:47:13 +0530 Message-Id: <20200603171713.9882-8-sathish.narasimman@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200603171713.9882-1-sathish.narasimman@intel.com> References: <20200603171713.9882-1-sathish.narasimman@intel.com> Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Signed-off-by: Sathish Narasimman --- include/net/bluetooth/hci.h | 2 ++ net/bluetooth/hci_core.c | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 1165dfea56a9..12005fbe6e09 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -1637,6 +1637,8 @@ struct hci_rp_le_read_resolv_list_size { #define HCI_OP_LE_SET_ADDR_RESOLV_ENABLE 0x202d +#define HCI_OP_LE_SET_RPA_TIMEOUT 0x202e + #define HCI_OP_LE_READ_MAX_DATA_LEN 0x202f struct hci_rp_le_read_max_data_len { __u8 status; diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index f4ceda1f1454..67e1434c3f31 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -763,6 +763,14 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt) hci_req_add(req, HCI_OP_LE_CLEAR_RESOLV_LIST, 0, NULL); } + if (hdev->commands[35] & 0x40) { + __le16 rpa_timeout = cpu_to_le16(hdev->rpa_timeout); + + /* Set RPA timeout */ + hci_req_add(req, HCI_OP_LE_SET_RPA_TIMEOUT, 2, + &rpa_timeout); + } + if (hdev->le_features[0] & HCI_LE_DATA_LEN_EXT) { /* Read LE Maximum Data Length */ hci_req_add(req, HCI_OP_LE_READ_MAX_DATA_LEN, 0, NULL);