diff options
author | Johan Hedberg <johan.hedberg@nokia.com> | 2011-02-19 10:05:57 -0500 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-02-21 15:22:44 -0500 |
commit | a5c296832b4fde7d32c01cff9cdd27d9c7c1c4f5 (patch) | |
tree | 895ae41944ca568f6eca3c7c4855211bd7db8540 /net/bluetooth/hci_event.c | |
parent | e9a416b5ce0c0f93819f55d34cf6882196e9c3b2 (diff) |
Bluetooth: Add management support for user confirmation request
This patch adds support for the user confirmation (numeric comparison)
Secure Simple Pairing authentication method.
Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth/hci_event.c')
-rw-r--r-- | net/bluetooth/hci_event.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 98b5764e4315..604c7b5fee97 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -796,6 +796,29 @@ static void hci_cc_le_read_buffer_size(struct hci_dev *hdev, | |||
796 | hci_req_complete(hdev, HCI_OP_LE_READ_BUFFER_SIZE, rp->status); | 796 | hci_req_complete(hdev, HCI_OP_LE_READ_BUFFER_SIZE, rp->status); |
797 | } | 797 | } |
798 | 798 | ||
799 | static void hci_cc_user_confirm_reply(struct hci_dev *hdev, struct sk_buff *skb) | ||
800 | { | ||
801 | struct hci_rp_user_confirm_reply *rp = (void *) skb->data; | ||
802 | |||
803 | BT_DBG("%s status 0x%x", hdev->name, rp->status); | ||
804 | |||
805 | if (test_bit(HCI_MGMT, &hdev->flags)) | ||
806 | mgmt_user_confirm_reply_complete(hdev->id, &rp->bdaddr, | ||
807 | rp->status); | ||
808 | } | ||
809 | |||
810 | static void hci_cc_user_confirm_neg_reply(struct hci_dev *hdev, | ||
811 | struct sk_buff *skb) | ||
812 | { | ||
813 | struct hci_rp_user_confirm_reply *rp = (void *) skb->data; | ||
814 | |||
815 | BT_DBG("%s status 0x%x", hdev->name, rp->status); | ||
816 | |||
817 | if (test_bit(HCI_MGMT, &hdev->flags)) | ||
818 | mgmt_user_confirm_neg_reply_complete(hdev->id, &rp->bdaddr, | ||
819 | rp->status); | ||
820 | } | ||
821 | |||
799 | static inline void hci_cs_inquiry(struct hci_dev *hdev, __u8 status) | 822 | static inline void hci_cs_inquiry(struct hci_dev *hdev, __u8 status) |
800 | { | 823 | { |
801 | BT_DBG("%s status 0x%x", hdev->name, status); | 824 | BT_DBG("%s status 0x%x", hdev->name, status); |
@@ -1728,6 +1751,14 @@ static inline void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *sk | |||
1728 | hci_cc_le_read_buffer_size(hdev, skb); | 1751 | hci_cc_le_read_buffer_size(hdev, skb); |
1729 | break; | 1752 | break; |
1730 | 1753 | ||
1754 | case HCI_OP_USER_CONFIRM_REPLY: | ||
1755 | hci_cc_user_confirm_reply(hdev, skb); | ||
1756 | break; | ||
1757 | |||
1758 | case HCI_OP_USER_CONFIRM_NEG_REPLY: | ||
1759 | hci_cc_user_confirm_neg_reply(hdev, skb); | ||
1760 | break; | ||
1761 | |||
1731 | default: | 1762 | default: |
1732 | BT_DBG("%s opcode 0x%x", hdev->name, opcode); | 1763 | BT_DBG("%s opcode 0x%x", hdev->name, opcode); |
1733 | break; | 1764 | break; |
@@ -2362,6 +2393,21 @@ unlock: | |||
2362 | hci_dev_unlock(hdev); | 2393 | hci_dev_unlock(hdev); |
2363 | } | 2394 | } |
2364 | 2395 | ||
2396 | static inline void hci_user_confirm_request_evt(struct hci_dev *hdev, | ||
2397 | struct sk_buff *skb) | ||
2398 | { | ||
2399 | struct hci_ev_user_confirm_req *ev = (void *) skb->data; | ||
2400 | |||
2401 | BT_DBG("%s", hdev->name); | ||
2402 | |||
2403 | hci_dev_lock(hdev); | ||
2404 | |||
2405 | if (test_bit(HCI_MGMT, &hdev->flags)) | ||
2406 | mgmt_user_confirm_request(hdev->id, &ev->bdaddr, ev->passkey); | ||
2407 | |||
2408 | hci_dev_unlock(hdev); | ||
2409 | } | ||
2410 | |||
2365 | static inline void hci_simple_pair_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) | 2411 | static inline void hci_simple_pair_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) |
2366 | { | 2412 | { |
2367 | struct hci_ev_simple_pair_complete *ev = (void *) skb->data; | 2413 | struct hci_ev_simple_pair_complete *ev = (void *) skb->data; |
@@ -2580,6 +2626,10 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb) | |||
2580 | hci_io_capa_reply_evt(hdev, skb); | 2626 | hci_io_capa_reply_evt(hdev, skb); |
2581 | break; | 2627 | break; |
2582 | 2628 | ||
2629 | case HCI_EV_USER_CONFIRM_REQUEST: | ||
2630 | hci_user_confirm_request_evt(hdev, skb); | ||
2631 | break; | ||
2632 | |||
2583 | case HCI_EV_SIMPLE_PAIR_COMPLETE: | 2633 | case HCI_EV_SIMPLE_PAIR_COMPLETE: |
2584 | hci_simple_pair_complete_evt(hdev, skb); | 2634 | hci_simple_pair_complete_evt(hdev, skb); |
2585 | break; | 2635 | break; |