Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4769535ybb; Tue, 7 Apr 2020 14:12:51 -0700 (PDT) X-Google-Smtp-Source: APiQypJz79AI2Up0+ARVSgfmBPu+7siuhTKTvqxzUIGczsw/k4NDnv87IaVG6yyYg+yIUnk2gPZp X-Received: by 2002:a9d:4f0:: with SMTP id 103mr3225259otm.336.1586293970938; Tue, 07 Apr 2020 14:12:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586293970; cv=none; d=google.com; s=arc-20160816; b=fjvMWaY+omCHOjPtbH3RUoywImXrRtdWuGsN+7+A2lYZkElyDAWpfVFqsASBYWCpff NvGJOlX7jrxK+wlhEUw7V1TS46wUzg6oXU4rAv1hu8HlgQMq+fVV8q92YxC/GW9ffvlF GPnnyE6Lo6eCElpoGgCfvwyuXdS7DL9Ja0Ekj9OCNhT+ZGDydVW5fNmmtcHgz9kNe4PE CdEMQJ6lb1UC8BhPjBev0HuaY/Jy3CsGi3hsVta1IohjN1406Bl2PBmFaGZX3Q62TkW+ SSG1b789i0jR/gl0va7RdiebwCA7bC/8XvlWQPBTO5MtjCdpM+sSMqoT2onSJKrtWEK1 bj3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:to:from; bh=DTq8mH7NwJFpLtEU+TepeW9lGmB0dHZb4nNfc8dtefM=; b=07k2bCBwnGmwlgQKeR2IbsGncYN9R/hqN+J0HvoATBy4fp1dl+YvKx+Nz2VEdv1GOB Fhyi31BgqLRiagOgbU1yZST4eY7lBtgKzsZINEG7yXbdqbsY4BN9cxdh0ZQTnFMA7fyu uT7l1WDMt3L71uBvuE9UybAP/gcO7mEOl27YEvBLAEZy4JHjUQiGvI/x0vEx+jy2uTiw 9xC2tXNtG3xmPhb1JZ+5MbBnYkAkaRVzN6XIWq4PkroN5s+Skn5OJVaRQwKA1qbeq5FN qzMulRR+DO2GJimEpUTmS9mWYq8z94EFIYWf/3yQk8Xk2OxcYHgWOd/2qkdf2JW4PIoi pBeg== 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 w21si1069940oia.257.2020.04.07.14.12.13; Tue, 07 Apr 2020 14:12: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 S1726386AbgDGVMI (ORCPT + 99 others); Tue, 7 Apr 2020 17:12:08 -0400 Received: from coyote.holtmann.net ([212.227.132.17]:36393 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726380AbgDGVMI (ORCPT ); Tue, 7 Apr 2020 17:12:08 -0400 Received: from localhost.localdomain (p4FEFC5A7.dip0.t-ipconnect.de [79.239.197.167]) by mail.holtmann.org (Postfix) with ESMTPSA id 467F3CECDC for ; Tue, 7 Apr 2020 23:21:41 +0200 (CEST) From: Marcel Holtmann To: linux-bluetooth@vger.kernel.org Subject: [PATCH] Bluetooth: Translate additional address type correctly Date: Tue, 7 Apr 2020 23:12:02 +0200 Message-Id: <20200407211202.1008128-1-marcel@holtmann.org> X-Mailer: git-send-email 2.25.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org 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: + 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) -- 2.25.2