diff options
Diffstat (limited to 'include/net/bluetooth')
-rw-r--r-- | include/net/bluetooth/bluetooth.h | 1 | ||||
-rw-r--r-- | include/net/bluetooth/hci.h | 49 | ||||
-rw-r--r-- | include/net/bluetooth/hci_core.h | 129 | ||||
-rw-r--r-- | include/net/bluetooth/l2cap.h | 8 | ||||
-rw-r--r-- | include/net/bluetooth/mgmt.h | 41 | ||||
-rw-r--r-- | include/net/bluetooth/rfcomm.h | 10 |
6 files changed, 207 insertions, 31 deletions
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index f4f9ee466791..904777c1cd24 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h | |||
@@ -65,6 +65,7 @@ struct bt_security { | |||
65 | #define BT_SECURITY_LOW 1 | 65 | #define BT_SECURITY_LOW 1 |
66 | #define BT_SECURITY_MEDIUM 2 | 66 | #define BT_SECURITY_MEDIUM 2 |
67 | #define BT_SECURITY_HIGH 3 | 67 | #define BT_SECURITY_HIGH 3 |
68 | #define BT_SECURITY_FIPS 4 | ||
68 | 69 | ||
69 | #define BT_DEFER_SETUP 7 | 70 | #define BT_DEFER_SETUP 7 |
70 | 71 | ||
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 66c1cd87bfe7..fe4b06bfc150 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
@@ -117,11 +117,16 @@ enum { | |||
117 | HCI_SERVICE_CACHE, | 117 | HCI_SERVICE_CACHE, |
118 | HCI_DEBUG_KEYS, | 118 | HCI_DEBUG_KEYS, |
119 | HCI_DUT_MODE, | 119 | HCI_DUT_MODE, |
120 | HCI_FORCE_SC, | ||
121 | HCI_FORCE_STATIC_ADDR, | ||
120 | HCI_UNREGISTER, | 122 | HCI_UNREGISTER, |
121 | HCI_USER_CHANNEL, | 123 | HCI_USER_CHANNEL, |
122 | 124 | ||
123 | HCI_LE_SCAN, | 125 | HCI_LE_SCAN, |
124 | HCI_SSP_ENABLED, | 126 | HCI_SSP_ENABLED, |
127 | HCI_SC_ENABLED, | ||
128 | HCI_SC_ONLY, | ||
129 | HCI_RPA_RESOLVING, | ||
125 | HCI_HS_ENABLED, | 130 | HCI_HS_ENABLED, |
126 | HCI_LE_ENABLED, | 131 | HCI_LE_ENABLED, |
127 | HCI_ADVERTISING, | 132 | HCI_ADVERTISING, |
@@ -282,10 +287,14 @@ enum { | |||
282 | #define LMP_SYNC_TRAIN 0x04 | 287 | #define LMP_SYNC_TRAIN 0x04 |
283 | #define LMP_SYNC_SCAN 0x08 | 288 | #define LMP_SYNC_SCAN 0x08 |
284 | 289 | ||
290 | #define LMP_SC 0x01 | ||
291 | #define LMP_PING 0x02 | ||
292 | |||
285 | /* Host features */ | 293 | /* Host features */ |
286 | #define LMP_HOST_SSP 0x01 | 294 | #define LMP_HOST_SSP 0x01 |
287 | #define LMP_HOST_LE 0x02 | 295 | #define LMP_HOST_LE 0x02 |
288 | #define LMP_HOST_LE_BREDR 0x04 | 296 | #define LMP_HOST_LE_BREDR 0x04 |
297 | #define LMP_HOST_SC 0x08 | ||
289 | 298 | ||
290 | /* Connection modes */ | 299 | /* Connection modes */ |
291 | #define HCI_CM_ACTIVE 0x0000 | 300 | #define HCI_CM_ACTIVE 0x0000 |
@@ -307,6 +316,7 @@ enum { | |||
307 | #define HCI_LM_TRUSTED 0x0008 | 316 | #define HCI_LM_TRUSTED 0x0008 |
308 | #define HCI_LM_RELIABLE 0x0010 | 317 | #define HCI_LM_RELIABLE 0x0010 |
309 | #define HCI_LM_SECURE 0x0020 | 318 | #define HCI_LM_SECURE 0x0020 |
319 | #define HCI_LM_FIPS 0x0040 | ||
310 | 320 | ||
311 | /* Authentication types */ | 321 | /* Authentication types */ |
312 | #define HCI_AT_NO_BONDING 0x00 | 322 | #define HCI_AT_NO_BONDING 0x00 |
@@ -327,15 +337,21 @@ enum { | |||
327 | #define HCI_LK_LOCAL_UNIT 0x01 | 337 | #define HCI_LK_LOCAL_UNIT 0x01 |
328 | #define HCI_LK_REMOTE_UNIT 0x02 | 338 | #define HCI_LK_REMOTE_UNIT 0x02 |
329 | #define HCI_LK_DEBUG_COMBINATION 0x03 | 339 | #define HCI_LK_DEBUG_COMBINATION 0x03 |
330 | #define HCI_LK_UNAUTH_COMBINATION 0x04 | 340 | #define HCI_LK_UNAUTH_COMBINATION_P192 0x04 |
331 | #define HCI_LK_AUTH_COMBINATION 0x05 | 341 | #define HCI_LK_AUTH_COMBINATION_P192 0x05 |
332 | #define HCI_LK_CHANGED_COMBINATION 0x06 | 342 | #define HCI_LK_CHANGED_COMBINATION 0x06 |
343 | #define HCI_LK_UNAUTH_COMBINATION_P256 0x07 | ||
344 | #define HCI_LK_AUTH_COMBINATION_P256 0x08 | ||
333 | /* The spec doesn't define types for SMP keys, the _MASTER suffix is implied */ | 345 | /* The spec doesn't define types for SMP keys, the _MASTER suffix is implied */ |
334 | #define HCI_SMP_STK 0x80 | 346 | #define HCI_SMP_STK 0x80 |
335 | #define HCI_SMP_STK_SLAVE 0x81 | 347 | #define HCI_SMP_STK_SLAVE 0x81 |
336 | #define HCI_SMP_LTK 0x82 | 348 | #define HCI_SMP_LTK 0x82 |
337 | #define HCI_SMP_LTK_SLAVE 0x83 | 349 | #define HCI_SMP_LTK_SLAVE 0x83 |
338 | 350 | ||
351 | /* Long Term Key types */ | ||
352 | #define HCI_LTK_UNAUTH 0x00 | ||
353 | #define HCI_LTK_AUTH 0x01 | ||
354 | |||
339 | /* ---- HCI Error Codes ---- */ | 355 | /* ---- HCI Error Codes ---- */ |
340 | #define HCI_ERROR_AUTH_FAILURE 0x05 | 356 | #define HCI_ERROR_AUTH_FAILURE 0x05 |
341 | #define HCI_ERROR_CONNECTION_TIMEOUT 0x08 | 357 | #define HCI_ERROR_CONNECTION_TIMEOUT 0x08 |
@@ -660,6 +676,15 @@ struct hci_rp_set_csb { | |||
660 | 676 | ||
661 | #define HCI_OP_START_SYNC_TRAIN 0x0443 | 677 | #define HCI_OP_START_SYNC_TRAIN 0x0443 |
662 | 678 | ||
679 | #define HCI_OP_REMOTE_OOB_EXT_DATA_REPLY 0x0445 | ||
680 | struct hci_cp_remote_oob_ext_data_reply { | ||
681 | bdaddr_t bdaddr; | ||
682 | __u8 hash192[16]; | ||
683 | __u8 randomizer192[16]; | ||
684 | __u8 hash256[16]; | ||
685 | __u8 randomizer256[16]; | ||
686 | } __packed; | ||
687 | |||
663 | #define HCI_OP_SNIFF_MODE 0x0803 | 688 | #define HCI_OP_SNIFF_MODE 0x0803 |
664 | struct hci_cp_sniff_mode { | 689 | struct hci_cp_sniff_mode { |
665 | __le16 handle; | 690 | __le16 handle; |
@@ -933,6 +958,26 @@ struct hci_rp_write_sync_train_params { | |||
933 | __le16 sync_train_int; | 958 | __le16 sync_train_int; |
934 | } __packed; | 959 | } __packed; |
935 | 960 | ||
961 | #define HCI_OP_READ_SC_SUPPORT 0x0c79 | ||
962 | struct hci_rp_read_sc_support { | ||
963 | __u8 status; | ||
964 | __u8 support; | ||
965 | } __packed; | ||
966 | |||
967 | #define HCI_OP_WRITE_SC_SUPPORT 0x0c7a | ||
968 | struct hci_cp_write_sc_support { | ||
969 | __u8 support; | ||
970 | } __packed; | ||
971 | |||
972 | #define HCI_OP_READ_LOCAL_OOB_EXT_DATA 0x0c7d | ||
973 | struct hci_rp_read_local_oob_ext_data { | ||
974 | __u8 status; | ||
975 | __u8 hash192[16]; | ||
976 | __u8 randomizer192[16]; | ||
977 | __u8 hash256[16]; | ||
978 | __u8 randomizer256[16]; | ||
979 | } __packed; | ||
980 | |||
936 | #define HCI_OP_READ_LOCAL_VERSION 0x1001 | 981 | #define HCI_OP_READ_LOCAL_VERSION 0x1001 |
937 | struct hci_rp_read_local_version { | 982 | struct hci_rp_read_local_version { |
938 | __u8 status; | 983 | __u8 status; |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index f2f0cf5865c4..c0fcc041fbb5 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -101,7 +101,15 @@ struct smp_ltk { | |||
101 | __le16 ediv; | 101 | __le16 ediv; |
102 | u8 rand[8]; | 102 | u8 rand[8]; |
103 | u8 val[16]; | 103 | u8 val[16]; |
104 | } __packed; | 104 | }; |
105 | |||
106 | struct smp_irk { | ||
107 | struct list_head list; | ||
108 | bdaddr_t rpa; | ||
109 | bdaddr_t bdaddr; | ||
110 | u8 addr_type; | ||
111 | u8 val[16]; | ||
112 | }; | ||
105 | 113 | ||
106 | struct link_key { | 114 | struct link_key { |
107 | struct list_head list; | 115 | struct list_head list; |
@@ -114,8 +122,10 @@ struct link_key { | |||
114 | struct oob_data { | 122 | struct oob_data { |
115 | struct list_head list; | 123 | struct list_head list; |
116 | bdaddr_t bdaddr; | 124 | bdaddr_t bdaddr; |
117 | u8 hash[16]; | 125 | u8 hash192[16]; |
118 | u8 randomizer[16]; | 126 | u8 randomizer192[16]; |
127 | u8 hash256[16]; | ||
128 | u8 randomizer256[16]; | ||
119 | }; | 129 | }; |
120 | 130 | ||
121 | #define HCI_MAX_SHORT_NAME_LENGTH 10 | 131 | #define HCI_MAX_SHORT_NAME_LENGTH 10 |
@@ -141,6 +151,7 @@ struct hci_dev { | |||
141 | __u8 bus; | 151 | __u8 bus; |
142 | __u8 dev_type; | 152 | __u8 dev_type; |
143 | bdaddr_t bdaddr; | 153 | bdaddr_t bdaddr; |
154 | bdaddr_t random_addr; | ||
144 | bdaddr_t static_addr; | 155 | bdaddr_t static_addr; |
145 | __u8 own_addr_type; | 156 | __u8 own_addr_type; |
146 | __u8 dev_name[HCI_MAX_NAME_LENGTH]; | 157 | __u8 dev_name[HCI_MAX_NAME_LENGTH]; |
@@ -167,6 +178,7 @@ struct hci_dev { | |||
167 | __u16 page_scan_interval; | 178 | __u16 page_scan_interval; |
168 | __u16 page_scan_window; | 179 | __u16 page_scan_window; |
169 | __u8 page_scan_type; | 180 | __u8 page_scan_type; |
181 | __u8 le_adv_channel_map; | ||
170 | __u16 le_scan_interval; | 182 | __u16 le_scan_interval; |
171 | __u16 le_scan_window; | 183 | __u16 le_scan_window; |
172 | __u16 le_conn_min_interval; | 184 | __u16 le_conn_min_interval; |
@@ -257,19 +269,19 @@ struct hci_dev { | |||
257 | __u32 req_status; | 269 | __u32 req_status; |
258 | __u32 req_result; | 270 | __u32 req_result; |
259 | 271 | ||
260 | struct list_head mgmt_pending; | 272 | struct crypto_blkcipher *tfm_aes; |
261 | 273 | ||
262 | struct discovery_state discovery; | 274 | struct discovery_state discovery; |
263 | struct hci_conn_hash conn_hash; | 275 | struct hci_conn_hash conn_hash; |
264 | struct list_head blacklist; | ||
265 | 276 | ||
277 | struct list_head mgmt_pending; | ||
278 | struct list_head blacklist; | ||
266 | struct list_head uuids; | 279 | struct list_head uuids; |
267 | |||
268 | struct list_head link_keys; | 280 | struct list_head link_keys; |
269 | |||
270 | struct list_head long_term_keys; | 281 | struct list_head long_term_keys; |
271 | 282 | struct list_head identity_resolving_keys; | |
272 | struct list_head remote_oob_data; | 283 | struct list_head remote_oob_data; |
284 | struct list_head le_conn_params; | ||
273 | 285 | ||
274 | struct hci_dev_stats stat; | 286 | struct hci_dev_stats stat; |
275 | 287 | ||
@@ -332,6 +344,8 @@ struct hci_conn { | |||
332 | __u8 passkey_entered; | 344 | __u8 passkey_entered; |
333 | __u16 disc_timeout; | 345 | __u16 disc_timeout; |
334 | __u16 setting; | 346 | __u16 setting; |
347 | __u16 le_conn_min_interval; | ||
348 | __u16 le_conn_max_interval; | ||
335 | unsigned long flags; | 349 | unsigned long flags; |
336 | 350 | ||
337 | __u8 remote_cap; | 351 | __u8 remote_cap; |
@@ -372,6 +386,16 @@ struct hci_chan { | |||
372 | __u8 state; | 386 | __u8 state; |
373 | }; | 387 | }; |
374 | 388 | ||
389 | struct hci_conn_params { | ||
390 | struct list_head list; | ||
391 | |||
392 | bdaddr_t addr; | ||
393 | u8 addr_type; | ||
394 | |||
395 | u16 conn_min_interval; | ||
396 | u16 conn_max_interval; | ||
397 | }; | ||
398 | |||
375 | extern struct list_head hci_dev_list; | 399 | extern struct list_head hci_dev_list; |
376 | extern struct list_head hci_cb_list; | 400 | extern struct list_head hci_cb_list; |
377 | extern rwlock_t hci_dev_list_lock; | 401 | extern rwlock_t hci_dev_list_lock; |
@@ -446,6 +470,8 @@ enum { | |||
446 | HCI_CONN_LE_SMP_PEND, | 470 | HCI_CONN_LE_SMP_PEND, |
447 | HCI_CONN_MGMT_CONNECTED, | 471 | HCI_CONN_MGMT_CONNECTED, |
448 | HCI_CONN_SSP_ENABLED, | 472 | HCI_CONN_SSP_ENABLED, |
473 | HCI_CONN_SC_ENABLED, | ||
474 | HCI_CONN_AES_CCM, | ||
449 | HCI_CONN_POWER_SAVE, | 475 | HCI_CONN_POWER_SAVE, |
450 | HCI_CONN_REMOTE_OOB, | 476 | HCI_CONN_REMOTE_OOB, |
451 | HCI_CONN_6LOWPAN, | 477 | HCI_CONN_6LOWPAN, |
@@ -458,6 +484,13 @@ static inline bool hci_conn_ssp_enabled(struct hci_conn *conn) | |||
458 | test_bit(HCI_CONN_SSP_ENABLED, &conn->flags); | 484 | test_bit(HCI_CONN_SSP_ENABLED, &conn->flags); |
459 | } | 485 | } |
460 | 486 | ||
487 | static inline bool hci_conn_sc_enabled(struct hci_conn *conn) | ||
488 | { | ||
489 | struct hci_dev *hdev = conn->hdev; | ||
490 | return test_bit(HCI_SC_ENABLED, &hdev->dev_flags) && | ||
491 | test_bit(HCI_CONN_SC_ENABLED, &conn->flags); | ||
492 | } | ||
493 | |||
461 | static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c) | 494 | static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c) |
462 | { | 495 | { |
463 | struct hci_conn_hash *h = &hdev->conn_hash; | 496 | struct hci_conn_hash *h = &hdev->conn_hash; |
@@ -737,31 +770,50 @@ int hci_inquiry(void __user *arg); | |||
737 | 770 | ||
738 | struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, | 771 | struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, |
739 | bdaddr_t *bdaddr, u8 type); | 772 | bdaddr_t *bdaddr, u8 type); |
740 | int hci_blacklist_clear(struct hci_dev *hdev); | 773 | void hci_blacklist_clear(struct hci_dev *hdev); |
741 | int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); | 774 | int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); |
742 | int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); | 775 | int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); |
743 | 776 | ||
744 | int hci_uuids_clear(struct hci_dev *hdev); | 777 | struct hci_conn_params *hci_conn_params_lookup(struct hci_dev *hdev, |
778 | bdaddr_t *addr, u8 addr_type); | ||
779 | void hci_conn_params_add(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type, | ||
780 | u16 conn_min_interval, u16 conn_max_interval); | ||
781 | void hci_conn_params_del(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type); | ||
782 | void hci_conn_params_clear(struct hci_dev *hdev); | ||
783 | |||
784 | void hci_uuids_clear(struct hci_dev *hdev); | ||
745 | 785 | ||
746 | int hci_link_keys_clear(struct hci_dev *hdev); | 786 | void hci_link_keys_clear(struct hci_dev *hdev); |
747 | struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); | 787 | struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); |
748 | int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key, | 788 | int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key, |
749 | bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len); | 789 | bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len); |
750 | struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, u8 rand[8]); | 790 | struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, u8 rand[8], |
751 | int hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 addr_type, u8 type, | 791 | bool master); |
752 | int new_key, u8 authenticated, u8 tk[16], u8 enc_size, | 792 | struct smp_ltk *hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, |
753 | __le16 ediv, u8 rand[8]); | 793 | u8 addr_type, u8 type, u8 authenticated, |
794 | u8 tk[16], u8 enc_size, __le16 ediv, u8 rand[8]); | ||
754 | struct smp_ltk *hci_find_ltk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr, | 795 | struct smp_ltk *hci_find_ltk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr, |
755 | u8 addr_type); | 796 | u8 addr_type, bool master); |
756 | int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr); | 797 | int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 bdaddr_type); |
757 | int hci_smp_ltks_clear(struct hci_dev *hdev); | 798 | void hci_smp_ltks_clear(struct hci_dev *hdev); |
758 | int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); | 799 | int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); |
759 | 800 | ||
760 | int hci_remote_oob_data_clear(struct hci_dev *hdev); | 801 | struct smp_irk *hci_find_irk_by_rpa(struct hci_dev *hdev, bdaddr_t *rpa); |
802 | struct smp_irk *hci_find_irk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr, | ||
803 | u8 addr_type); | ||
804 | struct smp_irk *hci_add_irk(struct hci_dev *hdev, bdaddr_t *bdaddr, | ||
805 | u8 addr_type, u8 val[16], bdaddr_t *rpa); | ||
806 | void hci_remove_irk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 addr_type); | ||
807 | void hci_smp_irks_clear(struct hci_dev *hdev); | ||
808 | |||
809 | void hci_remote_oob_data_clear(struct hci_dev *hdev); | ||
761 | struct oob_data *hci_find_remote_oob_data(struct hci_dev *hdev, | 810 | struct oob_data *hci_find_remote_oob_data(struct hci_dev *hdev, |
762 | bdaddr_t *bdaddr); | 811 | bdaddr_t *bdaddr); |
763 | int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *hash, | 812 | int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr, |
764 | u8 *randomizer); | 813 | u8 *hash, u8 *randomizer); |
814 | int hci_add_remote_oob_ext_data(struct hci_dev *hdev, bdaddr_t *bdaddr, | ||
815 | u8 *hash192, u8 *randomizer192, | ||
816 | u8 *hash256, u8 *randomizer256); | ||
765 | int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr); | 817 | int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr); |
766 | 818 | ||
767 | void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); | 819 | void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); |
@@ -803,9 +855,12 @@ void hci_conn_del_sysfs(struct hci_conn *conn); | |||
803 | #define lmp_csb_slave_capable(dev) ((dev)->features[2][0] & LMP_CSB_SLAVE) | 855 | #define lmp_csb_slave_capable(dev) ((dev)->features[2][0] & LMP_CSB_SLAVE) |
804 | #define lmp_sync_train_capable(dev) ((dev)->features[2][0] & LMP_SYNC_TRAIN) | 856 | #define lmp_sync_train_capable(dev) ((dev)->features[2][0] & LMP_SYNC_TRAIN) |
805 | #define lmp_sync_scan_capable(dev) ((dev)->features[2][0] & LMP_SYNC_SCAN) | 857 | #define lmp_sync_scan_capable(dev) ((dev)->features[2][0] & LMP_SYNC_SCAN) |
858 | #define lmp_sc_capable(dev) ((dev)->features[2][1] & LMP_SC) | ||
859 | #define lmp_ping_capable(dev) ((dev)->features[2][1] & LMP_PING) | ||
806 | 860 | ||
807 | /* ----- Host capabilities ----- */ | 861 | /* ----- Host capabilities ----- */ |
808 | #define lmp_host_ssp_capable(dev) ((dev)->features[1][0] & LMP_HOST_SSP) | 862 | #define lmp_host_ssp_capable(dev) ((dev)->features[1][0] & LMP_HOST_SSP) |
863 | #define lmp_host_sc_capable(dev) ((dev)->features[1][0] & LMP_HOST_SC) | ||
809 | #define lmp_host_le_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE)) | 864 | #define lmp_host_le_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE)) |
810 | #define lmp_host_le_br_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE_BREDR)) | 865 | #define lmp_host_le_br_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE_BREDR)) |
811 | 866 | ||
@@ -1019,6 +1074,26 @@ static inline bool eir_has_data_type(u8 *data, size_t data_len, u8 type) | |||
1019 | return false; | 1074 | return false; |
1020 | } | 1075 | } |
1021 | 1076 | ||
1077 | static inline bool hci_bdaddr_is_rpa(bdaddr_t *bdaddr, u8 addr_type) | ||
1078 | { | ||
1079 | if (addr_type != 0x01) | ||
1080 | return false; | ||
1081 | |||
1082 | if ((bdaddr->b[5] & 0xc0) == 0x40) | ||
1083 | return true; | ||
1084 | |||
1085 | return false; | ||
1086 | } | ||
1087 | |||
1088 | static inline struct smp_irk *hci_get_irk(struct hci_dev *hdev, | ||
1089 | bdaddr_t *bdaddr, u8 addr_type) | ||
1090 | { | ||
1091 | if (!hci_bdaddr_is_rpa(bdaddr, addr_type)) | ||
1092 | return NULL; | ||
1093 | |||
1094 | return hci_find_irk_by_rpa(hdev, bdaddr); | ||
1095 | } | ||
1096 | |||
1022 | int hci_register_cb(struct hci_cb *hcb); | 1097 | int hci_register_cb(struct hci_cb *hcb); |
1023 | int hci_unregister_cb(struct hci_cb *hcb); | 1098 | int hci_unregister_cb(struct hci_cb *hcb); |
1024 | 1099 | ||
@@ -1122,11 +1197,13 @@ void mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, | |||
1122 | u8 addr_type, u8 status); | 1197 | u8 addr_type, u8 status); |
1123 | void mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status); | 1198 | void mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status); |
1124 | void mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 enable, u8 status); | 1199 | void mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 enable, u8 status); |
1200 | void mgmt_sc_enable_complete(struct hci_dev *hdev, u8 enable, u8 status); | ||
1125 | void mgmt_set_class_of_dev_complete(struct hci_dev *hdev, u8 *dev_class, | 1201 | void mgmt_set_class_of_dev_complete(struct hci_dev *hdev, u8 *dev_class, |
1126 | u8 status); | 1202 | u8 status); |
1127 | void mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status); | 1203 | void mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status); |
1128 | void mgmt_read_local_oob_data_reply_complete(struct hci_dev *hdev, u8 *hash, | 1204 | void mgmt_read_local_oob_data_complete(struct hci_dev *hdev, u8 *hash192, |
1129 | u8 *randomizer, u8 status); | 1205 | u8 *randomizer192, u8 *hash256, |
1206 | u8 *randomizer256, u8 status); | ||
1130 | void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, | 1207 | void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, |
1131 | u8 addr_type, u8 *dev_class, s8 rssi, u8 cfm_name, | 1208 | u8 addr_type, u8 *dev_class, s8 rssi, u8 cfm_name, |
1132 | u8 ssp, u8 *eir, u16 eir_len); | 1209 | u8 ssp, u8 *eir, u16 eir_len); |
@@ -1135,8 +1212,10 @@ void mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, | |||
1135 | void mgmt_discovering(struct hci_dev *hdev, u8 discovering); | 1212 | void mgmt_discovering(struct hci_dev *hdev, u8 discovering); |
1136 | int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); | 1213 | int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); |
1137 | int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); | 1214 | int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); |
1138 | void mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, u8 persistent); | 1215 | void mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key); |
1216 | void mgmt_new_irk(struct hci_dev *hdev, struct smp_irk *irk); | ||
1139 | void mgmt_reenable_advertising(struct hci_dev *hdev); | 1217 | void mgmt_reenable_advertising(struct hci_dev *hdev); |
1218 | void mgmt_smp_complete(struct hci_conn *conn, bool complete); | ||
1140 | 1219 | ||
1141 | /* HCI info for socket */ | 1220 | /* HCI info for socket */ |
1142 | #define hci_pi(sk) ((struct hci_pinfo *) sk) | 1221 | #define hci_pi(sk) ((struct hci_pinfo *) sk) |
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h index dbc4a89984ca..4abdcb220e3a 100644 --- a/include/net/bluetooth/l2cap.h +++ b/include/net/bluetooth/l2cap.h | |||
@@ -91,6 +91,7 @@ struct l2cap_conninfo { | |||
91 | #define L2CAP_LM_TRUSTED 0x0008 | 91 | #define L2CAP_LM_TRUSTED 0x0008 |
92 | #define L2CAP_LM_RELIABLE 0x0010 | 92 | #define L2CAP_LM_RELIABLE 0x0010 |
93 | #define L2CAP_LM_SECURE 0x0020 | 93 | #define L2CAP_LM_SECURE 0x0020 |
94 | #define L2CAP_LM_FIPS 0x0040 | ||
94 | 95 | ||
95 | /* L2CAP command codes */ | 96 | /* L2CAP command codes */ |
96 | #define L2CAP_COMMAND_REJ 0x01 | 97 | #define L2CAP_COMMAND_REJ 0x01 |
@@ -623,6 +624,9 @@ struct l2cap_conn { | |||
623 | __u32 rx_len; | 624 | __u32 rx_len; |
624 | __u8 tx_ident; | 625 | __u8 tx_ident; |
625 | 626 | ||
627 | struct sk_buff_head pending_rx; | ||
628 | struct work_struct pending_rx_work; | ||
629 | |||
626 | __u8 disc_reason; | 630 | __u8 disc_reason; |
627 | 631 | ||
628 | struct delayed_work security_timer; | 632 | struct delayed_work security_timer; |
@@ -647,7 +651,7 @@ struct l2cap_user { | |||
647 | #define L2CAP_CHAN_RAW 1 | 651 | #define L2CAP_CHAN_RAW 1 |
648 | #define L2CAP_CHAN_CONN_LESS 2 | 652 | #define L2CAP_CHAN_CONN_LESS 2 |
649 | #define L2CAP_CHAN_CONN_ORIENTED 3 | 653 | #define L2CAP_CHAN_CONN_ORIENTED 3 |
650 | #define L2CAP_CHAN_CONN_FIX_A2MP 4 | 654 | #define L2CAP_CHAN_FIXED 4 |
651 | 655 | ||
652 | /* ----- L2CAP socket info ----- */ | 656 | /* ----- L2CAP socket info ----- */ |
653 | #define l2cap_pi(sk) ((struct l2cap_pinfo *) sk) | 657 | #define l2cap_pi(sk) ((struct l2cap_pinfo *) sk) |
@@ -853,7 +857,6 @@ static inline long l2cap_chan_no_get_sndtimeo(struct l2cap_chan *chan) | |||
853 | } | 857 | } |
854 | 858 | ||
855 | extern bool disable_ertm; | 859 | extern bool disable_ertm; |
856 | extern bool enable_lecoc; | ||
857 | 860 | ||
858 | int l2cap_init_sockets(void); | 861 | int l2cap_init_sockets(void); |
859 | void l2cap_cleanup_sockets(void); | 862 | void l2cap_cleanup_sockets(void); |
@@ -878,6 +881,7 @@ int l2cap_ertm_init(struct l2cap_chan *chan); | |||
878 | void l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan); | 881 | void l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan); |
879 | void __l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan); | 882 | void __l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan); |
880 | void l2cap_chan_del(struct l2cap_chan *chan, int err); | 883 | void l2cap_chan_del(struct l2cap_chan *chan, int err); |
884 | void l2cap_conn_update_id_addr(struct hci_conn *hcon); | ||
881 | void l2cap_send_conn_req(struct l2cap_chan *chan); | 885 | void l2cap_send_conn_req(struct l2cap_chan *chan); |
882 | void l2cap_move_start(struct l2cap_chan *chan); | 886 | void l2cap_move_start(struct l2cap_chan *chan); |
883 | void l2cap_logical_cfm(struct l2cap_chan *chan, struct hci_chan *hchan, | 887 | void l2cap_logical_cfm(struct l2cap_chan *chan, struct hci_chan *hchan, |
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h index 518c5c84e39a..2e46251e8aec 100644 --- a/include/net/bluetooth/mgmt.h +++ b/include/net/bluetooth/mgmt.h | |||
@@ -94,6 +94,8 @@ struct mgmt_rp_read_index_list { | |||
94 | #define MGMT_SETTING_HS 0x00000100 | 94 | #define MGMT_SETTING_HS 0x00000100 |
95 | #define MGMT_SETTING_LE 0x00000200 | 95 | #define MGMT_SETTING_LE 0x00000200 |
96 | #define MGMT_SETTING_ADVERTISING 0x00000400 | 96 | #define MGMT_SETTING_ADVERTISING 0x00000400 |
97 | #define MGMT_SETTING_SECURE_CONN 0x00000800 | ||
98 | #define MGMT_SETTING_DEBUG_KEYS 0x00001000 | ||
97 | 99 | ||
98 | #define MGMT_OP_READ_INFO 0x0004 | 100 | #define MGMT_OP_READ_INFO 0x0004 |
99 | #define MGMT_READ_INFO_SIZE 0 | 101 | #define MGMT_READ_INFO_SIZE 0 |
@@ -180,7 +182,7 @@ struct mgmt_cp_load_link_keys { | |||
180 | 182 | ||
181 | struct mgmt_ltk_info { | 183 | struct mgmt_ltk_info { |
182 | struct mgmt_addr_info addr; | 184 | struct mgmt_addr_info addr; |
183 | __u8 authenticated; | 185 | __u8 type; |
184 | __u8 master; | 186 | __u8 master; |
185 | __u8 enc_size; | 187 | __u8 enc_size; |
186 | __le16 ediv; | 188 | __le16 ediv; |
@@ -294,6 +296,12 @@ struct mgmt_rp_read_local_oob_data { | |||
294 | __u8 hash[16]; | 296 | __u8 hash[16]; |
295 | __u8 randomizer[16]; | 297 | __u8 randomizer[16]; |
296 | } __packed; | 298 | } __packed; |
299 | struct mgmt_rp_read_local_oob_ext_data { | ||
300 | __u8 hash192[16]; | ||
301 | __u8 randomizer192[16]; | ||
302 | __u8 hash256[16]; | ||
303 | __u8 randomizer256[16]; | ||
304 | } __packed; | ||
297 | 305 | ||
298 | #define MGMT_OP_ADD_REMOTE_OOB_DATA 0x0021 | 306 | #define MGMT_OP_ADD_REMOTE_OOB_DATA 0x0021 |
299 | struct mgmt_cp_add_remote_oob_data { | 307 | struct mgmt_cp_add_remote_oob_data { |
@@ -302,6 +310,14 @@ struct mgmt_cp_add_remote_oob_data { | |||
302 | __u8 randomizer[16]; | 310 | __u8 randomizer[16]; |
303 | } __packed; | 311 | } __packed; |
304 | #define MGMT_ADD_REMOTE_OOB_DATA_SIZE (MGMT_ADDR_INFO_SIZE + 32) | 312 | #define MGMT_ADD_REMOTE_OOB_DATA_SIZE (MGMT_ADDR_INFO_SIZE + 32) |
313 | struct mgmt_cp_add_remote_oob_ext_data { | ||
314 | struct mgmt_addr_info addr; | ||
315 | __u8 hash192[16]; | ||
316 | __u8 randomizer192[16]; | ||
317 | __u8 hash256[16]; | ||
318 | __u8 randomizer256[16]; | ||
319 | } __packed; | ||
320 | #define MGMT_ADD_REMOTE_OOB_EXT_DATA_SIZE (MGMT_ADDR_INFO_SIZE + 64) | ||
305 | 321 | ||
306 | #define MGMT_OP_REMOVE_REMOTE_OOB_DATA 0x0022 | 322 | #define MGMT_OP_REMOVE_REMOTE_OOB_DATA 0x0022 |
307 | struct mgmt_cp_remove_remote_oob_data { | 323 | struct mgmt_cp_remove_remote_oob_data { |
@@ -369,6 +385,22 @@ struct mgmt_cp_set_scan_params { | |||
369 | } __packed; | 385 | } __packed; |
370 | #define MGMT_SET_SCAN_PARAMS_SIZE 4 | 386 | #define MGMT_SET_SCAN_PARAMS_SIZE 4 |
371 | 387 | ||
388 | #define MGMT_OP_SET_SECURE_CONN 0x002D | ||
389 | |||
390 | #define MGMT_OP_SET_DEBUG_KEYS 0x002E | ||
391 | |||
392 | struct mgmt_irk_info { | ||
393 | struct mgmt_addr_info addr; | ||
394 | __u8 val[16]; | ||
395 | } __packed; | ||
396 | |||
397 | #define MGMT_OP_LOAD_IRKS 0x0030 | ||
398 | struct mgmt_cp_load_irks { | ||
399 | __le16 irk_count; | ||
400 | struct mgmt_irk_info irks[0]; | ||
401 | } __packed; | ||
402 | #define MGMT_LOAD_IRKS_SIZE 2 | ||
403 | |||
372 | #define MGMT_EV_CMD_COMPLETE 0x0001 | 404 | #define MGMT_EV_CMD_COMPLETE 0x0001 |
373 | struct mgmt_ev_cmd_complete { | 405 | struct mgmt_ev_cmd_complete { |
374 | __le16 opcode; | 406 | __le16 opcode; |
@@ -504,3 +536,10 @@ struct mgmt_ev_passkey_notify { | |||
504 | __le32 passkey; | 536 | __le32 passkey; |
505 | __u8 entered; | 537 | __u8 entered; |
506 | } __packed; | 538 | } __packed; |
539 | |||
540 | #define MGMT_EV_NEW_IRK 0x0018 | ||
541 | struct mgmt_ev_new_irk { | ||
542 | __u8 store_hint; | ||
543 | bdaddr_t rpa; | ||
544 | struct mgmt_irk_info irk; | ||
545 | } __packed; | ||
diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h index 486213a1aed8..2611cc389d7d 100644 --- a/include/net/bluetooth/rfcomm.h +++ b/include/net/bluetooth/rfcomm.h | |||
@@ -238,9 +238,11 @@ int rfcomm_dlc_open(struct rfcomm_dlc *d, bdaddr_t *src, bdaddr_t *dst, | |||
238 | u8 channel); | 238 | u8 channel); |
239 | int rfcomm_dlc_close(struct rfcomm_dlc *d, int reason); | 239 | int rfcomm_dlc_close(struct rfcomm_dlc *d, int reason); |
240 | int rfcomm_dlc_send(struct rfcomm_dlc *d, struct sk_buff *skb); | 240 | int rfcomm_dlc_send(struct rfcomm_dlc *d, struct sk_buff *skb); |
241 | void rfcomm_dlc_send_noerror(struct rfcomm_dlc *d, struct sk_buff *skb); | ||
241 | int rfcomm_dlc_set_modem_status(struct rfcomm_dlc *d, u8 v24_sig); | 242 | int rfcomm_dlc_set_modem_status(struct rfcomm_dlc *d, u8 v24_sig); |
242 | int rfcomm_dlc_get_modem_status(struct rfcomm_dlc *d, u8 *v24_sig); | 243 | int rfcomm_dlc_get_modem_status(struct rfcomm_dlc *d, u8 *v24_sig); |
243 | void rfcomm_dlc_accept(struct rfcomm_dlc *d); | 244 | void rfcomm_dlc_accept(struct rfcomm_dlc *d); |
245 | struct rfcomm_dlc *rfcomm_dlc_exists(bdaddr_t *src, bdaddr_t *dst, u8 channel); | ||
244 | 246 | ||
245 | #define rfcomm_dlc_lock(d) spin_lock(&d->lock) | 247 | #define rfcomm_dlc_lock(d) spin_lock(&d->lock) |
246 | #define rfcomm_dlc_unlock(d) spin_unlock(&d->lock) | 248 | #define rfcomm_dlc_unlock(d) spin_unlock(&d->lock) |
@@ -295,6 +297,7 @@ struct rfcomm_conninfo { | |||
295 | #define RFCOMM_LM_TRUSTED 0x0008 | 297 | #define RFCOMM_LM_TRUSTED 0x0008 |
296 | #define RFCOMM_LM_RELIABLE 0x0010 | 298 | #define RFCOMM_LM_RELIABLE 0x0010 |
297 | #define RFCOMM_LM_SECURE 0x0020 | 299 | #define RFCOMM_LM_SECURE 0x0020 |
300 | #define RFCOMM_LM_FIPS 0x0040 | ||
298 | 301 | ||
299 | #define rfcomm_pi(sk) ((struct rfcomm_pinfo *) sk) | 302 | #define rfcomm_pi(sk) ((struct rfcomm_pinfo *) sk) |
300 | 303 | ||
@@ -323,11 +326,16 @@ int rfcomm_connect_ind(struct rfcomm_session *s, u8 channel, | |||
323 | #define RFCOMMGETDEVINFO _IOR('R', 211, int) | 326 | #define RFCOMMGETDEVINFO _IOR('R', 211, int) |
324 | #define RFCOMMSTEALDLC _IOW('R', 220, int) | 327 | #define RFCOMMSTEALDLC _IOW('R', 220, int) |
325 | 328 | ||
329 | /* rfcomm_dev.flags bit definitions */ | ||
326 | #define RFCOMM_REUSE_DLC 0 | 330 | #define RFCOMM_REUSE_DLC 0 |
327 | #define RFCOMM_RELEASE_ONHUP 1 | 331 | #define RFCOMM_RELEASE_ONHUP 1 |
328 | #define RFCOMM_HANGUP_NOW 2 | 332 | #define RFCOMM_HANGUP_NOW 2 |
329 | #define RFCOMM_TTY_ATTACHED 3 | 333 | #define RFCOMM_TTY_ATTACHED 3 |
330 | #define RFCOMM_TTY_RELEASED 4 | 334 | #define RFCOMM_DEFUNCT_BIT4 4 /* don't reuse this bit - userspace visible */ |
335 | |||
336 | /* rfcomm_dev.status bit definitions */ | ||
337 | #define RFCOMM_DEV_RELEASED 0 | ||
338 | #define RFCOMM_TTY_OWNED 1 | ||
331 | 339 | ||
332 | struct rfcomm_dev_req { | 340 | struct rfcomm_dev_req { |
333 | s16 dev_id; | 341 | s16 dev_id; |