Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp744440ybh; Sun, 12 Jul 2020 23:09:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwv9E9ClhXacy64pABMYit+6I/gPngCXyPk0tR+cDOngbfO8lHBPcQ1fcuAJj7GHH9yTU6Q X-Received: by 2002:a17:906:1c4b:: with SMTP id l11mr70503033ejg.307.1594620556770; Sun, 12 Jul 2020 23:09:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594620556; cv=none; d=google.com; s=arc-20160816; b=bKUo318XcFTbmEY/an6GO8fefgCw3LbDcx2mAmj+Cbw0ZNSbeyL+Zlbmvd8xJ/I41U G8cpi1l2Wn9CgiDv7lTRsbVSXDUFn5SJ9ojVvf62bDuykUYvRPDrU/rSK2sVXt1lNxpy V2Vj8SXYAM6tOyl7AAKC0otiicn1neY9PBQQDQyUDCp5oS3jcc+VVNIBiVdb5NIebfrB VJvpuAvfnY9+K+bkXqtxZkqKnnd9IaB0ZEg9wgpmorkaMhFpQFfMCL+DraiKyjCKqLkl EN9DTquN8RviH7fDBJ7jtFj2C2KFHDRMsudyjG/bJ5nW72+q/omjyUcVzPCZGxVequFm wC8A== 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=s2IcTEAY6E8gqIiH1UvcKWcRD7F04eaPXNmCRRgH/EI=; b=gHZeRLIiegs4Qb/wY/AkkuX2DEp7NiQED79hSYPZyORQ58gNtaOhlyrbK3yKZtxmy9 TYbERgCmo4+CRiUSJMwBTmlPmMTkwx70edV0lMVHFvB6pg/ihp/BGxyMKVHFDyQuimA1 eG9OlEGqTW+fhe5I4k+X77QJYWi0T8QgD41wtM3xbmRcTS9EPUlly0nxoMLyV7FdtMyC iWf0RU1dsKas1FaY1iXqDsjZWJyoVgLWN/FL8oLkIP4z83ffsOCeGkf1vKjDLGhmjtj+ LPyueOPdlT+Ziezp7eEuguVJ7AV4VD0wrrLvRyr7ao1PaNWprKJwG1/4KbwLTUw8FQ02 kAaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UX+daJPI; 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 z14si8087170ejw.332.2020.07.12.23.08.53; Sun, 12 Jul 2020 23:09:16 -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=UX+daJPI; 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 S1729048AbgGMGIq (ORCPT + 99 others); Mon, 13 Jul 2020 02:08:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726571AbgGMGIq (ORCPT ); Mon, 13 Jul 2020 02:08:46 -0400 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 191C3C061794 for ; Sun, 12 Jul 2020 23:08:46 -0700 (PDT) Received: by mail-pg1-x544.google.com with SMTP id p3so5591558pgh.3 for ; Sun, 12 Jul 2020 23:08:46 -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=s2IcTEAY6E8gqIiH1UvcKWcRD7F04eaPXNmCRRgH/EI=; b=UX+daJPIEuP+dPh8PvOHWEB96LtLs8zZGJ2Sf6WAnNrDdiFL7t/n21KdDqUnkzJveF l1a2A2P+XBmqMMCP+uYgo6Pf87yzjZL5IGshlMRuYCUKLKtw0XITUOmgFkUucLXU3MGJ tOPq6Y+HdDZm6OO1gmb0Dsy06o+ARmCygSpY8YIiASNNvctF2xTldH9i2b56lM6+jiF0 IzCDAU34IH1JzG1TPiVFk+zcbMXR5cp04DR3X3sqPYs4v3ufcVGrGJvKam9r1YLG11nj n8GeXfceaekQGucTVpDOrSOeqiFtmSyBCl82v0u8qoX0H6J2CMyllQDebbzYI4sR8Sxe VcOw== 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=s2IcTEAY6E8gqIiH1UvcKWcRD7F04eaPXNmCRRgH/EI=; b=Qi8/aEk01bResru4tJGJF5ldsmP0RdybwUXTCISyhtgd0uetS2xdlHugC7pXg8zBf4 oW8fcY/3ACIo8tpVKQJQX9Pa37LZv7bLxmSj/2LLJiwaJiSGd7R2Gb1f2RM1TMn5EHnt 5nO9T17azBNaKt415eGnVTMCTgWa1P6cga7M5rNdq5rSd6YsKu1w8cXCqIYYDANegzXl X5MOHdfwg3aYHXvpZqy2sVAlM4jDz8w3QtgilUlXNNMmh1VlgIOIoItRj9CaZARQbnNj xirXRlxt+d2cSDgsnsUHkwLkodGbgz2dchHhIVctH+70TR8CbNSDVjmBkgld5K4/ZyFj y3LQ== X-Gm-Message-State: AOAM532Ie/wNtOuyLFCe0j7fihVapDZql/ZD5q9dGo9XteCMw9K5LjjV y+4LVPA5aDnlQFv9Qf4w8DyEydfFFzyJ8g== X-Received: by 2002:a63:b90a:: with SMTP id z10mr64900272pge.277.1594620525467; Sun, 12 Jul 2020 23:08:45 -0700 (PDT) Received: from nsathish-Latitude-7480.iind.intel.com ([192.55.54.40]) by smtp.gmail.com with ESMTPSA id e5sm12787172pjy.26.2020.07.12.23.08.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Jul 2020 23:08:45 -0700 (PDT) From: Sathish Narasimman X-Google-Original-From: Sathish Narasimman To: linux-bluetooth@vger.kernel.org Cc: Sathish Narasimman Subject: [PATCH 4/8] Bluetooth: Translate additional address type during le_conn Date: Mon, 13 Jul 2020 11:42:16 +0530 Message-Id: <20200713061220.3252-5-sathish.narasimman@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200713061220.3252-1-sathish.narasimman@intel.com> References: <20200713061220.3252-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 927bde511170..eae5bd4a53ac 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