Bluetooth: Update source address and type for incoming LE connections
authorMarcel Holtmann <marcel@holtmann.org>
Sun, 13 Oct 2013 14:25:18 +0000 (07:25 -0700)
committerJohan Hedberg <johan.hedberg@intel.com>
Sun, 13 Oct 2013 14:48:29 +0000 (17:48 +0300)
The incoming LE connections do not have a proper source address and
address type set. The connection needs to be set with the same values
as used for advertising parameters.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
net/bluetooth/hci_event.c

index bbe2d292c4a93fe92f017df91655ae542d287840..aa6fed3a553b222ab385b80f7ee0b69e6a3ca9ae 100644 (file)
@@ -3477,6 +3477,17 @@ 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;