Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp472791ybt; Wed, 1 Jul 2020 03:01:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynu+aDOjdFItWibrm/sX1yRESQDiFRnbp/+NCaHWRBCJeW1Qt2EFx/ZaBQglpZGRnZ9LQ/ X-Received: by 2002:a50:f392:: with SMTP id g18mr5897639edm.151.1593597707682; Wed, 01 Jul 2020 03:01:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593597707; cv=none; d=google.com; s=arc-20160816; b=ZRH5llC/rvll6169s+Zkvd2p76h9R62jd2HfqyqUlfYu6YwI1du0h/yXsgq4xilFKC XiBnDK0KjlnkCjL3qTTLOf3DkTavzK/7dop4Gml36C/MBqx9TA2poeeb/GVXbaovm9x9 7GqGqSKJyX+pEvpiM2tv2Z50TbjJpWom+i04hWBV8/Rsk2fbJgj7XhPX9CduCSpXXCNK /XFJtZS4+5sBSVg+X7nbR5jVBc/aTALFrstpIZMJWZzPC0vifXD28WIImI59Paj3fPRD yIFx2R2wwEkp0/1foM0BHql/7NoFhkvRCv1Cmf0YcG6A5iWrigMopvf/79FROrfSNUOM TZkA== 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=SiGWJykKRUEpwFqa25J4j/wcmszxEYFYY2Kihm0MUu8=; b=PhG4RiJsYlKcWUS+Ni10RMRGD0i47lvt9bdR7hXF47Az0vRsL7q4LvfFd2OLO3ywHF WJDCI+f4Jg8A5GSIjnHJvNWpB6U4nVR+aJzg5VtA/cUQo1YcYllOmPZFXluWOG3XEM5O WkzJEoQK+yR8prjQ48MmpP7owBxSWxz+43NwBSKkDzcd9CiZRx2Lppn+MPQkv+PbCnGh LvuLMtULajzao7+FEtobJh2YnGH3gtJANrdkdJ58cDKVGvoWdFVJQuTMhG/L8wpcb+qV A4PSaH+SkXzBVbsjE36cvqgmqPnPISk3NW8ByrbVFa4Rn1FCIgcpyBGHIZxVRRUq7sY7 MwKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=f7uURM5y; 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 p7si3561019ejy.206.2020.07.01.03.01.23; Wed, 01 Jul 2020 03:01:47 -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=f7uURM5y; 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 S1729687AbgGAKBT (ORCPT + 99 others); Wed, 1 Jul 2020 06:01:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725440AbgGAKBS (ORCPT ); Wed, 1 Jul 2020 06:01:18 -0400 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33437C061755 for ; Wed, 1 Jul 2020 03:01:17 -0700 (PDT) Received: by mail-pl1-x642.google.com with SMTP id x8so8822491plm.10 for ; Wed, 01 Jul 2020 03:01:17 -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=SiGWJykKRUEpwFqa25J4j/wcmszxEYFYY2Kihm0MUu8=; b=f7uURM5yqevpDA2KH5B6wkuUNNejZsTKOoudMOcwSrTbp9uqtfea0vtdtaJ4XCihwE YnRCaZrjE+Tff5LJn8M/EfcgFXvLjgF8MLSsaJ1PjT25z5iCaCXLACKFmYEjefyuXKWm 70RTNFZaJ7BFGjub2ivy6vRFIJadDWFV8ndaU3+0eNtMSHsUG136lBJTjocx0SsLOu0I GhXzpfv3vArKUE8AoCwUf7yv/crxahkF6ogmqOhNKNAdNeTvzhM1cGUDh+Syn8npHwd+ y9dk6iN1wAW7/6Jf/rl5nexwz7XjFtL7/iO0I6CY9C8j9iKVuPLOp5m7UNuqFFT/9WIg 6eZQ== 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=SiGWJykKRUEpwFqa25J4j/wcmszxEYFYY2Kihm0MUu8=; b=q+/4uFQauWxhyk6QSAMSakGSnGFDS25siFtlBZ1wXmsJXgqNz4dam8CERRUIos0dkO mIP92ctjkMmQWtFwWBhZXxh++x1/dDzPQbacGdF4IaXU3+zTibBhvhstemwl/LeM7gjA ecJtyp+yYfRK7qbSRf6lJHFp9RSCLn5f8j3UB5CEBN3d5FF3fAONFBLZBO92SMJUoD2w UEjeLw+MX20/uGSkyYp99MxkWeNoPVUnSrhcNe1ejAdIgiyynsLyjugO5QHVJcUlrC37 +xSBbTFKcLPp+8waH8gUb7uD9F1MPL6uuieZjBD8YH4wD0qDL5OquTWxitdFZ1fO1AD+ g2xg== X-Gm-Message-State: AOAM533Q+Q8SjA8hcZq0dV9BMxalA+GWH8gc55tEhdr198GH03ajoppH GQf+WX+cwaetStQAFJGjj/UFd0hDknmZMQ== X-Received: by 2002:a17:90a:26a4:: with SMTP id m33mr6814342pje.124.1593597676371; Wed, 01 Jul 2020 03:01:16 -0700 (PDT) Received: from nsathish-Latitude-7480.iind.intel.com ([192.55.55.43]) by smtp.gmail.com with ESMTPSA id d37sm5381961pgd.18.2020.07.01.03.01.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jul 2020 03:01:15 -0700 (PDT) From: Sathish Narasimman X-Google-Original-From: Sathish Narasimman To: linux-bluetooth@vger.kernel.org Cc: Sathish Narasimman Subject: [PATCH v3 4/8] Bluetooth: Translate additional address type during le_conn Date: Wed, 1 Jul 2020 15:34:28 +0530 Message-Id: <20200701100432.28038-5-sathish.narasimman@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200701100432.28038-1-sathish.narasimman@intel.com> References: <20200701100432.28038-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 e060fc9ebb18..592ef5dda3ab 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