Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp69311pxj; Thu, 20 May 2021 04:47:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7Q/59TebJZpRnUKGsr89m1Q6GxL7cwBBiYc+63h4PHHvvOfA+yUoFWtweL2MzoB49RBC0 X-Received: by 2002:a05:6402:5211:: with SMTP id s17mr4643757edd.352.1621511253983; Thu, 20 May 2021 04:47:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621511253; cv=none; d=google.com; s=arc-20160816; b=SbfEtB+g26U1xrlAK1v/MWnf1BdBTQup/zfjKEu+3nFp7UdHCy7FegJDn+HXlNBqHp IrEOly3BBsfZ6AzTVPUoKEPU7OzGPXjzzW8gCWWSo2HDE1uzksVqDrqVowKt1bbiqO7j YoPWK1qj54x0qKJlX0sxfdP8ZiJVb4F6gbkC2zxAdTO5wVgXuEquNp2DvFJyP3k+WQaf 0iJ6TnKkz7Qxb1f+Hdcdjg/JcigpWslpcpD5VokltMBb/6tt65cwrSpUKrsT44bQgicO 32ORFHn2uJIsHvIIikD1/barcl2DGQIiuV91OWM5sRFz6s0OEzvglrzpZJCyEU0SMpfU zKhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from:ironport-sdr :ironport-sdr; bh=xsq5iFX4ZAzMi1eKbkR34fmRFRk2VHHaZlIzU72ksQY=; b=UgE/MPRhCI/n9m1YDdrtp6eN0tuTL+zVNCQUWrI9Ng29+PMNaNN2foj2rDu8nGdVk7 o0o2Jg0D9eOFOG8AmjdowkuA9PWCe0ddidYI5LQLyu0DnMbD941L2l9uWVpOIXFJcISd mwNfgx1FssZbycOSGcnHEYk/aNu+K4hMZusy0gMO4EmuUgjXcRDb8pNt7RqLD+Brq1Cd BTpa/OxO7HA2wQ/g1sqwl4NlRidxP12W0tWDIMgmUiMHc9/lwGqXderKp02+97FfGisQ SWToL/yS9gdRJkfb5+Uxjx8sSkJz72hAMWtgegNYlWmXePnJuBemIjxTDzfWbQk5uNmr i2xQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m7si2274880edq.472.2021.05.20.04.46.45; Thu, 20 May 2021 04:47:33 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238623AbhETLlv (ORCPT + 99 others); Thu, 20 May 2021 07:41:51 -0400 Received: from mga17.intel.com ([192.55.52.151]:39221 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242344AbhETLjd (ORCPT ); Thu, 20 May 2021 07:39:33 -0400 IronPort-SDR: ODxFkp+tU8E27o96+7VsnIWtPKb80KytBlWJv6lgAse9UBF3UZ4dr1n8QcUqtEX2+91v/+X4g/ OUZMZD19cUmQ== X-IronPort-AV: E=McAfee;i="6200,9189,9989"; a="181484186" X-IronPort-AV: E=Sophos;i="5.82,313,1613462400"; d="scan'208";a="181484186" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 May 2021 04:33:03 -0700 IronPort-SDR: HrCUXXoD5NPq5ltQiB2sIwESJo1yVMlWxKiHj4QFKh5dOWWp52RV+BexKdtHVN9wTE1E6zW9qd 7IN3pyXnoPmw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,313,1613462400"; d="scan'208";a="628132069" Received: from nsathish-latitude-7480.iind.intel.com ([10.224.186.105]) by fmsmga006.fm.intel.com with ESMTP; 20 May 2021 04:33:01 -0700 From: Sathish Narasimman To: linux-bluetooth@vger.kernel.org Cc: chethan.tumkur.narayan@intel.com, ravishankar.srivatsa@intel.com, Sathish Narasimman Subject: [PATCH] Bluetooth: Translate additional address type during le_conn_comp Date: Thu, 20 May 2021 17:12:01 +0530 Message-Id: <20210520114201.32157-1-sathish.narasimman@intel.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org When using controller based address resolution, then the destination address type during le_conn_complete uses 0x02 & 0x03 if controller resolves the destination address(RPA). These address types need to be converted back into either 0x00 0r 0x01 Signed-off-by: Sathish Narasimman --- net/bluetooth/hci_event.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 4241ae310fcb..3b86e9176de1 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -5196,6 +5196,23 @@ static void le_conn_complete_evt(struct hci_dev *hdev, u8 status, conn->dst_type = irk->addr_type; } + /* 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 type + */ + if (use_ll_privacy(hdev) && + hci_dev_test_flag(hdev, HCI_ENABLE_LL_PRIVACY) && + hci_dev_test_flag(hdev, HCI_LL_RPA_RESOLUTION)) { + switch (conn->dst_type) { + case ADDR_LE_DEV_PUBLIC_RESOLVED: + conn->dst_type = ADDR_LE_DEV_PUBLIC; + break; + case ADDR_LE_DEV_RANDOM_RESOLVED: + conn->dst_type = ADDR_LE_DEV_RANDOM; + break; + } + } + if (status) { hci_le_conn_failed(conn, status); goto unlock; -- 2.17.1