Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1298259ybh; Thu, 23 Jul 2020 05:36:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxn0AUBVV7yqIfJ5PJkWSKmlT7ep50wBXqqzpoMiHxsouDCkfeVo5/tIz9FQ0z1R3imH9H3 X-Received: by 2002:a17:907:1190:: with SMTP id uz16mr4016391ejb.385.1595507765358; Thu, 23 Jul 2020 05:36:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595507765; cv=none; d=google.com; s=arc-20160816; b=vGSY4Otg7E+HwfoQzJU7c5SB1Tls/hHGtcT4OleW2CbOdVGPjfoNxUd412hSHOpz+j yjnwbH2IEK0tWV6zIyAvLqleQwd2MIcRkD98pXu+Yilog0Ga6HGT+QVzg5A8c/1Loh/P tNUkAYVoeL9TTYwcv0pPokfxRoI54j+2tjqTrSuqKFP9FG6sCGIsWW//eimrZ+CzhQE+ h0XJpHqW949Hayj8Flr6o5QBGdV1uKuJV1H2tV4yiHpwEqTKYyC3YU2Q6aORF/Lt2Mxg s964Vpm6aZtBzjXj9KKgCBVaozIgrhklMqHQEBgCTrA5yAvw1BABAUxRSIsmYJ7CdLaY zz7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=bwkuLTs6JjWfQ9Oc/vq1HcUJ3U5T2anKNWaBV3h5b4U=; b=AszEpTOFc27Uun0Q1Cbfhyc5/m4pfnkjT/VGCS8RTlt6AOoBhBxbkhoG84heD0EPEG HQkyqWTxjmF9hABsLOE3j1hGYDQRzk+H3gXAiUyqvVfpNMtBxglYBi5buPjJrTJAeETh AhbtSzeSDl6Bx0B+wtyAKjg3IBuT1daLEpip45Q/Hfi04mNHIMZdYLZWhHHWMpZb7SlC mZlGHK6mglehUOs1ZhCaUPVGYUEWQMDET34W3nGeJUIcgHPDkfB3j2yd5+6AxrYnZcG4 RQHm2s1KPrq+4iCsmX3gWsQIaPecsDJdqBBKACAns1wicI17a/ziaA+Zx8d1afk+/l7L cm9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=t34FZrqp; 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 z16si1862839ejw.386.2020.07.23.05.35.39; Thu, 23 Jul 2020 05:36:05 -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=t34FZrqp; 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 S1728066AbgGWMf1 (ORCPT + 99 others); Thu, 23 Jul 2020 08:35:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726109AbgGWMf0 (ORCPT ); Thu, 23 Jul 2020 08:35:26 -0400 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94590C0619DC for ; Thu, 23 Jul 2020 05:35:26 -0700 (PDT) Received: by mail-pl1-x641.google.com with SMTP id l6so2499204plt.7 for ; Thu, 23 Jul 2020 05:35:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=bwkuLTs6JjWfQ9Oc/vq1HcUJ3U5T2anKNWaBV3h5b4U=; b=t34FZrqpJguHXObyN++EfG8CiEe1r70HOONJmln+mbhgRW+GbH4f1buS8rMj9fSW+g RcOp6eK4BVKBwGlh+a+Smq6qeIg4F4XLDal6X2VUVhn9SJDeoGo4FhB+8UCX7F18pD5u B+aJG9kybl/3NJi8FA+p2Rct5dVLWhHkkfwRG5ds/k3U4T/v+kLijxZwDeuFgXtkfmRo dSZ03ZBSCrjmSTfWM3FiNUVKQDwaDdJcQkiOwKCoK1r1lHBWe1CUEZySpBp91ZyD4O1z 7iY0LST6wt2rGB91SPlsyDoRxBCZmXlsCuTgfVzcnLb05XoHniB9AH9j3Cd3/40V5al9 ZutA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bwkuLTs6JjWfQ9Oc/vq1HcUJ3U5T2anKNWaBV3h5b4U=; b=oQ1ZXZfJTfhJvhYmULIZoJUDoFlacyf+CZod1k04sbTbvCyIqPIiznx5nL1HBQ4eyS lv5ojT2NE1WoqLQgSpy8NbRu4yF3Cs2YtxUdPwk8NIYUI924mrn+LmsPwTjwVHSVRp7N kpPdE0oxgRgooCHGyMTRBJKMgJZE4bhlQV37mxoYgssQijWwI/3mxGVvtfeV7pkqFzAV jE4HrSLLjognxrieNV7Kl1XgknWuWd37maEE4GbPZcLYsh0pXqC+H7gry3ZjFtsQDPNJ Rt4b1mrmZngjXO37nzv1mQpiSC3OnHAmqkZRkfMMEwabnk0dEi8ZbnZGWNi1v9mG9pVR DumQ== X-Gm-Message-State: AOAM531Oybrn5QLp2eiXgtIOxMhtITo85IF9UYCdqm9+MJKFWV6FGR5t yaSN4C7j2R1sX3MPY7Wwy0jr1CAEPMADDA== X-Received: by 2002:a17:902:322:: with SMTP id 31mr3626123pld.33.1595507725921; Thu, 23 Jul 2020 05:35:25 -0700 (PDT) Received: from nsathish-Latitude-7480.iind.intel.com ([192.55.54.42]) by smtp.gmail.com with ESMTPSA id z11sm2849823pfr.71.2020.07.23.05.35.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2020 05:35:25 -0700 (PDT) From: Sathish Narasimman X-Google-Original-From: Sathish Narasimman To: linux-bluetooth@vger.kernel.org Cc: Sathish Narasimman Subject: [PATCH v5 4/8] Bluetooth: Translate additional address type during le_conn Date: Thu, 23 Jul 2020 18:08:59 +0530 Message-Id: <20200723123903.29337-4-sathish.narasimman@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200723123903.29337-1-sathish.narasimman@intel.com> References: <20200723123903.29337-1-sathish.narasimman@intel.com> 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. This patch is specially during LE_CREATE_CONN if using own_add_type as 0x02 or 0x03. Signed-off-by: Sathish Narasimman --- net/bluetooth/hci_event.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 61f8c4d12028..6388fb55b4d2 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -2296,6 +2296,22 @@ static void cs_le_create_conn(struct hci_dev *hdev, bdaddr_t *peer_addr, if (!conn) return; + /* 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_LL_RPA_RESOLUTION)) { + switch (own_address_type) { + case ADDR_LE_DEV_PUBLIC_RESOLVED: + own_address_type = ADDR_LE_DEV_PUBLIC; + break; + case ADDR_LE_DEV_RANDOM_RESOLVED: + own_address_type = ADDR_LE_DEV_RANDOM; + break; + } + } + /* Store the initiator and responder address information which * is needed for SMP. These values will not change during the * lifetime of the connection. -- 2.17.1