aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/mgmt.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2015-03-10 16:34:40 -0400
committerMarcel Holtmann <marcel@holtmann.org>2015-03-10 16:42:05 -0400
commit55e76b38986a61259f3079afd0f9a865651a34fe (patch)
tree896a09d711e70975b996268dea4d77c60a5bd47a /net/bluetooth/mgmt.c
parent406ef2a67bd0bb13d77d5e5d700e36a2caea09ae (diff)
Bluetooth: Add 'Already Paired' error for Pair Device command
To make the behavior predictable when attempting to pair with a device for which we already have a Link Key or Long Term Key, this patch adds a new 'Already Paired' error which gets sent in such a scenario. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/mgmt.c')
-rw-r--r--net/bluetooth/mgmt.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 49b8e09ffe67..600636c00d34 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -3245,6 +3245,13 @@ static int pair_device(struct sock *sk, struct hci_dev *hdev, void *data,
3245 goto unlock; 3245 goto unlock;
3246 } 3246 }
3247 3247
3248 if (hci_bdaddr_is_paired(hdev, &cp->addr.bdaddr, cp->addr.type)) {
3249 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_PAIR_DEVICE,
3250 MGMT_STATUS_ALREADY_PAIRED, &rp,
3251 sizeof(rp));
3252 goto unlock;
3253 }
3254
3248 sec_level = BT_SECURITY_MEDIUM; 3255 sec_level = BT_SECURITY_MEDIUM;
3249 auth_type = HCI_AT_DEDICATED_BONDING; 3256 auth_type = HCI_AT_DEDICATED_BONDING;
3250 3257