Bluetooth: Store the source address type of LE connections

When establishing LE connections, it is possible to use a public
address (if available) or a random address. The type of address
is only known when creating connections, so make sure it is
stored in hci_conn structure.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Marcel Holtmann 2013-10-13 03:57:39 -07:00 коммит произвёл Johan Hedberg
Родитель 79d95a19a4
Коммит e7c4096e16
2 изменённых файлов: 8 добавлений и 4 удалений

Просмотреть файл

@ -300,6 +300,7 @@ struct hci_conn {
bdaddr_t dst; bdaddr_t dst;
__u8 dst_type; __u8 dst_type;
__u8 src_type;
__u16 handle; __u16 handle;
__u16 state; __u16 state;
__u8 mode; __u8 mode;

Просмотреть файл

@ -566,10 +566,7 @@ static int hci_create_le_conn(struct hci_conn *conn)
cp.scan_window = cpu_to_le16(hdev->le_scan_window); cp.scan_window = cpu_to_le16(hdev->le_scan_window);
bacpy(&cp.peer_addr, &conn->dst); bacpy(&cp.peer_addr, &conn->dst);
cp.peer_addr_type = conn->dst_type; cp.peer_addr_type = conn->dst_type;
if (bacmp(&hdev->bdaddr, BDADDR_ANY)) cp.own_address_type = conn->src_type;
cp.own_address_type = ADDR_LE_DEV_PUBLIC;
else
cp.own_address_type = ADDR_LE_DEV_RANDOM;
cp.conn_interval_min = __constant_cpu_to_le16(0x0028); cp.conn_interval_min = __constant_cpu_to_le16(0x0028);
cp.conn_interval_max = __constant_cpu_to_le16(0x0038); cp.conn_interval_max = __constant_cpu_to_le16(0x0038);
cp.supervision_timeout = __constant_cpu_to_le16(0x002a); cp.supervision_timeout = __constant_cpu_to_le16(0x002a);
@ -626,6 +623,12 @@ static struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst,
conn->dst_type = ADDR_LE_DEV_PUBLIC; conn->dst_type = ADDR_LE_DEV_PUBLIC;
else else
conn->dst_type = ADDR_LE_DEV_RANDOM; conn->dst_type = ADDR_LE_DEV_RANDOM;
if (bacmp(&hdev->bdaddr, BDADDR_ANY))
conn->src_type = ADDR_LE_DEV_PUBLIC;
else
conn->src_type = ADDR_LE_DEV_RANDOM;
conn->state = BT_CONNECT; conn->state = BT_CONNECT;
conn->out = true; conn->out = true;
conn->link_mode |= HCI_LM_MASTER; conn->link_mode |= HCI_LM_MASTER;