hci_event.c (dbf6811abbfcc79d3cd5ce1ff53fe1c741167a1f) | hci_event.c (ae61a10d9d46c4a0844c46d0863bf991c4dda66c) |
---|---|
1/* 2 BlueZ - Bluetooth protocol stack for Linux 3 Copyright (c) 2000-2001, 2010, Code Aurora Forum. All rights reserved. 4 5 Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> 6 7 This program is free software; you can redistribute it and/or modify 8 it under the terms of the GNU General Public License version 2 as --- 31 unchanged lines hidden (view full) --- 40 41#define ZERO_KEY "\x00\x00\x00\x00\x00\x00\x00\x00" \ 42 "\x00\x00\x00\x00\x00\x00\x00\x00" 43 44#define secs_to_jiffies(_secs) msecs_to_jiffies((_secs) * 1000) 45 46/* Handle HCI Event packets */ 47 | 1/* 2 BlueZ - Bluetooth protocol stack for Linux 3 Copyright (c) 2000-2001, 2010, Code Aurora Forum. All rights reserved. 4 5 Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> 6 7 This program is free software; you can redistribute it and/or modify 8 it under the terms of the GNU General Public License version 2 as --- 31 unchanged lines hidden (view full) --- 40 41#define ZERO_KEY "\x00\x00\x00\x00\x00\x00\x00\x00" \ 42 "\x00\x00\x00\x00\x00\x00\x00\x00" 43 44#define secs_to_jiffies(_secs) msecs_to_jiffies((_secs) * 1000) 45 46/* Handle HCI Event packets */ 47 |
48static void *hci_ev_skb_pull(struct hci_dev *hdev, struct sk_buff *skb, 49 u8 ev, size_t len) 50{ 51 void *data; 52 53 data = skb_pull_data(skb, len); 54 if (!data) 55 bt_dev_err(hdev, "Malformed Event: 0x%2.2x", ev); 56 57 return data; 58} 59 |
|
48static void hci_cc_inquiry_cancel(struct hci_dev *hdev, struct sk_buff *skb, 49 u8 *new_status) 50{ 51 __u8 status = *((__u8 *) skb->data); 52 53 BT_DBG("%s status 0x%2.2x", hdev->name, status); 54 55 /* It is possible that we receive Inquiry Complete event right --- 2621 unchanged lines hidden (view full) --- 2677 if (conn) 2678 clear_bit(HCI_CONN_RSWITCH_PEND, &conn->flags); 2679 2680 hci_dev_unlock(hdev); 2681} 2682 2683static void hci_inquiry_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) 2684{ | 60static void hci_cc_inquiry_cancel(struct hci_dev *hdev, struct sk_buff *skb, 61 u8 *new_status) 62{ 63 __u8 status = *((__u8 *) skb->data); 64 65 BT_DBG("%s status 0x%2.2x", hdev->name, status); 66 67 /* It is possible that we receive Inquiry Complete event right --- 2621 unchanged lines hidden (view full) --- 2689 if (conn) 2690 clear_bit(HCI_CONN_RSWITCH_PEND, &conn->flags); 2691 2692 hci_dev_unlock(hdev); 2693} 2694 2695static void hci_inquiry_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) 2696{ |
2685 __u8 status = *((__u8 *) skb->data); | 2697 struct hci_ev_status *ev; |
2686 struct discovery_state *discov = &hdev->discovery; 2687 struct inquiry_entry *e; 2688 | 2698 struct discovery_state *discov = &hdev->discovery; 2699 struct inquiry_entry *e; 2700 |
2689 BT_DBG("%s status 0x%2.2x", hdev->name, status); | 2701 ev = hci_ev_skb_pull(hdev, skb, HCI_EV_INQUIRY_COMPLETE, sizeof(*ev)); 2702 if (!ev) 2703 return; |
2690 | 2704 |
2705 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); 2706 |
|
2691 hci_conn_check_pending(hdev); 2692 2693 if (!test_and_clear_bit(HCI_INQUIRY, &hdev->flags)) 2694 return; 2695 2696 smp_mb__after_atomic(); /* wake_up_bit advises about this barrier */ 2697 wake_up_bit(&hdev->flags, HCI_INQUIRY); 2698 --- 76 unchanged lines hidden (view full) --- 2775 flags, NULL, 0, NULL, 0); 2776 } 2777 2778 hci_dev_unlock(hdev); 2779} 2780 2781static void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) 2782{ | 2707 hci_conn_check_pending(hdev); 2708 2709 if (!test_and_clear_bit(HCI_INQUIRY, &hdev->flags)) 2710 return; 2711 2712 smp_mb__after_atomic(); /* wake_up_bit advises about this barrier */ 2713 wake_up_bit(&hdev->flags, HCI_INQUIRY); 2714 --- 76 unchanged lines hidden (view full) --- 2791 flags, NULL, 0, NULL, 0); 2792 } 2793 2794 hci_dev_unlock(hdev); 2795} 2796 2797static void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) 2798{ |
2783 struct hci_ev_conn_complete *ev = (void *) skb->data; | 2799 struct hci_ev_conn_complete *ev; |
2784 struct hci_conn *conn; 2785 | 2800 struct hci_conn *conn; 2801 |
2802 ev = hci_ev_skb_pull(hdev, skb, HCI_EV_CONN_COMPLETE, sizeof(*ev)); 2803 if (!ev) 2804 return; 2805 |
|
2786 BT_DBG("%s", hdev->name); 2787 2788 hci_dev_lock(hdev); 2789 2790 conn = hci_conn_hash_lookup_ba(hdev, ev->link_type, &ev->bdaddr); 2791 if (!conn) { 2792 /* Connection may not exist if auto-connected. Check the bredr 2793 * allowlist to see if this device is allowed to auto connect. --- 105 unchanged lines hidden (view full) --- 2899 2900 bacpy(&cp.bdaddr, bdaddr); 2901 cp.reason = HCI_ERROR_REJ_BAD_ADDR; 2902 hci_send_cmd(hdev, HCI_OP_REJECT_CONN_REQ, sizeof(cp), &cp); 2903} 2904 2905static void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb) 2906{ | 2806 BT_DBG("%s", hdev->name); 2807 2808 hci_dev_lock(hdev); 2809 2810 conn = hci_conn_hash_lookup_ba(hdev, ev->link_type, &ev->bdaddr); 2811 if (!conn) { 2812 /* Connection may not exist if auto-connected. Check the bredr 2813 * allowlist to see if this device is allowed to auto connect. --- 105 unchanged lines hidden (view full) --- 2919 2920 bacpy(&cp.bdaddr, bdaddr); 2921 cp.reason = HCI_ERROR_REJ_BAD_ADDR; 2922 hci_send_cmd(hdev, HCI_OP_REJECT_CONN_REQ, sizeof(cp), &cp); 2923} 2924 2925static void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb) 2926{ |
2907 struct hci_ev_conn_request *ev = (void *) skb->data; | 2927 struct hci_ev_conn_request *ev; |
2908 int mask = hdev->link_mode; 2909 struct inquiry_entry *ie; 2910 struct hci_conn *conn; 2911 __u8 flags = 0; 2912 | 2928 int mask = hdev->link_mode; 2929 struct inquiry_entry *ie; 2930 struct hci_conn *conn; 2931 __u8 flags = 0; 2932 |
2933 ev = hci_ev_skb_pull(hdev, skb, HCI_EV_CONN_REQUEST, sizeof(*ev)); 2934 if (!ev) 2935 return; 2936 |
|
2913 BT_DBG("%s bdaddr %pMR type 0x%x", hdev->name, &ev->bdaddr, 2914 ev->link_type); 2915 2916 mask |= hci_proto_connect_ind(hdev, &ev->bdaddr, ev->link_type, 2917 &flags); 2918 2919 if (!(mask & HCI_LM_ACCEPT)) { 2920 hci_reject_conn(hdev, &ev->bdaddr); --- 89 unchanged lines hidden (view full) --- 3010 return MGMT_DEV_DISCONN_LOCAL_HOST; 3011 default: 3012 return MGMT_DEV_DISCONN_UNKNOWN; 3013 } 3014} 3015 3016static void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) 3017{ | 2937 BT_DBG("%s bdaddr %pMR type 0x%x", hdev->name, &ev->bdaddr, 2938 ev->link_type); 2939 2940 mask |= hci_proto_connect_ind(hdev, &ev->bdaddr, ev->link_type, 2941 &flags); 2942 2943 if (!(mask & HCI_LM_ACCEPT)) { 2944 hci_reject_conn(hdev, &ev->bdaddr); --- 89 unchanged lines hidden (view full) --- 3034 return MGMT_DEV_DISCONN_LOCAL_HOST; 3035 default: 3036 return MGMT_DEV_DISCONN_UNKNOWN; 3037 } 3038} 3039 3040static void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) 3041{ |
3018 struct hci_ev_disconn_complete *ev = (void *) skb->data; | 3042 struct hci_ev_disconn_complete *ev; |
3019 u8 reason; 3020 struct hci_conn_params *params; 3021 struct hci_conn *conn; 3022 bool mgmt_connected; 3023 | 3043 u8 reason; 3044 struct hci_conn_params *params; 3045 struct hci_conn *conn; 3046 bool mgmt_connected; 3047 |
3048 ev = hci_ev_skb_pull(hdev, skb, HCI_EV_DISCONN_COMPLETE, sizeof(*ev)); 3049 if (!ev) 3050 return; 3051 |
|
3024 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); 3025 3026 hci_dev_lock(hdev); 3027 3028 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); 3029 if (!conn) 3030 goto unlock; 3031 --- 62 unchanged lines hidden (view full) --- 3094 hci_conn_del(conn); 3095 3096unlock: 3097 hci_dev_unlock(hdev); 3098} 3099 3100static void hci_auth_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) 3101{ | 3052 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); 3053 3054 hci_dev_lock(hdev); 3055 3056 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); 3057 if (!conn) 3058 goto unlock; 3059 --- 62 unchanged lines hidden (view full) --- 3122 hci_conn_del(conn); 3123 3124unlock: 3125 hci_dev_unlock(hdev); 3126} 3127 3128static void hci_auth_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) 3129{ |
3102 struct hci_ev_auth_complete *ev = (void *) skb->data; | 3130 struct hci_ev_auth_complete *ev; |
3103 struct hci_conn *conn; 3104 | 3131 struct hci_conn *conn; 3132 |
3133 ev = hci_ev_skb_pull(hdev, skb, HCI_EV_AUTH_COMPLETE, sizeof(*ev)); 3134 if (!ev) 3135 return; 3136 |
|
3105 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); 3106 3107 hci_dev_lock(hdev); 3108 3109 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); 3110 if (!conn) 3111 goto unlock; 3112 --- 51 unchanged lines hidden (view full) --- 3164 } 3165 3166unlock: 3167 hci_dev_unlock(hdev); 3168} 3169 3170static void hci_remote_name_evt(struct hci_dev *hdev, struct sk_buff *skb) 3171{ | 3137 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); 3138 3139 hci_dev_lock(hdev); 3140 3141 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); 3142 if (!conn) 3143 goto unlock; 3144 --- 51 unchanged lines hidden (view full) --- 3196 } 3197 3198unlock: 3199 hci_dev_unlock(hdev); 3200} 3201 3202static void hci_remote_name_evt(struct hci_dev *hdev, struct sk_buff *skb) 3203{ |
3172 struct hci_ev_remote_name *ev = (void *) skb->data; | 3204 struct hci_ev_remote_name *ev; |
3173 struct hci_conn *conn; 3174 | 3205 struct hci_conn *conn; 3206 |
3207 ev = hci_ev_skb_pull(hdev, skb, HCI_EV_REMOTE_NAME, sizeof(*ev)); 3208 if (!ev) 3209 return; 3210 |
|
3175 BT_DBG("%s", hdev->name); 3176 3177 hci_conn_check_pending(hdev); 3178 3179 hci_dev_lock(hdev); 3180 3181 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); 3182 --- 64 unchanged lines hidden (view full) --- 3247 hci_encrypt_cfm(conn, 0); 3248 3249unlock: 3250 hci_dev_unlock(hdev); 3251} 3252 3253static void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff *skb) 3254{ | 3211 BT_DBG("%s", hdev->name); 3212 3213 hci_conn_check_pending(hdev); 3214 3215 hci_dev_lock(hdev); 3216 3217 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); 3218 --- 64 unchanged lines hidden (view full) --- 3283 hci_encrypt_cfm(conn, 0); 3284 3285unlock: 3286 hci_dev_unlock(hdev); 3287} 3288 3289static void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff *skb) 3290{ |
3255 struct hci_ev_encrypt_change *ev = (void *) skb->data; | 3291 struct hci_ev_encrypt_change *ev; |
3256 struct hci_conn *conn; 3257 | 3292 struct hci_conn *conn; 3293 |
3294 ev = hci_ev_skb_pull(hdev, skb, HCI_EV_ENCRYPT_CHANGE, sizeof(*ev)); 3295 if (!ev) 3296 return; 3297 |
|
3258 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); 3259 3260 hci_dev_lock(hdev); 3261 3262 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); 3263 if (!conn) 3264 goto unlock; 3265 --- 96 unchanged lines hidden (view full) --- 3362 3363unlock: 3364 hci_dev_unlock(hdev); 3365} 3366 3367static void hci_change_link_key_complete_evt(struct hci_dev *hdev, 3368 struct sk_buff *skb) 3369{ | 3298 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); 3299 3300 hci_dev_lock(hdev); 3301 3302 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); 3303 if (!conn) 3304 goto unlock; 3305 --- 96 unchanged lines hidden (view full) --- 3402 3403unlock: 3404 hci_dev_unlock(hdev); 3405} 3406 3407static void hci_change_link_key_complete_evt(struct hci_dev *hdev, 3408 struct sk_buff *skb) 3409{ |
3370 struct hci_ev_change_link_key_complete *ev = (void *) skb->data; | 3410 struct hci_ev_change_link_key_complete *ev; |
3371 struct hci_conn *conn; 3372 | 3411 struct hci_conn *conn; 3412 |
3413 ev = hci_ev_skb_pull(hdev, skb, HCI_EV_CHANGE_LINK_KEY_COMPLETE, 3414 sizeof(*ev)); 3415 if (!ev) 3416 return; 3417 |
|
3373 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); 3374 3375 hci_dev_lock(hdev); 3376 3377 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); 3378 if (conn) { 3379 if (!ev->status) 3380 set_bit(HCI_CONN_SECURE, &conn->flags); --- 4 unchanged lines hidden (view full) --- 3385 } 3386 3387 hci_dev_unlock(hdev); 3388} 3389 3390static void hci_remote_features_evt(struct hci_dev *hdev, 3391 struct sk_buff *skb) 3392{ | 3418 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); 3419 3420 hci_dev_lock(hdev); 3421 3422 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); 3423 if (conn) { 3424 if (!ev->status) 3425 set_bit(HCI_CONN_SECURE, &conn->flags); --- 4 unchanged lines hidden (view full) --- 3430 } 3431 3432 hci_dev_unlock(hdev); 3433} 3434 3435static void hci_remote_features_evt(struct hci_dev *hdev, 3436 struct sk_buff *skb) 3437{ |
3393 struct hci_ev_remote_features *ev = (void *) skb->data; | 3438 struct hci_ev_remote_features *ev; |
3394 struct hci_conn *conn; 3395 | 3439 struct hci_conn *conn; 3440 |
3441 ev = hci_ev_skb_pull(hdev, skb, HCI_EV_REMOTE_FEATURES, sizeof(*ev)); 3442 if (!ev) 3443 return; 3444 |
|
3396 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); 3397 3398 hci_dev_lock(hdev); 3399 3400 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); 3401 if (!conn) 3402 goto unlock; 3403 --- 432 unchanged lines hidden (view full) --- 3836 queue_work(hdev->workqueue, &hdev->cmd_work); 3837} 3838 3839static void hci_cmd_status_evt(struct hci_dev *hdev, struct sk_buff *skb, 3840 u16 *opcode, u8 *status, 3841 hci_req_complete_t *req_complete, 3842 hci_req_complete_skb_t *req_complete_skb) 3843{ | 3445 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); 3446 3447 hci_dev_lock(hdev); 3448 3449 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); 3450 if (!conn) 3451 goto unlock; 3452 --- 432 unchanged lines hidden (view full) --- 3885 queue_work(hdev->workqueue, &hdev->cmd_work); 3886} 3887 3888static void hci_cmd_status_evt(struct hci_dev *hdev, struct sk_buff *skb, 3889 u16 *opcode, u8 *status, 3890 hci_req_complete_t *req_complete, 3891 hci_req_complete_skb_t *req_complete_skb) 3892{ |
3844 struct hci_ev_cmd_status *ev = (void *) skb->data; | 3893 struct hci_ev_cmd_status *ev; |
3845 | 3894 |
3846 skb_pull(skb, sizeof(*ev)); | 3895 ev = hci_ev_skb_pull(hdev, skb, HCI_EV_CMD_STATUS, sizeof(*ev)); 3896 if (!ev) 3897 return; |
3847 3848 *opcode = __le16_to_cpu(ev->opcode); 3849 *status = ev->status; 3850 3851 switch (*opcode) { 3852 case HCI_OP_INQUIRY: 3853 hci_cs_inquiry(hdev, ev->status); 3854 break; --- 91 unchanged lines hidden (view full) --- 3946 } 3947 3948 if (atomic_read(&hdev->cmd_cnt) && !skb_queue_empty(&hdev->cmd_q)) 3949 queue_work(hdev->workqueue, &hdev->cmd_work); 3950} 3951 3952static void hci_hardware_error_evt(struct hci_dev *hdev, struct sk_buff *skb) 3953{ | 3898 3899 *opcode = __le16_to_cpu(ev->opcode); 3900 *status = ev->status; 3901 3902 switch (*opcode) { 3903 case HCI_OP_INQUIRY: 3904 hci_cs_inquiry(hdev, ev->status); 3905 break; --- 91 unchanged lines hidden (view full) --- 3997 } 3998 3999 if (atomic_read(&hdev->cmd_cnt) && !skb_queue_empty(&hdev->cmd_q)) 4000 queue_work(hdev->workqueue, &hdev->cmd_work); 4001} 4002 4003static void hci_hardware_error_evt(struct hci_dev *hdev, struct sk_buff *skb) 4004{ |
3954 struct hci_ev_hardware_error *ev = (void *) skb->data; | 4005 struct hci_ev_hardware_error *ev; |
3955 | 4006 |
4007 ev = hci_ev_skb_pull(hdev, skb, HCI_EV_HARDWARE_ERROR, sizeof(*ev)); 4008 if (!ev) 4009 return; 4010 |
|
3956 hdev->hw_error_code = ev->code; 3957 3958 queue_work(hdev->req_workqueue, &hdev->error_reset); 3959} 3960 3961static void hci_role_change_evt(struct hci_dev *hdev, struct sk_buff *skb) 3962{ | 4011 hdev->hw_error_code = ev->code; 4012 4013 queue_work(hdev->req_workqueue, &hdev->error_reset); 4014} 4015 4016static void hci_role_change_evt(struct hci_dev *hdev, struct sk_buff *skb) 4017{ |
3963 struct hci_ev_role_change *ev = (void *) skb->data; | 4018 struct hci_ev_role_change *ev; |
3964 struct hci_conn *conn; 3965 | 4019 struct hci_conn *conn; 4020 |
4021 ev = hci_ev_skb_pull(hdev, skb, HCI_EV_ROLE_CHANGE, sizeof(*ev)); 4022 if (!ev) 4023 return; 4024 |
|
3966 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); 3967 3968 hci_dev_lock(hdev); 3969 3970 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); 3971 if (conn) { 3972 if (!ev->status) 3973 conn->role = ev->role; --- 91 unchanged lines hidden (view full) --- 4065 break; 4066 } 4067 4068 return NULL; 4069} 4070 4071static void hci_num_comp_blocks_evt(struct hci_dev *hdev, struct sk_buff *skb) 4072{ | 4025 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); 4026 4027 hci_dev_lock(hdev); 4028 4029 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); 4030 if (conn) { 4031 if (!ev->status) 4032 conn->role = ev->role; --- 91 unchanged lines hidden (view full) --- 4124 break; 4125 } 4126 4127 return NULL; 4128} 4129 4130static void hci_num_comp_blocks_evt(struct hci_dev *hdev, struct sk_buff *skb) 4131{ |
4073 struct hci_ev_num_comp_blocks *ev = (void *) skb->data; | 4132 struct hci_ev_num_comp_blocks *ev; |
4074 int i; 4075 | 4133 int i; 4134 |
4135 ev = hci_ev_skb_pull(hdev, skb, HCI_EV_NUM_COMP_BLOCKS, sizeof(*ev)); 4136 if (!ev) 4137 return; 4138 4139 if (!hci_ev_skb_pull(hdev, skb, HCI_EV_NUM_COMP_BLOCKS, 4140 flex_array_size(ev, handles, ev->num_hndl))) 4141 return; 4142 |
|
4076 if (hdev->flow_ctl_mode != HCI_FLOW_CTL_MODE_BLOCK_BASED) { 4077 bt_dev_err(hdev, "wrong event for mode %d", hdev->flow_ctl_mode); 4078 return; 4079 } 4080 | 4143 if (hdev->flow_ctl_mode != HCI_FLOW_CTL_MODE_BLOCK_BASED) { 4144 bt_dev_err(hdev, "wrong event for mode %d", hdev->flow_ctl_mode); 4145 return; 4146 } 4147 |
4081 if (skb->len < sizeof(*ev) || 4082 skb->len < struct_size(ev, handles, ev->num_hndl)) { 4083 BT_DBG("%s bad parameters", hdev->name); 4084 return; 4085 } 4086 | |
4087 BT_DBG("%s num_blocks %d num_hndl %d", hdev->name, ev->num_blocks, 4088 ev->num_hndl); 4089 4090 for (i = 0; i < ev->num_hndl; i++) { 4091 struct hci_comp_blocks_info *info = &ev->handles[i]; 4092 struct hci_conn *conn = NULL; 4093 __u16 handle, block_count; 4094 --- 21 unchanged lines hidden (view full) --- 4116 } 4117 } 4118 4119 queue_work(hdev->workqueue, &hdev->tx_work); 4120} 4121 4122static void hci_mode_change_evt(struct hci_dev *hdev, struct sk_buff *skb) 4123{ | 4148 BT_DBG("%s num_blocks %d num_hndl %d", hdev->name, ev->num_blocks, 4149 ev->num_hndl); 4150 4151 for (i = 0; i < ev->num_hndl; i++) { 4152 struct hci_comp_blocks_info *info = &ev->handles[i]; 4153 struct hci_conn *conn = NULL; 4154 __u16 handle, block_count; 4155 --- 21 unchanged lines hidden (view full) --- 4177 } 4178 } 4179 4180 queue_work(hdev->workqueue, &hdev->tx_work); 4181} 4182 4183static void hci_mode_change_evt(struct hci_dev *hdev, struct sk_buff *skb) 4184{ |
4124 struct hci_ev_mode_change *ev = (void *) skb->data; | 4185 struct hci_ev_mode_change *ev; |
4125 struct hci_conn *conn; 4126 | 4186 struct hci_conn *conn; 4187 |
4188 ev = hci_ev_skb_pull(hdev, skb, HCI_EV_MODE_CHANGE, sizeof(*ev)); 4189 if (!ev) 4190 return; 4191 |
|
4127 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); 4128 4129 hci_dev_lock(hdev); 4130 4131 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); 4132 if (conn) { 4133 conn->mode = ev->mode; 4134 --- 9 unchanged lines hidden (view full) --- 4144 hci_sco_setup(conn, ev->status); 4145 } 4146 4147 hci_dev_unlock(hdev); 4148} 4149 4150static void hci_pin_code_request_evt(struct hci_dev *hdev, struct sk_buff *skb) 4151{ | 4192 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); 4193 4194 hci_dev_lock(hdev); 4195 4196 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); 4197 if (conn) { 4198 conn->mode = ev->mode; 4199 --- 9 unchanged lines hidden (view full) --- 4209 hci_sco_setup(conn, ev->status); 4210 } 4211 4212 hci_dev_unlock(hdev); 4213} 4214 4215static void hci_pin_code_request_evt(struct hci_dev *hdev, struct sk_buff *skb) 4216{ |
4152 struct hci_ev_pin_code_req *ev = (void *) skb->data; | 4217 struct hci_ev_pin_code_req *ev; |
4153 struct hci_conn *conn; 4154 | 4218 struct hci_conn *conn; 4219 |
4220 ev = hci_ev_skb_pull(hdev, skb, HCI_EV_PIN_CODE_REQ, sizeof(*ev)); 4221 if (!ev) 4222 return; 4223 |
|
4155 BT_DBG("%s", hdev->name); 4156 4157 hci_dev_lock(hdev); 4158 4159 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); 4160 if (!conn) 4161 goto unlock; 4162 --- 51 unchanged lines hidden (view full) --- 4214 case HCI_LK_AUTH_COMBINATION_P256: 4215 conn->pending_sec_level = BT_SECURITY_FIPS; 4216 break; 4217 } 4218} 4219 4220static void hci_link_key_request_evt(struct hci_dev *hdev, struct sk_buff *skb) 4221{ | 4224 BT_DBG("%s", hdev->name); 4225 4226 hci_dev_lock(hdev); 4227 4228 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); 4229 if (!conn) 4230 goto unlock; 4231 --- 51 unchanged lines hidden (view full) --- 4283 case HCI_LK_AUTH_COMBINATION_P256: 4284 conn->pending_sec_level = BT_SECURITY_FIPS; 4285 break; 4286 } 4287} 4288 4289static void hci_link_key_request_evt(struct hci_dev *hdev, struct sk_buff *skb) 4290{ |
4222 struct hci_ev_link_key_req *ev = (void *) skb->data; | 4291 struct hci_ev_link_key_req *ev; |
4223 struct hci_cp_link_key_reply cp; 4224 struct hci_conn *conn; 4225 struct link_key *key; 4226 | 4292 struct hci_cp_link_key_reply cp; 4293 struct hci_conn *conn; 4294 struct link_key *key; 4295 |
4296 ev = hci_ev_skb_pull(hdev, skb, HCI_EV_LINK_KEY_REQ, sizeof(*ev)); 4297 if (!ev) 4298 return; 4299 |
|
4227 BT_DBG("%s", hdev->name); 4228 4229 if (!hci_dev_test_flag(hdev, HCI_MGMT)) 4230 return; 4231 4232 hci_dev_lock(hdev); 4233 4234 key = hci_find_link_key(hdev, &ev->bdaddr); --- 39 unchanged lines hidden (view full) --- 4274 4275not_found: 4276 hci_send_cmd(hdev, HCI_OP_LINK_KEY_NEG_REPLY, 6, &ev->bdaddr); 4277 hci_dev_unlock(hdev); 4278} 4279 4280static void hci_link_key_notify_evt(struct hci_dev *hdev, struct sk_buff *skb) 4281{ | 4300 BT_DBG("%s", hdev->name); 4301 4302 if (!hci_dev_test_flag(hdev, HCI_MGMT)) 4303 return; 4304 4305 hci_dev_lock(hdev); 4306 4307 key = hci_find_link_key(hdev, &ev->bdaddr); --- 39 unchanged lines hidden (view full) --- 4347 4348not_found: 4349 hci_send_cmd(hdev, HCI_OP_LINK_KEY_NEG_REPLY, 6, &ev->bdaddr); 4350 hci_dev_unlock(hdev); 4351} 4352 4353static void hci_link_key_notify_evt(struct hci_dev *hdev, struct sk_buff *skb) 4354{ |
4282 struct hci_ev_link_key_notify *ev = (void *) skb->data; | 4355 struct hci_ev_link_key_notify *ev; |
4283 struct hci_conn *conn; 4284 struct link_key *key; 4285 bool persistent; 4286 u8 pin_len = 0; 4287 | 4356 struct hci_conn *conn; 4357 struct link_key *key; 4358 bool persistent; 4359 u8 pin_len = 0; 4360 |
4361 ev = hci_ev_skb_pull(hdev, skb, HCI_EV_LINK_KEY_NOTIFY, sizeof(*ev)); 4362 if (!ev) 4363 return; 4364 |
|
4288 BT_DBG("%s", hdev->name); 4289 4290 hci_dev_lock(hdev); 4291 4292 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); 4293 if (!conn) 4294 goto unlock; 4295 --- 38 unchanged lines hidden (view full) --- 4334 set_bit(HCI_CONN_FLUSH_KEY, &conn->flags); 4335 4336unlock: 4337 hci_dev_unlock(hdev); 4338} 4339 4340static void hci_clock_offset_evt(struct hci_dev *hdev, struct sk_buff *skb) 4341{ | 4365 BT_DBG("%s", hdev->name); 4366 4367 hci_dev_lock(hdev); 4368 4369 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); 4370 if (!conn) 4371 goto unlock; 4372 --- 38 unchanged lines hidden (view full) --- 4411 set_bit(HCI_CONN_FLUSH_KEY, &conn->flags); 4412 4413unlock: 4414 hci_dev_unlock(hdev); 4415} 4416 4417static void hci_clock_offset_evt(struct hci_dev *hdev, struct sk_buff *skb) 4418{ |
4342 struct hci_ev_clock_offset *ev = (void *) skb->data; | 4419 struct hci_ev_clock_offset *ev; |
4343 struct hci_conn *conn; 4344 | 4420 struct hci_conn *conn; 4421 |
4422 ev = hci_ev_skb_pull(hdev, skb, HCI_EV_CLOCK_OFFSET, sizeof(*ev)); 4423 if (!ev) 4424 return; 4425 |
|
4345 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); 4346 4347 hci_dev_lock(hdev); 4348 4349 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); 4350 if (conn && !ev->status) { 4351 struct inquiry_entry *ie; 4352 --- 4 unchanged lines hidden (view full) --- 4357 } 4358 } 4359 4360 hci_dev_unlock(hdev); 4361} 4362 4363static void hci_pkt_type_change_evt(struct hci_dev *hdev, struct sk_buff *skb) 4364{ | 4426 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); 4427 4428 hci_dev_lock(hdev); 4429 4430 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); 4431 if (conn && !ev->status) { 4432 struct inquiry_entry *ie; 4433 --- 4 unchanged lines hidden (view full) --- 4438 } 4439 } 4440 4441 hci_dev_unlock(hdev); 4442} 4443 4444static void hci_pkt_type_change_evt(struct hci_dev *hdev, struct sk_buff *skb) 4445{ |
4365 struct hci_ev_pkt_type_change *ev = (void *) skb->data; | 4446 struct hci_ev_pkt_type_change *ev; |
4366 struct hci_conn *conn; 4367 | 4447 struct hci_conn *conn; 4448 |
4449 ev = hci_ev_skb_pull(hdev, skb, HCI_EV_PKT_TYPE_CHANGE, sizeof(*ev)); 4450 if (!ev) 4451 return; 4452 |
|
4368 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); 4369 4370 hci_dev_lock(hdev); 4371 4372 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); 4373 if (conn && !ev->status) 4374 conn->pkt_type = __le16_to_cpu(ev->pkt_type); 4375 4376 hci_dev_unlock(hdev); 4377} 4378 4379static void hci_pscan_rep_mode_evt(struct hci_dev *hdev, struct sk_buff *skb) 4380{ | 4453 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); 4454 4455 hci_dev_lock(hdev); 4456 4457 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); 4458 if (conn && !ev->status) 4459 conn->pkt_type = __le16_to_cpu(ev->pkt_type); 4460 4461 hci_dev_unlock(hdev); 4462} 4463 4464static void hci_pscan_rep_mode_evt(struct hci_dev *hdev, struct sk_buff *skb) 4465{ |
4381 struct hci_ev_pscan_rep_mode *ev = (void *) skb->data; | 4466 struct hci_ev_pscan_rep_mode *ev; |
4382 struct inquiry_entry *ie; 4383 | 4467 struct inquiry_entry *ie; 4468 |
4469 ev = hci_ev_skb_pull(hdev, skb, HCI_EV_PSCAN_REP_MODE, sizeof(*ev)); 4470 if (!ev) 4471 return; 4472 |
|
4384 BT_DBG("%s", hdev->name); 4385 4386 hci_dev_lock(hdev); 4387 4388 ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr); 4389 if (ie) { 4390 ie->data.pscan_rep_mode = ev->pscan_rep_mode; 4391 ie->timestamp = jiffies; --- 71 unchanged lines hidden (view full) --- 4463 4464unlock: 4465 hci_dev_unlock(hdev); 4466} 4467 4468static void hci_remote_ext_features_evt(struct hci_dev *hdev, 4469 struct sk_buff *skb) 4470{ | 4473 BT_DBG("%s", hdev->name); 4474 4475 hci_dev_lock(hdev); 4476 4477 ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr); 4478 if (ie) { 4479 ie->data.pscan_rep_mode = ev->pscan_rep_mode; 4480 ie->timestamp = jiffies; --- 71 unchanged lines hidden (view full) --- 4552 4553unlock: 4554 hci_dev_unlock(hdev); 4555} 4556 4557static void hci_remote_ext_features_evt(struct hci_dev *hdev, 4558 struct sk_buff *skb) 4559{ |
4471 struct hci_ev_remote_ext_features *ev = (void *) skb->data; | 4560 struct hci_ev_remote_ext_features *ev; |
4472 struct hci_conn *conn; 4473 | 4561 struct hci_conn *conn; 4562 |
4563 ev = hci_ev_skb_pull(hdev, skb, HCI_EV_REMOTE_EXT_FEATURES, 4564 sizeof(*ev)); 4565 if (!ev) 4566 return; 4567 |
|
4474 BT_DBG("%s", hdev->name); 4475 4476 hci_dev_lock(hdev); 4477 4478 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); 4479 if (!conn) 4480 goto unlock; 4481 --- 45 unchanged lines hidden (view full) --- 4527 4528unlock: 4529 hci_dev_unlock(hdev); 4530} 4531 4532static void hci_sync_conn_complete_evt(struct hci_dev *hdev, 4533 struct sk_buff *skb) 4534{ | 4568 BT_DBG("%s", hdev->name); 4569 4570 hci_dev_lock(hdev); 4571 4572 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); 4573 if (!conn) 4574 goto unlock; 4575 --- 45 unchanged lines hidden (view full) --- 4621 4622unlock: 4623 hci_dev_unlock(hdev); 4624} 4625 4626static void hci_sync_conn_complete_evt(struct hci_dev *hdev, 4627 struct sk_buff *skb) 4628{ |
4535 struct hci_ev_sync_conn_complete *ev = (void *) skb->data; | 4629 struct hci_ev_sync_conn_complete *ev; |
4536 struct hci_conn *conn; 4537 | 4630 struct hci_conn *conn; 4631 |
4632 ev = hci_ev_skb_pull(hdev, skb, HCI_EV_SYNC_CONN_COMPLETE, sizeof(*ev)); 4633 if (!ev) 4634 return; 4635 |
|
4538 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); 4539 4540 hci_dev_lock(hdev); 4541 4542 conn = hci_conn_hash_lookup_ba(hdev, ev->link_type, &ev->bdaddr); 4543 if (!conn) { 4544 if (ev->link_type == ESCO_LINK) 4545 goto unlock; --- 146 unchanged lines hidden (view full) --- 4692 } 4693 4694 hci_dev_unlock(hdev); 4695} 4696 4697static void hci_key_refresh_complete_evt(struct hci_dev *hdev, 4698 struct sk_buff *skb) 4699{ | 4636 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); 4637 4638 hci_dev_lock(hdev); 4639 4640 conn = hci_conn_hash_lookup_ba(hdev, ev->link_type, &ev->bdaddr); 4641 if (!conn) { 4642 if (ev->link_type == ESCO_LINK) 4643 goto unlock; --- 146 unchanged lines hidden (view full) --- 4790 } 4791 4792 hci_dev_unlock(hdev); 4793} 4794 4795static void hci_key_refresh_complete_evt(struct hci_dev *hdev, 4796 struct sk_buff *skb) 4797{ |
4700 struct hci_ev_key_refresh_complete *ev = (void *) skb->data; | 4798 struct hci_ev_key_refresh_complete *ev; |
4701 struct hci_conn *conn; 4702 | 4799 struct hci_conn *conn; 4800 |
4801 ev = hci_ev_skb_pull(hdev, skb, HCI_EV_KEY_REFRESH_COMPLETE, 4802 sizeof(*ev)); 4803 if (!ev) 4804 return; 4805 |
|
4703 BT_DBG("%s status 0x%2.2x handle 0x%4.4x", hdev->name, ev->status, 4704 __le16_to_cpu(ev->handle)); 4705 4706 hci_dev_lock(hdev); 4707 4708 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); 4709 if (!conn) 4710 goto unlock; --- 90 unchanged lines hidden (view full) --- 4801 !memcmp(data->hash192, ZERO_KEY, 16)) 4802 return 0x00; 4803 4804 return 0x01; 4805} 4806 4807static void hci_io_capa_request_evt(struct hci_dev *hdev, struct sk_buff *skb) 4808{ | 4806 BT_DBG("%s status 0x%2.2x handle 0x%4.4x", hdev->name, ev->status, 4807 __le16_to_cpu(ev->handle)); 4808 4809 hci_dev_lock(hdev); 4810 4811 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); 4812 if (!conn) 4813 goto unlock; --- 90 unchanged lines hidden (view full) --- 4904 !memcmp(data->hash192, ZERO_KEY, 16)) 4905 return 0x00; 4906 4907 return 0x01; 4908} 4909 4910static void hci_io_capa_request_evt(struct hci_dev *hdev, struct sk_buff *skb) 4911{ |
4809 struct hci_ev_io_capa_request *ev = (void *) skb->data; | 4912 struct hci_ev_io_capa_request *ev; |
4810 struct hci_conn *conn; 4811 | 4913 struct hci_conn *conn; 4914 |
4915 ev = hci_ev_skb_pull(hdev, skb, HCI_EV_IO_CAPA_REQUEST, sizeof(*ev)); 4916 if (!ev) 4917 return; 4918 |
|
4812 BT_DBG("%s", hdev->name); 4813 4814 hci_dev_lock(hdev); 4815 4816 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); 4817 if (!conn) 4818 goto unlock; 4819 --- 50 unchanged lines hidden (view full) --- 4870 } 4871 4872unlock: 4873 hci_dev_unlock(hdev); 4874} 4875 4876static void hci_io_capa_reply_evt(struct hci_dev *hdev, struct sk_buff *skb) 4877{ | 4919 BT_DBG("%s", hdev->name); 4920 4921 hci_dev_lock(hdev); 4922 4923 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); 4924 if (!conn) 4925 goto unlock; 4926 --- 50 unchanged lines hidden (view full) --- 4977 } 4978 4979unlock: 4980 hci_dev_unlock(hdev); 4981} 4982 4983static void hci_io_capa_reply_evt(struct hci_dev *hdev, struct sk_buff *skb) 4984{ |
4878 struct hci_ev_io_capa_reply *ev = (void *) skb->data; | 4985 struct hci_ev_io_capa_reply *ev; |
4879 struct hci_conn *conn; 4880 | 4986 struct hci_conn *conn; 4987 |
4988 ev = hci_ev_skb_pull(hdev, skb, HCI_EV_IO_CAPA_REPLY, sizeof(*ev)); 4989 if (!ev) 4990 return; 4991 |
|
4881 BT_DBG("%s", hdev->name); 4882 4883 hci_dev_lock(hdev); 4884 4885 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); 4886 if (!conn) 4887 goto unlock; 4888 4889 conn->remote_cap = ev->capability; 4890 conn->remote_auth = ev->authentication; 4891 4892unlock: 4893 hci_dev_unlock(hdev); 4894} 4895 4896static void hci_user_confirm_request_evt(struct hci_dev *hdev, 4897 struct sk_buff *skb) 4898{ | 4992 BT_DBG("%s", hdev->name); 4993 4994 hci_dev_lock(hdev); 4995 4996 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); 4997 if (!conn) 4998 goto unlock; 4999 5000 conn->remote_cap = ev->capability; 5001 conn->remote_auth = ev->authentication; 5002 5003unlock: 5004 hci_dev_unlock(hdev); 5005} 5006 5007static void hci_user_confirm_request_evt(struct hci_dev *hdev, 5008 struct sk_buff *skb) 5009{ |
4899 struct hci_ev_user_confirm_req *ev = (void *) skb->data; | 5010 struct hci_ev_user_confirm_req *ev; |
4900 int loc_mitm, rem_mitm, confirm_hint = 0; 4901 struct hci_conn *conn; 4902 | 5011 int loc_mitm, rem_mitm, confirm_hint = 0; 5012 struct hci_conn *conn; 5013 |
5014 ev = hci_ev_skb_pull(hdev, skb, HCI_EV_USER_CONFIRM_REQUEST, 5015 sizeof(*ev)); 5016 if (!ev) 5017 return; 5018 |
|
4903 BT_DBG("%s", hdev->name); 4904 4905 hci_dev_lock(hdev); 4906 4907 if (!hci_dev_test_flag(hdev, HCI_MGMT)) 4908 goto unlock; 4909 4910 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); --- 65 unchanged lines hidden (view full) --- 4976 4977unlock: 4978 hci_dev_unlock(hdev); 4979} 4980 4981static void hci_user_passkey_request_evt(struct hci_dev *hdev, 4982 struct sk_buff *skb) 4983{ | 5019 BT_DBG("%s", hdev->name); 5020 5021 hci_dev_lock(hdev); 5022 5023 if (!hci_dev_test_flag(hdev, HCI_MGMT)) 5024 goto unlock; 5025 5026 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); --- 65 unchanged lines hidden (view full) --- 5092 5093unlock: 5094 hci_dev_unlock(hdev); 5095} 5096 5097static void hci_user_passkey_request_evt(struct hci_dev *hdev, 5098 struct sk_buff *skb) 5099{ |
4984 struct hci_ev_user_passkey_req *ev = (void *) skb->data; | 5100 struct hci_ev_user_passkey_req *ev; |
4985 | 5101 |
5102 ev = hci_ev_skb_pull(hdev, skb, HCI_EV_USER_PASSKEY_REQUEST, 5103 sizeof(*ev)); 5104 if (!ev) 5105 return; 5106 |
|
4986 BT_DBG("%s", hdev->name); 4987 4988 if (hci_dev_test_flag(hdev, HCI_MGMT)) 4989 mgmt_user_passkey_request(hdev, &ev->bdaddr, ACL_LINK, 0); 4990} 4991 4992static void hci_user_passkey_notify_evt(struct hci_dev *hdev, 4993 struct sk_buff *skb) 4994{ | 5107 BT_DBG("%s", hdev->name); 5108 5109 if (hci_dev_test_flag(hdev, HCI_MGMT)) 5110 mgmt_user_passkey_request(hdev, &ev->bdaddr, ACL_LINK, 0); 5111} 5112 5113static void hci_user_passkey_notify_evt(struct hci_dev *hdev, 5114 struct sk_buff *skb) 5115{ |
4995 struct hci_ev_user_passkey_notify *ev = (void *) skb->data; | 5116 struct hci_ev_user_passkey_notify *ev; |
4996 struct hci_conn *conn; 4997 | 5117 struct hci_conn *conn; 5118 |
5119 ev = hci_ev_skb_pull(hdev, skb, HCI_EV_USER_PASSKEY_NOTIFY, 5120 sizeof(*ev)); 5121 if (!ev) 5122 return; 5123 |
|
4998 BT_DBG("%s", hdev->name); 4999 5000 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); 5001 if (!conn) 5002 return; 5003 5004 conn->passkey_notify = __le32_to_cpu(ev->passkey); 5005 conn->passkey_entered = 0; 5006 5007 if (hci_dev_test_flag(hdev, HCI_MGMT)) 5008 mgmt_user_passkey_notify(hdev, &conn->dst, conn->type, 5009 conn->dst_type, conn->passkey_notify, 5010 conn->passkey_entered); 5011} 5012 5013static void hci_keypress_notify_evt(struct hci_dev *hdev, struct sk_buff *skb) 5014{ | 5124 BT_DBG("%s", hdev->name); 5125 5126 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); 5127 if (!conn) 5128 return; 5129 5130 conn->passkey_notify = __le32_to_cpu(ev->passkey); 5131 conn->passkey_entered = 0; 5132 5133 if (hci_dev_test_flag(hdev, HCI_MGMT)) 5134 mgmt_user_passkey_notify(hdev, &conn->dst, conn->type, 5135 conn->dst_type, conn->passkey_notify, 5136 conn->passkey_entered); 5137} 5138 5139static void hci_keypress_notify_evt(struct hci_dev *hdev, struct sk_buff *skb) 5140{ |
5015 struct hci_ev_keypress_notify *ev = (void *) skb->data; | 5141 struct hci_ev_keypress_notify *ev; |
5016 struct hci_conn *conn; 5017 | 5142 struct hci_conn *conn; 5143 |
5144 ev = hci_ev_skb_pull(hdev, skb, HCI_EV_KEYPRESS_NOTIFY, sizeof(*ev)); 5145 if (!ev) 5146 return; 5147 |
|
5018 BT_DBG("%s", hdev->name); 5019 5020 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); 5021 if (!conn) 5022 return; 5023 5024 switch (ev->type) { 5025 case HCI_KEYPRESS_STARTED: --- 20 unchanged lines hidden (view full) --- 5046 mgmt_user_passkey_notify(hdev, &conn->dst, conn->type, 5047 conn->dst_type, conn->passkey_notify, 5048 conn->passkey_entered); 5049} 5050 5051static void hci_simple_pair_complete_evt(struct hci_dev *hdev, 5052 struct sk_buff *skb) 5053{ | 5148 BT_DBG("%s", hdev->name); 5149 5150 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); 5151 if (!conn) 5152 return; 5153 5154 switch (ev->type) { 5155 case HCI_KEYPRESS_STARTED: --- 20 unchanged lines hidden (view full) --- 5176 mgmt_user_passkey_notify(hdev, &conn->dst, conn->type, 5177 conn->dst_type, conn->passkey_notify, 5178 conn->passkey_entered); 5179} 5180 5181static void hci_simple_pair_complete_evt(struct hci_dev *hdev, 5182 struct sk_buff *skb) 5183{ |
5054 struct hci_ev_simple_pair_complete *ev = (void *) skb->data; | 5184 struct hci_ev_simple_pair_complete *ev; |
5055 struct hci_conn *conn; 5056 | 5185 struct hci_conn *conn; 5186 |
5187 ev = hci_ev_skb_pull(hdev, skb, HCI_EV_SIMPLE_PAIR_COMPLETE, 5188 sizeof(*ev)); 5189 if (!ev) 5190 return; 5191 |
|
5057 BT_DBG("%s", hdev->name); 5058 5059 hci_dev_lock(hdev); 5060 5061 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); 5062 if (!conn) 5063 goto unlock; 5064 --- 12 unchanged lines hidden (view full) --- 5077 5078unlock: 5079 hci_dev_unlock(hdev); 5080} 5081 5082static void hci_remote_host_features_evt(struct hci_dev *hdev, 5083 struct sk_buff *skb) 5084{ | 5192 BT_DBG("%s", hdev->name); 5193 5194 hci_dev_lock(hdev); 5195 5196 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); 5197 if (!conn) 5198 goto unlock; 5199 --- 12 unchanged lines hidden (view full) --- 5212 5213unlock: 5214 hci_dev_unlock(hdev); 5215} 5216 5217static void hci_remote_host_features_evt(struct hci_dev *hdev, 5218 struct sk_buff *skb) 5219{ |
5085 struct hci_ev_remote_host_features *ev = (void *) skb->data; | 5220 struct hci_ev_remote_host_features *ev; |
5086 struct inquiry_entry *ie; 5087 struct hci_conn *conn; 5088 | 5221 struct inquiry_entry *ie; 5222 struct hci_conn *conn; 5223 |
5224 ev = hci_ev_skb_pull(hdev, skb, HCI_EV_REMOTE_HOST_FEATURES, 5225 sizeof(*ev)); 5226 if (!ev) 5227 return; 5228 |
|
5089 BT_DBG("%s", hdev->name); 5090 5091 hci_dev_lock(hdev); 5092 5093 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); 5094 if (conn) 5095 memcpy(conn->features[1], ev->features, 8); 5096 5097 ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr); 5098 if (ie) 5099 ie->data.ssp_mode = (ev->features[0] & LMP_HOST_SSP); 5100 5101 hci_dev_unlock(hdev); 5102} 5103 5104static void hci_remote_oob_data_request_evt(struct hci_dev *hdev, 5105 struct sk_buff *skb) 5106{ | 5229 BT_DBG("%s", hdev->name); 5230 5231 hci_dev_lock(hdev); 5232 5233 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); 5234 if (conn) 5235 memcpy(conn->features[1], ev->features, 8); 5236 5237 ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr); 5238 if (ie) 5239 ie->data.ssp_mode = (ev->features[0] & LMP_HOST_SSP); 5240 5241 hci_dev_unlock(hdev); 5242} 5243 5244static void hci_remote_oob_data_request_evt(struct hci_dev *hdev, 5245 struct sk_buff *skb) 5246{ |
5107 struct hci_ev_remote_oob_data_request *ev = (void *) skb->data; | 5247 struct hci_ev_remote_oob_data_request *ev; |
5108 struct oob_data *data; 5109 | 5248 struct oob_data *data; 5249 |
5250 ev = hci_ev_skb_pull(hdev, skb, HCI_EV_REMOTE_OOB_DATA_REQUEST, 5251 sizeof(*ev)); 5252 if (!ev) 5253 return; 5254 |
|
5110 BT_DBG("%s", hdev->name); 5111 5112 hci_dev_lock(hdev); 5113 5114 if (!hci_dev_test_flag(hdev, HCI_MGMT)) 5115 goto unlock; 5116 5117 data = hci_find_remote_oob_data(hdev, &ev->bdaddr, BDADDR_BREDR); --- 35 unchanged lines hidden (view full) --- 5153 5154unlock: 5155 hci_dev_unlock(hdev); 5156} 5157 5158#if IS_ENABLED(CONFIG_BT_HS) 5159static void hci_chan_selected_evt(struct hci_dev *hdev, struct sk_buff *skb) 5160{ | 5255 BT_DBG("%s", hdev->name); 5256 5257 hci_dev_lock(hdev); 5258 5259 if (!hci_dev_test_flag(hdev, HCI_MGMT)) 5260 goto unlock; 5261 5262 data = hci_find_remote_oob_data(hdev, &ev->bdaddr, BDADDR_BREDR); --- 35 unchanged lines hidden (view full) --- 5298 5299unlock: 5300 hci_dev_unlock(hdev); 5301} 5302 5303#if IS_ENABLED(CONFIG_BT_HS) 5304static void hci_chan_selected_evt(struct hci_dev *hdev, struct sk_buff *skb) 5305{ |
5161 struct hci_ev_channel_selected *ev = (void *)skb->data; | 5306 struct hci_ev_channel_selected *ev; |
5162 struct hci_conn *hcon; 5163 | 5307 struct hci_conn *hcon; 5308 |
5309 ev = hci_ev_skb_pull(hdev, skb, HCI_EV_CHANNEL_SELECTED, sizeof(*ev)); 5310 if (!ev) 5311 return; 5312 |
|
5164 BT_DBG("%s handle 0x%2.2x", hdev->name, ev->phy_handle); 5165 | 5313 BT_DBG("%s handle 0x%2.2x", hdev->name, ev->phy_handle); 5314 |
5166 skb_pull(skb, sizeof(*ev)); 5167 | |
5168 hcon = hci_conn_hash_lookup_handle(hdev, ev->phy_handle); 5169 if (!hcon) 5170 return; 5171 5172 amp_read_loc_assoc_final_data(hdev, hcon); 5173} 5174 5175static void hci_phy_link_complete_evt(struct hci_dev *hdev, 5176 struct sk_buff *skb) 5177{ | 5315 hcon = hci_conn_hash_lookup_handle(hdev, ev->phy_handle); 5316 if (!hcon) 5317 return; 5318 5319 amp_read_loc_assoc_final_data(hdev, hcon); 5320} 5321 5322static void hci_phy_link_complete_evt(struct hci_dev *hdev, 5323 struct sk_buff *skb) 5324{ |
5178 struct hci_ev_phy_link_complete *ev = (void *) skb->data; | 5325 struct hci_ev_phy_link_complete *ev; |
5179 struct hci_conn *hcon, *bredr_hcon; 5180 | 5326 struct hci_conn *hcon, *bredr_hcon; 5327 |
5328 ev = hci_ev_skb_pull(hdev, skb, HCI_EV_PHY_LINK_COMPLETE, sizeof(*ev)); 5329 if (!ev) 5330 return; 5331 |
|
5181 BT_DBG("%s handle 0x%2.2x status 0x%2.2x", hdev->name, ev->phy_handle, 5182 ev->status); 5183 5184 hci_dev_lock(hdev); 5185 5186 hcon = hci_conn_hash_lookup_handle(hdev, ev->phy_handle); 5187 if (!hcon) 5188 goto unlock; --- 21 unchanged lines hidden (view full) --- 5210 amp_physical_cfm(bredr_hcon, hcon); 5211 5212unlock: 5213 hci_dev_unlock(hdev); 5214} 5215 5216static void hci_loglink_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) 5217{ | 5332 BT_DBG("%s handle 0x%2.2x status 0x%2.2x", hdev->name, ev->phy_handle, 5333 ev->status); 5334 5335 hci_dev_lock(hdev); 5336 5337 hcon = hci_conn_hash_lookup_handle(hdev, ev->phy_handle); 5338 if (!hcon) 5339 goto unlock; --- 21 unchanged lines hidden (view full) --- 5361 amp_physical_cfm(bredr_hcon, hcon); 5362 5363unlock: 5364 hci_dev_unlock(hdev); 5365} 5366 5367static void hci_loglink_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) 5368{ |
5218 struct hci_ev_logical_link_complete *ev = (void *) skb->data; | 5369 struct hci_ev_logical_link_complete *ev; |
5219 struct hci_conn *hcon; 5220 struct hci_chan *hchan; 5221 struct amp_mgr *mgr; 5222 | 5370 struct hci_conn *hcon; 5371 struct hci_chan *hchan; 5372 struct amp_mgr *mgr; 5373 |
5374 ev = hci_ev_skb_pull(hdev, skb, HCI_EV_LOGICAL_LINK_COMPLETE, 5375 sizeof(*ev)); 5376 if (!ev) 5377 return; 5378 |
|
5223 BT_DBG("%s log_handle 0x%4.4x phy_handle 0x%2.2x status 0x%2.2x", 5224 hdev->name, le16_to_cpu(ev->handle), ev->phy_handle, 5225 ev->status); 5226 5227 hcon = hci_conn_hash_lookup_handle(hdev, ev->phy_handle); 5228 if (!hcon) 5229 return; 5230 --- 19 unchanged lines hidden (view full) --- 5250 5251 l2cap_chan_unlock(bredr_chan); 5252 } 5253} 5254 5255static void hci_disconn_loglink_complete_evt(struct hci_dev *hdev, 5256 struct sk_buff *skb) 5257{ | 5379 BT_DBG("%s log_handle 0x%4.4x phy_handle 0x%2.2x status 0x%2.2x", 5380 hdev->name, le16_to_cpu(ev->handle), ev->phy_handle, 5381 ev->status); 5382 5383 hcon = hci_conn_hash_lookup_handle(hdev, ev->phy_handle); 5384 if (!hcon) 5385 return; 5386 --- 19 unchanged lines hidden (view full) --- 5406 5407 l2cap_chan_unlock(bredr_chan); 5408 } 5409} 5410 5411static void hci_disconn_loglink_complete_evt(struct hci_dev *hdev, 5412 struct sk_buff *skb) 5413{ |
5258 struct hci_ev_disconn_logical_link_complete *ev = (void *) skb->data; | 5414 struct hci_ev_disconn_logical_link_complete *ev; |
5259 struct hci_chan *hchan; 5260 | 5415 struct hci_chan *hchan; 5416 |
5417 ev = hci_ev_skb_pull(hdev, skb, HCI_EV_DISCONN_LOGICAL_LINK_COMPLETE, 5418 sizeof(*ev)); 5419 if (!ev) 5420 return; 5421 |
|
5261 BT_DBG("%s log handle 0x%4.4x status 0x%2.2x", hdev->name, 5262 le16_to_cpu(ev->handle), ev->status); 5263 5264 if (ev->status) 5265 return; 5266 5267 hci_dev_lock(hdev); 5268 --- 5 unchanged lines hidden (view full) --- 5274 5275unlock: 5276 hci_dev_unlock(hdev); 5277} 5278 5279static void hci_disconn_phylink_complete_evt(struct hci_dev *hdev, 5280 struct sk_buff *skb) 5281{ | 5422 BT_DBG("%s log handle 0x%4.4x status 0x%2.2x", hdev->name, 5423 le16_to_cpu(ev->handle), ev->status); 5424 5425 if (ev->status) 5426 return; 5427 5428 hci_dev_lock(hdev); 5429 --- 5 unchanged lines hidden (view full) --- 5435 5436unlock: 5437 hci_dev_unlock(hdev); 5438} 5439 5440static void hci_disconn_phylink_complete_evt(struct hci_dev *hdev, 5441 struct sk_buff *skb) 5442{ |
5282 struct hci_ev_disconn_phy_link_complete *ev = (void *) skb->data; | 5443 struct hci_ev_disconn_phy_link_complete *ev; |
5283 struct hci_conn *hcon; 5284 | 5444 struct hci_conn *hcon; 5445 |
5446 ev = hci_ev_skb_pull(hdev, skb, HCI_EV_DISCONN_PHY_LINK_COMPLETE, 5447 sizeof(*ev)); 5448 if (!ev) 5449 return; 5450 |
|
5285 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); 5286 5287 if (ev->status) 5288 return; 5289 5290 hci_dev_lock(hdev); 5291 5292 hcon = hci_conn_hash_lookup_handle(hdev, ev->phy_handle); --- 1359 unchanged lines hidden --- | 5451 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); 5452 5453 if (ev->status) 5454 return; 5455 5456 hci_dev_lock(hdev); 5457 5458 hcon = hci_conn_hash_lookup_handle(hdev, ev->phy_handle); --- 1359 unchanged lines hidden --- |