Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH v3 1/4] Bluetooth: Move local identity address setting to a central place
@ 2014-03-14 17:22 johan.hedberg
  2014-03-14 17:22 ` [PATCH v3 2/4] Bluetooth: Fix LE responder/initiator address setting johan.hedberg
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: johan.hedberg @ 2014-03-14 17:22 UTC (permalink / raw)
  To: linux-bluetooth

From: Johan Hedberg <johan.hedberg@intel.com>

Any time hci_conn_add is used for an LE connection we need to ensure
that the local identity address is correctly described in the src and
src_type variables. This patch moves setting these values directly into
hci_conn_add so that callers don't have to duplicate the effort
themselves.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
 net/bluetooth/hci_conn.c  |  4 ++++
 net/bluetooth/hci_event.c | 16 ----------------
 2 files changed, 4 insertions(+), 16 deletions(-)

diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index b4809e473a19..1a025b953f19 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -401,6 +401,10 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst)
 	case ACL_LINK:
 		conn->pkt_type = hdev->pkt_type & ACL_PTYPE_MASK;
 		break;
+	case LE_LINK:
+		/* conn->src should reflect the local identity address */
+		hci_copy_identity_address(hdev, &conn->src, &conn->src_type);
+		break;
 	case SCO_LINK:
 		if (lmp_esco_capable(hdev))
 			conn->pkt_type = (hdev->esco_type & SCO_ESCO_MASK) |
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index e97f1905aa5c..7346ebd4c7d9 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -3769,17 +3769,6 @@ static void hci_le_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
 
 		conn->dst_type = ev->bdaddr_type;
 
-		/* The advertising parameters for own address type
-		 * define which source address and source address
-		 * type this connections has.
-		 */
-		if (bacmp(&conn->src, BDADDR_ANY)) {
-			conn->src_type = ADDR_LE_DEV_PUBLIC;
-		} else {
-			bacpy(&conn->src, &hdev->static_addr);
-			conn->src_type = ADDR_LE_DEV_RANDOM;
-		}
-
 		if (ev->role == LE_CONN_ROLE_MASTER) {
 			conn->out = true;
 			conn->link_mode |= HCI_LM_MASTER;
@@ -3821,11 +3810,6 @@ static void hci_le_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
 		cancel_delayed_work(&conn->le_conn_timeout);
 	}
 
-	/* Ensure that the hci_conn contains the identity address type
-	 * regardless of which address the connection was made with.
-	 */
-	hci_copy_identity_address(hdev, &conn->src, &conn->src_type);
-
 	/* Lookup the identity address from the stored connection
 	 * address and address type.
 	 *
-- 
1.8.5.3


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-03-16  7:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-14 17:22 [PATCH v3 1/4] Bluetooth: Move local identity address setting to a central place johan.hedberg
2014-03-14 17:22 ` [PATCH v3 2/4] Bluetooth: Fix LE responder/initiator address setting johan.hedberg
2014-03-14 17:22 ` [PATCH v3 3/4] Bluetooth: Add error mapping for Directed Advertising Timeout johan.hedberg
2014-03-14 17:22 ` [PATCH v3 4/4] Bluetooth: Add directed advertising support through connect() johan.hedberg
2014-03-15 16:22   ` Marcel Holtmann
2014-03-15 16:36     ` Johan Hedberg
2014-03-15 18:36   ` [PATCH v4 " johan.hedberg
2014-03-16  7:14     ` [PATCH v5 " johan.hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox