Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp301870ybb; Tue, 7 Apr 2020 23:26:51 -0700 (PDT) X-Google-Smtp-Source: APiQypIacTELv4uoT9w8rN2m+4tmcv6zFVLFlIVIu5rc9NsgBqGUQlnXpjtUnvUrC3XJO0HqtnNX X-Received: by 2002:a9d:6e09:: with SMTP id e9mr1297033otr.32.1586327210826; Tue, 07 Apr 2020 23:26:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586327210; cv=none; d=google.com; s=arc-20160816; b=VZFHaj0KQzt7ng4mbkXQOe2m1iCeWFXY8HxROa5tGr31vuEDrXLv3TAdvB7OZtjWs6 hj5eh/hxQ/m3ws7FwIPKOU3BigALM7S2RbnG53YvqZCVULVW4J5bxX+7sRPuKrb/mHGY ywwxj9FRLP6MfbRE7OybBVLmSjeSpIg61MPIBDOO7MTiFPF8/VFuHKy0bMoTGjEFSf5B vwo0CEYYisyhgk0FxUOHum/+OZ3kxqebRp4eOgYbqDHwbRQnvnTnn3hi8npMmRktFHr8 YhCU/59x6jfS6vdTVCBkjmcZU7oRNlJhaqGdlAKX4ujEVLoj5TGrhQ8mvrsuDmsXXMwF STPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=x6qs1BiCoXtn+RDMHPZ069mISkRg8IU7t7sp10KUdWg=; b=gFNjTPCvDXR6bmGO2KfsJ/h/Ljm0bN7MVfs11YNiBxWnkqdp3zO/pL/Qi22oONt1su tWGNdNwdIgK9KY88xjoy7oNUGN6x8EgluCMFieULp2DKO0RLz2XOmNDPPfbOxJNxWh9K wlIIcz/lGjeYQ/AbqoNCRo7ZDAqqu9mex8JS45oWCR+H1xzvotA5UCu6gez7z+xU2/XM EzcrhQhm1zyBiUV7Cs9Pbb6kGHCU7qMMhlBk9kLcmhEaA4H32AxWeg83acWppNCVHym7 swpJ7k2wOeSCQgAXiVDPPk0Nz7v8P7/d0s/QPBwwvDKgs/2FguBvwgOyZrR2IuPWDLBD fNSg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y9si313556otj.241.2020.04.07.23.26.34; Tue, 07 Apr 2020 23:26:50 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726508AbgDHG0J convert rfc822-to-8bit (ORCPT + 99 others); Wed, 8 Apr 2020 02:26:09 -0400 Received: from coyote.holtmann.net ([212.227.132.17]:54783 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725932AbgDHG0J (ORCPT ); Wed, 8 Apr 2020 02:26:09 -0400 Received: from marcel-macbook.fritz.box (p4FEFC5A7.dip0.t-ipconnect.de [79.239.197.167]) by mail.holtmann.org (Postfix) with ESMTPSA id 2F572CECE0; Wed, 8 Apr 2020 08:35:43 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: [PATCH] Bluetooth: Translate additional address type correctly From: Marcel Holtmann In-Reply-To: Date: Wed, 8 Apr 2020 08:26:08 +0200 Cc: Bluez mailing list Content-Transfer-Encoding: 8BIT Message-Id: <722F5D56-A8FE-4E18-B0B2-643432255E1F@holtmann.org> References: <20200407211202.1008128-1-marcel@holtmann.org> To: Abhishek Pandit-Subedi X-Mailer: Apple Mail (2.3608.80.23.2.2) Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Abhishek, >> 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 >> --- >> 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 58360538d42b..74896536ebce 100644 >> --- a/include/net/bluetooth/hci.h >> +++ b/include/net/bluetooth/hci.h >> @@ -2257,8 +2257,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 589c4085499c..fb210f7ab7ab 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: > > This seems to be a typo. Should it be `case ADDR_LE_DEV_RANDOM_RESOLVED`? indeed. I have not tested this with static address and identity address yet. This address translation is needed in a few more places. Especially also in the Connection Complete events. And we also need to store the RPA used for the connection since it would be required for SMP. Regards Marcel