diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2013-10-18 19:38:09 -0400 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2013-10-19 09:28:06 -0400 |
commit | 79830f66e3cbd224bcf697b032dce9828b5a3c9e (patch) | |
tree | 420c67d76a63acee3b8996d36683325e5fc6cb32 /net | |
parent | 8f8625cd8067827e2450e4ddec20f5521896114a (diff) |
Bluetooth: Select the own address type during initial setup phase
The own address type is based on the fact if the controller has
a public address or not. This means that this detail can be just
configured once during setup phase.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/bluetooth/hci_conn.c | 7 | ||||
-rw-r--r-- | net/bluetooth/hci_core.c | 13 | ||||
-rw-r--r-- | net/bluetooth/mgmt.c | 10 |
3 files changed, 15 insertions, 15 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 4e726505f52b..974d7bccbb6f 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c | |||
@@ -615,12 +615,7 @@ static struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst, | |||
615 | else | 615 | else |
616 | conn->dst_type = ADDR_LE_DEV_RANDOM; | 616 | conn->dst_type = ADDR_LE_DEV_RANDOM; |
617 | 617 | ||
618 | if (bacmp(&conn->src, BDADDR_ANY)) { | 618 | conn->src_type = hdev->own_addr_type; |
619 | conn->src_type = ADDR_LE_DEV_PUBLIC; | ||
620 | } else { | ||
621 | bacpy(&conn->src, &hdev->static_addr); | ||
622 | conn->src_type = ADDR_LE_DEV_RANDOM; | ||
623 | } | ||
624 | 619 | ||
625 | conn->state = BT_CONNECT; | 620 | conn->state = BT_CONNECT; |
626 | conn->out = true; | 621 | conn->out = true; |
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 6b1844f00fbf..c130a239c0de 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -1053,8 +1053,19 @@ static void hci_init3_req(struct hci_request *req, unsigned long opt) | |||
1053 | if (hdev->commands[5] & 0x10) | 1053 | if (hdev->commands[5] & 0x10) |
1054 | hci_setup_link_policy(req); | 1054 | hci_setup_link_policy(req); |
1055 | 1055 | ||
1056 | if (lmp_le_capable(hdev)) | 1056 | if (lmp_le_capable(hdev)) { |
1057 | /* If the controller has a public BD_ADDR, then by | ||
1058 | * default use that one. If this is a LE only | ||
1059 | * controller without one, default to the random | ||
1060 | * address. | ||
1061 | */ | ||
1062 | if (bacmp(&hdev->bdaddr, BDADDR_ANY)) | ||
1063 | hdev->own_addr_type = ADDR_LE_DEV_PUBLIC; | ||
1064 | else | ||
1065 | hdev->own_addr_type = ADDR_LE_DEV_RANDOM; | ||
1066 | |||
1057 | hci_set_le_support(req); | 1067 | hci_set_le_support(req); |
1068 | } | ||
1058 | 1069 | ||
1059 | /* Read features beyond page 1 if available */ | 1070 | /* Read features beyond page 1 if available */ |
1060 | for (p = 2; p < HCI_MAX_PAGES && p <= hdev->max_page; p++) { | 1071 | for (p = 2; p < HCI_MAX_PAGES && p <= hdev->max_page; p++) { |
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index a727b47fcac5..fb7fc9f17af1 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -1325,10 +1325,7 @@ static void enable_advertising(struct hci_request *req) | |||
1325 | cp.min_interval = __constant_cpu_to_le16(0x0800); | 1325 | cp.min_interval = __constant_cpu_to_le16(0x0800); |
1326 | cp.max_interval = __constant_cpu_to_le16(0x0800); | 1326 | cp.max_interval = __constant_cpu_to_le16(0x0800); |
1327 | cp.type = get_adv_type(hdev); | 1327 | cp.type = get_adv_type(hdev); |
1328 | if (bacmp(&hdev->bdaddr, BDADDR_ANY)) | 1328 | cp.own_address_type = hdev->own_addr_type; |
1329 | cp.own_address_type = ADDR_LE_DEV_PUBLIC; | ||
1330 | else | ||
1331 | cp.own_address_type = ADDR_LE_DEV_RANDOM; | ||
1332 | cp.channel_map = 0x07; | 1329 | cp.channel_map = 0x07; |
1333 | 1330 | ||
1334 | hci_req_add(req, HCI_OP_LE_SET_ADV_PARAM, sizeof(cp), &cp); | 1331 | hci_req_add(req, HCI_OP_LE_SET_ADV_PARAM, sizeof(cp), &cp); |
@@ -3237,10 +3234,7 @@ static int start_discovery(struct sock *sk, struct hci_dev *hdev, | |||
3237 | param_cp.type = LE_SCAN_ACTIVE; | 3234 | param_cp.type = LE_SCAN_ACTIVE; |
3238 | param_cp.interval = cpu_to_le16(DISCOV_LE_SCAN_INT); | 3235 | param_cp.interval = cpu_to_le16(DISCOV_LE_SCAN_INT); |
3239 | param_cp.window = cpu_to_le16(DISCOV_LE_SCAN_WIN); | 3236 | param_cp.window = cpu_to_le16(DISCOV_LE_SCAN_WIN); |
3240 | if (bacmp(&hdev->bdaddr, BDADDR_ANY)) | 3237 | param_cp.own_address_type = hdev->own_addr_type; |
3241 | param_cp.own_address_type = ADDR_LE_DEV_PUBLIC; | ||
3242 | else | ||
3243 | param_cp.own_address_type = ADDR_LE_DEV_RANDOM; | ||
3244 | hci_req_add(&req, HCI_OP_LE_SET_SCAN_PARAM, sizeof(param_cp), | 3238 | hci_req_add(&req, HCI_OP_LE_SET_SCAN_PARAM, sizeof(param_cp), |
3245 | ¶m_cp); | 3239 | ¶m_cp); |
3246 | 3240 | ||