diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2014-03-24 14:21:50 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-03-26 12:31:35 -0400 |
commit | 9c84d1da974ee8b54fa49ae369648a0247b7cd6f (patch) | |
tree | 467b0eb8a32f9d6316d16ddb10c219c099fe1195 /net/bluetooth | |
parent | 4408dd15d9cfcf78b819d2d4a5b43dc36056cab8 (diff) |
Bluetooth: Move local identity address setting to a central place
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>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/hci_conn.c | 4 | ||||
-rw-r--r-- | 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 d958e2dca52f..129c22a85ccf 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) | |||
401 | case ACL_LINK: | 401 | case ACL_LINK: |
402 | conn->pkt_type = hdev->pkt_type & ACL_PTYPE_MASK; | 402 | conn->pkt_type = hdev->pkt_type & ACL_PTYPE_MASK; |
403 | break; | 403 | break; |
404 | case LE_LINK: | ||
405 | /* conn->src should reflect the local identity address */ | ||
406 | hci_copy_identity_address(hdev, &conn->src, &conn->src_type); | ||
407 | break; | ||
404 | case SCO_LINK: | 408 | case SCO_LINK: |
405 | if (lmp_esco_capable(hdev)) | 409 | if (lmp_esco_capable(hdev)) |
406 | conn->pkt_type = (hdev->esco_type & SCO_ESCO_MASK) | | 410 | conn->pkt_type = (hdev->esco_type & SCO_ESCO_MASK) | |
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index d0efeeeb6951..cfdada38369b 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -3840,17 +3840,6 @@ static void hci_le_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) | |||
3840 | 3840 | ||
3841 | conn->dst_type = ev->bdaddr_type; | 3841 | conn->dst_type = ev->bdaddr_type; |
3842 | 3842 | ||
3843 | /* The advertising parameters for own address type | ||
3844 | * define which source address and source address | ||
3845 | * type this connections has. | ||
3846 | */ | ||
3847 | if (bacmp(&conn->src, BDADDR_ANY)) { | ||
3848 | conn->src_type = ADDR_LE_DEV_PUBLIC; | ||
3849 | } else { | ||
3850 | bacpy(&conn->src, &hdev->static_addr); | ||
3851 | conn->src_type = ADDR_LE_DEV_RANDOM; | ||
3852 | } | ||
3853 | |||
3854 | if (ev->role == LE_CONN_ROLE_MASTER) { | 3843 | if (ev->role == LE_CONN_ROLE_MASTER) { |
3855 | conn->out = true; | 3844 | conn->out = true; |
3856 | conn->link_mode |= HCI_LM_MASTER; | 3845 | conn->link_mode |= HCI_LM_MASTER; |
@@ -3892,11 +3881,6 @@ static void hci_le_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) | |||
3892 | cancel_delayed_work(&conn->le_conn_timeout); | 3881 | cancel_delayed_work(&conn->le_conn_timeout); |
3893 | } | 3882 | } |
3894 | 3883 | ||
3895 | /* Ensure that the hci_conn contains the identity address type | ||
3896 | * regardless of which address the connection was made with. | ||
3897 | */ | ||
3898 | hci_copy_identity_address(hdev, &conn->src, &conn->src_type); | ||
3899 | |||
3900 | /* Lookup the identity address from the stored connection | 3884 | /* Lookup the identity address from the stored connection |
3901 | * address and address type. | 3885 | * address and address type. |
3902 | * | 3886 | * |