diff options
Diffstat (limited to 'net/bluetooth/hci_event.c')
-rw-r--r-- | net/bluetooth/hci_event.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 47656beee14c..1ba929c05d0d 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -3040,6 +3040,50 @@ static void hci_extended_inquiry_result_evt(struct hci_dev *hdev, | |||
3040 | hci_dev_unlock(hdev); | 3040 | hci_dev_unlock(hdev); |
3041 | } | 3041 | } |
3042 | 3042 | ||
3043 | static void hci_key_refresh_complete_evt(struct hci_dev *hdev, | ||
3044 | struct sk_buff *skb) | ||
3045 | { | ||
3046 | struct hci_ev_key_refresh_complete *ev = (void *) skb->data; | ||
3047 | struct hci_conn *conn; | ||
3048 | |||
3049 | BT_DBG("%s status %u handle %u", hdev->name, ev->status, | ||
3050 | __le16_to_cpu(ev->handle)); | ||
3051 | |||
3052 | hci_dev_lock(hdev); | ||
3053 | |||
3054 | conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); | ||
3055 | if (!conn) | ||
3056 | goto unlock; | ||
3057 | |||
3058 | if (!ev->status) | ||
3059 | conn->sec_level = conn->pending_sec_level; | ||
3060 | |||
3061 | clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags); | ||
3062 | |||
3063 | if (ev->status && conn->state == BT_CONNECTED) { | ||
3064 | hci_acl_disconn(conn, HCI_ERROR_AUTH_FAILURE); | ||
3065 | hci_conn_put(conn); | ||
3066 | goto unlock; | ||
3067 | } | ||
3068 | |||
3069 | if (conn->state == BT_CONFIG) { | ||
3070 | if (!ev->status) | ||
3071 | conn->state = BT_CONNECTED; | ||
3072 | |||
3073 | hci_proto_connect_cfm(conn, ev->status); | ||
3074 | hci_conn_put(conn); | ||
3075 | } else { | ||
3076 | hci_auth_cfm(conn, ev->status); | ||
3077 | |||
3078 | hci_conn_hold(conn); | ||
3079 | conn->disc_timeout = HCI_DISCONN_TIMEOUT; | ||
3080 | hci_conn_put(conn); | ||
3081 | } | ||
3082 | |||
3083 | unlock: | ||
3084 | hci_dev_unlock(hdev); | ||
3085 | } | ||
3086 | |||
3043 | static u8 hci_get_auth_req(struct hci_conn *conn) | 3087 | static u8 hci_get_auth_req(struct hci_conn *conn) |
3044 | { | 3088 | { |
3045 | /* If remote requests dedicated bonding follow that lead */ | 3089 | /* If remote requests dedicated bonding follow that lead */ |
@@ -3560,6 +3604,10 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb) | |||
3560 | hci_extended_inquiry_result_evt(hdev, skb); | 3604 | hci_extended_inquiry_result_evt(hdev, skb); |
3561 | break; | 3605 | break; |
3562 | 3606 | ||
3607 | case HCI_EV_KEY_REFRESH_COMPLETE: | ||
3608 | hci_key_refresh_complete_evt(hdev, skb); | ||
3609 | break; | ||
3610 | |||
3563 | case HCI_EV_IO_CAPA_REQUEST: | 3611 | case HCI_EV_IO_CAPA_REQUEST: |
3564 | hci_io_capa_request_evt(hdev, skb); | 3612 | hci_io_capa_request_evt(hdev, skb); |
3565 | break; | 3613 | break; |