Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp663247ybg; Wed, 3 Jun 2020 10:16:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxm4Cvp9h4pL21GPPcI3PP2+gJgkKDPheoBtSJRijP4lGoqaXaUWDWvSVtv4MhYwxm+dqKU X-Received: by 2002:a50:9d83:: with SMTP id w3mr423473ede.95.1591204596246; Wed, 03 Jun 2020 10:16:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591204596; cv=none; d=google.com; s=arc-20160816; b=mo9xAaibYHy9CspUgoInvhFDDeMV6tlRYCcMt9llpXwekImpOIeTC+BNN8+/NfHRYC DbRrzzswF82dMVlDLnsWdrK9Ns6Iq2PjhJpu6q3o40a0+iLRVdtlqSWQ5ExuCznSucFR s3NlqHKeFo0tMl0fY7nW8Vy+wElchdwp/RHHU1jrX/YNVcr/KS5HK36FGGM3ou8RqWxW CLJ2uqxsem7zPi7gkqSNYjwe0KNbV+BIxL1Tc1qF06N0V94x0ZDfLosJzkCcDsiGRwAP OE6XxkN2ggcXQXbBLulPCqkgemjWunBptNTAX0QjCpq65zSF0pl2kZ9GBqJcocTczf5M lEHA== 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=CMCpsHUTNz4uoieqPTxZU+bogZX6IL51BPCrwDaWeJ4=; b=jF+ZrgAaxOQ3sTxbWd4vO55Y89KshkNFjJ4O9LiAonZHcdnEiUfMYFHW6ToFe3/AN3 j+7meZYampuLgQai/zOT36CVHAABjMSXqdQn6Sffl9JQbe5uzgE5n6QhmjnEbxZwhH9/ qDPjdiTpA0Kj6dEuCJmGU3J/KLE6fk/bVXpj97xr31S+WzVqOQdg4pP7yFtiKyu8BVxc /Zmh97rO0WBSISVsVCIvhltpWRsAww7zx77SiMpZzMtJFjB765mPfwRmZgWzlEkxv6lP xb7SzjCwIukwrnKfzNLsQQKrqCbaXNv64tEP4DCgvMLEl9lylY0JaXJWkQRwdc4EoK2n /w+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hIL0DyWK; 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 r3si98721edq.265.2020.06.03.10.16.12; Wed, 03 Jun 2020 10:16:36 -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=hIL0DyWK; 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 S1725961AbgFCRQG (ORCPT + 99 others); Wed, 3 Jun 2020 13:16:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725956AbgFCRQG (ORCPT ); Wed, 3 Jun 2020 13:16:06 -0400 Received: from mail-il1-x141.google.com (mail-il1-x141.google.com [IPv6:2607:f8b0:4864:20::141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76FDAC08C5C0 for ; Wed, 3 Jun 2020 10:16:06 -0700 (PDT) Received: by mail-il1-x141.google.com with SMTP id z2so3296500ilq.0 for ; Wed, 03 Jun 2020 10:16:06 -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=CMCpsHUTNz4uoieqPTxZU+bogZX6IL51BPCrwDaWeJ4=; b=hIL0DyWKlyYLBQlEfashDCo6q/pclt1ZtHXAWa6nZyTTj/jga47K5ghpl4JPdU7NT4 uH2t6DejbtsyBPjsXKvMTFcAeCMaN2IrollezojBQQLDjfgkl4SffjE8HcUuHFtrmYs7 yOU+jnmjpoWojqs/Zco7ZgsR+HTIEqK0GrUa03gGzUKyyYOhfp40yYnSEaUo2QfdjcFC Dq44P2uzy8CQPfY/LoldMNS6XvkBfk880qLxtE9CXPX3JPaRWsqtBXuW28ZouCmk9hiT 2U6U4EJ7R1FFLT+Lwg5kCkIscBtISmd2javPLlj175vEPna2BXhy3utz3cZO2v3kz/9r 0fRA== 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=CMCpsHUTNz4uoieqPTxZU+bogZX6IL51BPCrwDaWeJ4=; b=fdmXwzX6nwOot7Taru5XzD+9qNp7gUL34dr6YbIwq1beq2xRG25HTDnwYVJiwwPlep jYVWvIxncIgXqIPe0b5B7zUnf53zFWoVsIDz1nrVOh4vmi7ZjG0za0RoeqlTacOUUC0Q dpHn6S4WAk76QyO0SJ5ej8aBeRr6peatsMeWWz1hKsOmzu7pjJnF8H8XDYM2jonsafkS 9izlgDFLTyi4ufZYCCQXQDZzOsX0B1+QlV5d+NRwiyOFV7U/gMq37qd/ET2Vp3OlHzP/ 6XU+WTCV7qy/xyon6NGcjc70UcNyqvaMt75YK0iw0yck7B8tLbyn0EHHc65Ns/xlTvmz Ty1Q== X-Gm-Message-State: AOAM531s5ynGJR8kdJqe7gVoixixUegXizvvqryQO3WVEVaAUiQuPRlK YYuSni2cbqjNIf/z4rEf7HlOfWek4752zEVvWYjptUkzlA0= X-Received: by 2002:a92:de41:: with SMTP id e1mr491988ilr.199.1591204565832; Wed, 03 Jun 2020 10:16:05 -0700 (PDT) MIME-Version: 1.0 References: <20200407205611.1002903-1-marcel@holtmann.org> In-Reply-To: From: Sathish Narasimman Date: Wed, 3 Jun 2020 22:45:54 +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 Tue, May 5, 2020 at 6:41 PM Sathish Narasimman wrote: > > 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 > > I have uploaded patch v2 with a slight modification over your patch. can you please review > > Regards > Sathish N Regards Sathish N