Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp685247ybj; Tue, 5 May 2020 06:12:39 -0700 (PDT) X-Google-Smtp-Source: APiQypLu042+Zyt3BzCBBcsB8qqFYXb4AyYZDG5x/nATd1Ef5lK7hK2AcKCBNU1VU6GFfd+dZEO/ X-Received: by 2002:a17:906:7ac8:: with SMTP id k8mr2587984ejo.235.1588684359293; Tue, 05 May 2020 06:12:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588684359; cv=none; d=google.com; s=arc-20160816; b=st3cPefgOR/LlJbdMW1rvBI4Lm2j6DXkLEq16b6zOEq4zXmobSH5twmt5dA0CB1g0l rP8RRHFFmvUXR7xrVlJ5FS3ojdNJEoerOEzAdqVXGsrc4e9WTCu8UQySgza04NhApQIl OldX8jB0t/M0I6t5MTq58RtriqYPKVSCKKzzWmO9wADgUpFX+fEiEKV0gGILRPXNOQ9n Tc7pTfd8MGRL7NgQIOYfIlCS6nTHkbB1GqKLucg5W88Qm1cMjK5cLQKVMqFGfm6eOvY+ d37ZEBoj69ZqtZFAkuE/xaQgzlx8yYRMvHskDpcd21zQwmorN2EtrQFo32TQGFTyp5kR WdOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=fucoW5ujao0zyyC4glJlshqMypspuFgK8KKeUM/axD8=; b=nyIZoU16Ky8WwdUkhaaWFtuhWFqQu7jp/VaG+xccacmT0r+D2PVwgnaRVyfJ9GR66Q TYRVkYyPc+G8YKBWRLA/iHfos61xIIE3jXzNUJoBpNuVtd4muGTQ4LBZRV3f82EBWM0O RD3q1k0UccD6voDzL25Rv6YsAisehG2tYqkgnj/+LDeXI1bDolxw2Tw1ovWQUH7HsDgh EZMEsB3W/p9b2dyugcYiGNUay3TRvfSb6+YR3LYs923TjZUdMGFBt1CN3/TTmYzUJpFF 1HIG5c0asGJ/XNMnyQI+ou7rBw3nJVTi+tKXYXSK+PMp48G4HtDEHWYLGHD19tKf1EoB z4ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=M5SkHhDF; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x61si1190851ede.23.2020.05.05.06.11.51; Tue, 05 May 2020 06:12:39 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=M5SkHhDF; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728608AbgEENLv (ORCPT + 99 others); Tue, 5 May 2020 09:11:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728512AbgEENLu (ORCPT ); Tue, 5 May 2020 09:11:50 -0400 Received: from mail-il1-x142.google.com (mail-il1-x142.google.com [IPv6:2607:f8b0:4864:20::142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E232C061A0F for ; Tue, 5 May 2020 06:11:50 -0700 (PDT) Received: by mail-il1-x142.google.com with SMTP id q10so805086ile.0 for ; Tue, 05 May 2020 06:11:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=fucoW5ujao0zyyC4glJlshqMypspuFgK8KKeUM/axD8=; b=M5SkHhDFXRUpLu645obwIQ8mvwOtG9iX00vtntluBLJoN0RaMTf8ghGMljPu+xi+TC liLCkG8QKSv+eP98m1lYf8ySJApVO1SdzdRcYrXjAYUayoG613JWbJhoPPTAtZuFRJzX ZICsErd4HWMVK4pCCiVil9Ez5bQeAL44conV1mGtW60zvl/k605RvabqeeraLnF1MDNb PQYCx2MJeNC1CJrj1fRnMMSg0tPmgbvG5K9NfW/vJElxaRaPbhah2AZph7dLPYv4tzyY 1kzKuGGoCm9bnZI+aJDNUAfNjpNSAnyrsul53Zh/zK1ZtR4NOYUsNJmREI4WvZepNHQa 9ONQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=fucoW5ujao0zyyC4glJlshqMypspuFgK8KKeUM/axD8=; b=TLiGLHAPeocBtivJlDoZdQdd6xNO96l1KyRruROq0i+xeCN+dCpWvpe+6odTnSi9jo pCerOs/HEZ8qAk53UhszUkC8kgjbxiCJhM5GJargIp3qXZ9g8Hx0rCN+4Ydoj8eWfLIE TbbkaZaqHDIorFaVSQDUGwaZ6D3uJJ4N3M8RQuFptq/MCi2Ixw8XK6T+GaGH0bvmLZgj sLAE9F1B7U8Y8lWjkEKou8QezqirCw7mRbK3EmvNhY8WrFz+vY00dvBUHUEwoJFLJ7zr BW7ZrvLKSKYg+xngRXT20CxAyojNv42U+WAVRpPFyCKcGyIyYLjMYuYHDzQHLdBc2Oxg HPpQ== X-Gm-Message-State: AGi0PuYZCWvYJOwAHTfgyqQACVhTM3DN/zbktZxSBC9jHGae8ClpLrw9 tJoQmopv4G+QfP1RCyfDnmUPmEJeg+ThzTK56zZgBTj7 X-Received: by 2002:a05:6e02:f45:: with SMTP id y5mr3485408ilj.199.1588684309656; Tue, 05 May 2020 06:11:49 -0700 (PDT) MIME-Version: 1.0 References: <20200407205611.1002903-1-marcel@holtmann.org> In-Reply-To: <20200407205611.1002903-1-marcel@holtmann.org> From: Sathish Narasimman Date: Tue, 5 May 2020 18:41:37 +0530 Message-ID: Subject: Re: [PATCH] Bluetooth: Update resolving list when updating whitelist To: Marcel Holtmann Cc: Bluez mailing list Content-Type: text/plain; charset="UTF-8" Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Marcel On Wed, Apr 8, 2020 at 2:26 AM Marcel Holtmann wrote: > > 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 > --- > net/bluetooth/hci_request.c | 37 +++++++++++++++++++++++++++++++++++-- > 1 file changed, 35 insertions(+), 2 deletions(-) > > diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c > index efec2a0bb824..45fbda5323af 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,24 @@ 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); > + memset(cp.local_irk, 0, 16); Shall we memcpy hdev->irk as local_irk here. if privacy (HCI_PRIVACY) is enabled. also if controller supports LL_PRIVACY so that stack can utilize it. else continue with HCI_PRIVACY. Is there any drawback with this approach. please guide > + > + hci_req_add(req, HCI_OP_LE_ADD_TO_RESOLV_LIST, > + sizeof(cp), &cp); > + } > + } > + > return 0; > } > > @@ -772,7 +805,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; > } > -- > 2.25.2 > Regards Sathish N