Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp55096ybb; Tue, 7 Apr 2020 16:43:49 -0700 (PDT) X-Google-Smtp-Source: APiQypLfS0QZ7Pk/bvfyjs1HXMnqysdzbnGsgMXWVVh8ZNZchTOLuidLMo/oKFyeWwjuYy3dZZvc X-Received: by 2002:aca:f02:: with SMTP id 2mr514145oip.4.1586303029617; Tue, 07 Apr 2020 16:43:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586303029; cv=none; d=google.com; s=arc-20160816; b=uSbkkCie+CA6W+e3Ta/mEH+qP9Tf8QFaQgqSvvGPXn26EPdnaURSMyxdXNfoYutAY0 Q8+KQ/2ST+ynoi0rh4H24YLZMtcUhKWziksnDU9P4llfcKVeB1qbnVkNqfNdVy3ZnHE9 UJY/Df5t3EgFPHS+kW+xoulJ2LYWkz7OmrpY9vd8TzadchNhGX3yQx2e+37bLsWFtOOE aFA6xQWyH2kcaRP/MVzV9ewqtim8cxc4yLIlmH1cEWf/KDCvTXzx5AUuSJoOsnsy5WEg pyYSgw38U1lEBlcjkCw62+9PHeih5zoabelq1QvZRzIsIv7Fp5ydgheP1PYAM6cvACVY XXXA== 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=B5sjHFFsxbku6QcEI+FyhoEB+p/8KKsAmGhEW48J20A=; b=dkM11MYTZKcTITWmPp6HtmXBmRtwgpV8VHdya6xVXNTCREzaawhDxWWqr0oseP3//q yXRoIwYrkhHTQkfowqsUoL8kpASysq/q9W6OGqSGOlOHoDEqAMdQOe4dCeuOv3FUIKJ1 aeDL48naCZ2fdxfKqQPy3955ylvoZa0dvjtOBQF8QcXpXTGpaX2IEymPfLH2k1QluQYB k6W6FdQzu0ZLnQdS3Hs2ahfW7YscZ0LYisyBssH6Zax8EPrwmo7LKsuuHvV0tD73qlPh x55mxP89iwQBKIysmqRdJBKGufShz6CH5XKwG14q6n2P2iYEQhzfMuDbYoug7E7OOXuc 9NaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=c8xasDmO; 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=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 97si714759otq.185.2020.04.07.16.43.26; Tue, 07 Apr 2020 16:43:49 -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=@chromium.org header.s=google header.b=c8xasDmO; 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=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726406AbgDGXnW (ORCPT + 99 others); Tue, 7 Apr 2020 19:43:22 -0400 Received: from mail-vs1-f66.google.com ([209.85.217.66]:41312 "EHLO mail-vs1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726386AbgDGXnV (ORCPT ); Tue, 7 Apr 2020 19:43:21 -0400 Received: by mail-vs1-f66.google.com with SMTP id a63so3591917vsa.8 for ; Tue, 07 Apr 2020 16:43:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=B5sjHFFsxbku6QcEI+FyhoEB+p/8KKsAmGhEW48J20A=; b=c8xasDmOZTvdq0ZJy2sPog6e8Oi0rbzAHUA90qNfIW4zhYhQHs5DlBaJQHiRJDDt2V Yl7mBAlUZFzzDpoFgz6QXhs1JXzj4DcVpv4kEbCiBOQOqGvL9L10gGz57nwwaGs+V9Th S1XIyZ2FYAWaUYx6ZpT07qND4D++TDGYn5a58= 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=B5sjHFFsxbku6QcEI+FyhoEB+p/8KKsAmGhEW48J20A=; b=couElXlO8Cd6oPuhZSj5iPjukiHjKOof0KUsZ7IKZOOdWNMAb7MDqcOXF5xOIKpRtU UaAy7pquM0htAk3unwhqxwyWujvRCZ/4eOnW97dnH0M4QF8JOxvrTmC9W28gg3BtcXry y9f5VSIEaEirb6TInDyLIIZ4sTGZdugIDW6I4aPEDZlwdovJ6Wt1kjfu1q42h/rfQoaS jAXBjVe3seRm0IUwYXIXb+pfsB+WcH/0GBgMaUfF5FhS/8sPRzhsLfb1yNsgTZ00p0x8 rnexWBZ2cOvK1tBr+LLeEva1AEv8fLYrTIMvTouQq7SNHQnuRY9TEMe1zFpLV7aRZpyk p/yA== X-Gm-Message-State: AGi0PuZw0RMo1nfwt7EcbRsw3acQLGrOdRssuXpIWr6wtlJhlxz0X+DT GqsbXY/3TwGuHd+RrSmyR+4j9tx0z72tS4u3mzeA5gYI X-Received: by 2002:a67:b60c:: with SMTP id d12mr3628019vsm.196.1586303000376; Tue, 07 Apr 2020 16:43:20 -0700 (PDT) MIME-Version: 1.0 References: <20200407205611.1002903-1-marcel@holtmann.org> In-Reply-To: <20200407205611.1002903-1-marcel@holtmann.org> From: Abhishek Pandit-Subedi Date: Tue, 7 Apr 2020 16:43:08 -0700 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, Since the resolv list is tied directly to the whitelist, do we still need hdev->le_resolv_list? Maybe we should remove it. Abhishek On Tue, Apr 7, 2020 at 1:56 PM 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); > + > + 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 >