Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp663834ybg; Wed, 3 Jun 2020 10:17:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHMucQQFY0wrkEGAxzPtXH4VqeKOHGjwW0WUDjmmXpjfyeVaWkRxSnyOmzy4igKVXs4Khr X-Received: by 2002:a05:6402:b37:: with SMTP id bo23mr502186edb.24.1591204654010; Wed, 03 Jun 2020 10:17:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591204654; cv=none; d=google.com; s=arc-20160816; b=ylBvq3YtYQSHcDhYquMKy6eGMd4LEncHz3MvTDloCkX9zLPjvKdl5s2IKRN8O4r/jG aGeRF3UFALMqPoGlsfS0pDrvuup5AkED0dG9Ud2EKvsbrzn8/54IQxsjBHpg+7GH7tNL rwLvE6mCll178BY5w/3EivzqXueXN4Vlp9+23pkcuh/FmmEAGIkii0Oh5lPm7AmxJ9Sa K3otRfS+XGrwJhbxUuygaQzjirkDTZKpOOHa3sIzCYj6VHUHpR5MEPHCHhzTRBtMXZ5U T6TEdAPlsowG1NLs44HzGGnIIh8BVuLHIlO1wJOelUJho02u5dRjzLF+XQiiw+osb+mz CQUA== 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=RqbNZdfUYH4SzFn+I4Y/bQsxB/0Uon3AtvdfFK17OOE=; b=H6H8VHpdznkpTcX/01oe6LvajkTKMxUC6v9ZMw9FYDPv6shsSpNulpg1+IwU88R3E0 uKO3kBh8+v9kkFCpMbAw7iulXscCcpny1eSKhKM+BtcCEncgFmvMXSbCq1dDHaAQBnVh lmMWnut1TOqgJLGNOLSst2PE+Y3EL2s8QeDk5BLKK4brxmkgFcX9Iz+oAmtRio5VL+TM 7cKqG1M/8djFo0SfVwOovRKKEZ0wvl2COoROdvdkyuioh5WH+EYdkK6KJBHfNAGFeGX0 j2e+GUVCIDhcfxYRJprSpfGP1rd0GHnHy9vJUL5pfYjAyTgKsvsFPM1LqIB3U7QJu8a1 kDkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MI6QDVR0; 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 o11si86187ejr.300.2020.06.03.10.17.09; Wed, 03 Jun 2020 10:17: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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MI6QDVR0; 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 S1726221AbgFCROZ (ORCPT + 99 others); Wed, 3 Jun 2020 13:14:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725961AbgFCROZ (ORCPT ); Wed, 3 Jun 2020 13:14:25 -0400 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8624C08C5C0 for ; Wed, 3 Jun 2020 10:14:24 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id s23so698084pfh.7 for ; Wed, 03 Jun 2020 10:14:24 -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=RqbNZdfUYH4SzFn+I4Y/bQsxB/0Uon3AtvdfFK17OOE=; b=MI6QDVR0Dwcb1j/3WKvcigtl7WV1KSXclWfwvQGkjUUEHQUcWXRJcFCs8RzTtfnnYp Zwqhwfu0tdVq8NqsyMfB0tPOVQRam+awoDXi6lLUtkBlhnVJTXRvgjWIOz7dbnCo2Q1d ifpWtMLuSdcduOYHubxvixtIB7L53gJWLj8WEGhV6axEFfFDraBwKg9lO37mfOxW8voj wergH32sZHY2B3fviSybiiWFZNKtn6zElSccKMq3ziRcVPz5n2TLP5F5Ne9is428y4hs TITYIcxd+tz/qucRd8zqGCepaW8dtSWTMlezu81QKbHNliCWM1ZCFAqR/G+LQ38DwB6a N06g== 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=RqbNZdfUYH4SzFn+I4Y/bQsxB/0Uon3AtvdfFK17OOE=; b=MBQq8fJe67XH4b8MJDuSplYBEABHGWr0cpOO0cyUNO4SnglgiDjGrPXZ2Wzt2rVciO dQLTTLHafPQP4+ZdfmqXv4hSL5LVCkDsJ4NfqFn0gjYU/f+9/rdjQMPivcGCd9fzL3bT sDMwZruQKAbJ3QG8oSYt63EFSIXQeYbh1MzlPFSbF5XXKdWWddy+FVJSAkd2E/X+OnNF 0PCD8T2KzQ6lMC4ICRheG81cKwLMo7dourZqAgmXr7G2nQmp5JDg0KEyhQ5/3KYq1bbV jfG0E6y0pUoZ+/T3WcfSlYuAjanloup4HwQfCZJBWJLRy49tlTDZB+PU317LuMpeAi1F DrXg== X-Gm-Message-State: AOAM533Qrr63SHZnTlvpHbqf/osh100jHueRqaPZMj+YWOPB9xXWtxUL n4fYOeDEIOrCSXtQy6IsuIjFGzaeVfU= X-Received: by 2002:a62:e703:: with SMTP id s3mr133450pfh.43.1591204464098; Wed, 03 Jun 2020 10:14:24 -0700 (PDT) Received: from nsathish-Latitude-7480.iind.intel.com ([192.55.55.45]) by smtp.gmail.com with ESMTPSA id x190sm2016770pgb.79.2020.06.03.10.14.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jun 2020 10:14:23 -0700 (PDT) From: Sathish Narasimman X-Google-Original-From: Sathish Narasimman To: linux-bluetooth@vger.kernel.org Cc: Sathish Narasimman Subject: [PATCH 4/7] Bluetooth: Translate additional address type during le_conn Date: Wed, 3 Jun 2020 22:47:10 +0530 Message-Id: <20200603171713.9882-5-sathish.narasimman@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200603171713.9882-1-sathish.narasimman@intel.com> References: <20200603171713.9882-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 cfeaee347db3..9c9c434844f2 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