Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp749012ybh; Sun, 12 Jul 2020 23:19:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8WuzjaF66aaHdJP7NLR4TzeMlQn1sDYxfwYSvzpbKsWQh97pjVPJW6hnGwkqwRNqwJMc0 X-Received: by 2002:a17:906:5657:: with SMTP id v23mr74505936ejr.196.1594621183661; Sun, 12 Jul 2020 23:19:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594621183; cv=none; d=google.com; s=arc-20160816; b=eumSrHh58jJKj+vAUNO6/13IQRmFP27769FFcF+hfhEJoGw5LBbU6j8Hr+oQiqyVNt OVEXPPQKfBtyY+pdjAi3VeW2yUz1pvMf1rmlUZpEBb0thFw3K1qKgEj/0pAc+zWzrthN AtvHo0S+0HQx2dB3O7zVJpH9rdNLBXxiKQvm5WOQgqu09irgA43PF6T6SF8+MfUgv9c1 i4FQWat2oTfLp5h9hysQK4cKPCm+IBIJ/D8aAC+xc77dPNH6vo+iSoN8VjSwn6Y9mORe gOCtek4CeNWaUkFlw4TTMc3zpbc0uL1re5qXfqSdCHC5hpLzMei761lTJvEstyTDmBUw IUlA== 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=pBeunVsDR3xJJ7XRpd2AnrvtQ86Gj1bM8OKMKbWI8kyWEarUUEzJuV+s0hAEnKTft1 K+vqvzzHA4Yb5R4s8byzdlXCoxSii3T6kV3iXNmSAfQ20lil3blUXmCTn+5tBiMS+ezQ S8XxzpsUH44DeK7zR7IsckoN18e9v8JKVB+z0pTBwwjZGxetCPlozs+kbmW+7VmfeyY5 Nn7Ca6We2x59Sz8dzw45VERetbole1DsbHT3SRiu5QlNm/mu7WxkO9k8wj50joAE4DAW 6FskoiVmiA0k2gbP5d6HSCNVYugWRYbfMt1388l++WuPUIzoaQisVDg8k/EPOJLzSmEJ V7pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=j6HuWtKX; 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 h20si8813550ejk.652.2020.07.12.23.19.20; Sun, 12 Jul 2020 23:19:43 -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=j6HuWtKX; 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 S1729197AbgGMGSp (ORCPT + 99 others); Mon, 13 Jul 2020 02:18:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725804AbgGMGSp (ORCPT ); Mon, 13 Jul 2020 02:18:45 -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 1A5AFC061794 for ; Sun, 12 Jul 2020 23:18:45 -0700 (PDT) Received: by mail-pl1-x641.google.com with SMTP id m16so3866848pls.5 for ; Sun, 12 Jul 2020 23:18:45 -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=j6HuWtKXJA0LJN3It5/huBCCyvIsHDa95qy/PrtPY0SHVarddS5eFhjMMqvUr4b+tV 8op+y5evL7Ai0OdNrqE6iKaPeBgO5uEtIyX5YC0whmpQvgIgeCV7Z1Dp5Jwmr6DmexUQ BfVUXfMTrzwTHvoNEGDIJEetl2T1Ps2RMrxWRClU7psHNsYbXnZtg4Yg6YFz4a/1p6V1 kQIcJN9pkyXPaUI5Tpz7rAshwzulXlfAdOyJRTL2Ok5xJswtLtf6mdKL9N9qyLKbaGQC nCsoaTYmKMvQCdMWzwhXIIclBJYLn/td3cxCkF9me1ACxIMayTj9gYip7js9DgxZjOdL wZEQ== 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=KlXUnqSdYe1ATUvPBqv/W3SqlPqtKLNHHWdi4YzzwS6uU8XPHUOoKaLE/FQXoNhEsd oyLuTnusQaQ6QPGlfLSsBJ8Q+ZlxKWWeqcFTfiXEpPUjI2KRdg+Qkob66Kx3syx+6u3d ODCptGPpNXghCE1+uIzauTgTZY/ZeNBIKCwHHbCTB6duSwin3r6dOCzafs/csdfIx785 SFatGzZBGj5/0iN3xoJya1s0YDN1ppu6nrqQVJsw4VaCAEShM6Rj1RHtR5jSI8Eao6Na bldd6Q7chhD4p2Pw25teEmeHjPR8p1g8vIzmPq0GwVeOtliLx5gFQAmArNhA9TzB1WOB XO4g== X-Gm-Message-State: AOAM53202gMV53YHxRm+CH+JYu1jYd9I+k6ZcDV2bbBW6V1JissUhUUe Ap7oWYy5XOWjgf/q2kheI0l5ek3v9+Y/yQ== X-Received: by 2002:a17:90a:8a8b:: with SMTP id x11mr19062807pjn.127.1594621124489; Sun, 12 Jul 2020 23:18:44 -0700 (PDT) Received: from nsathish-Latitude-7480.iind.intel.com (jfdmzpr04-ext.jf.intel.com. [134.134.137.73]) by smtp.gmail.com with ESMTPSA id 204sm13096371pfx.3.2020.07.12.23.18.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Jul 2020 23:18:44 -0700 (PDT) From: Sathish Narasimman X-Google-Original-From: Sathish Narasimman To: linux-bluetooth@vger.kernel.org Cc: Sathish Narasimman Subject: [PATCH v4 4/8] Bluetooth: Translate additional address type during le_conn Date: Mon, 13 Jul 2020 11:52:09 +0530 Message-Id: <20200713062213.3692-5-sathish.narasimman@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200713062213.3692-1-sathish.narasimman@intel.com> References: <20200713062213.3692-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