diff options
-rw-r--r-- | include/net/bluetooth/hci.h | 1 | ||||
-rw-r--r-- | include/net/bluetooth/hci_core.h | 1 | ||||
-rw-r--r-- | net/bluetooth/hci_conn.c | 6 | ||||
-rw-r--r-- | net/bluetooth/hci_event.c | 17 | ||||
-rw-r--r-- | net/bluetooth/mgmt.c | 4 |
5 files changed, 18 insertions, 11 deletions
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index dd2cc6cb35b3..cb9097acbf44 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
@@ -94,6 +94,7 @@ enum { | |||
94 | HCI_DEBUG_KEYS, | 94 | HCI_DEBUG_KEYS, |
95 | 95 | ||
96 | HCI_LE_SCAN, | 96 | HCI_LE_SCAN, |
97 | HCI_SSP_ENABLED, | ||
97 | }; | 98 | }; |
98 | 99 | ||
99 | /* HCI ioctl defines */ | 100 | /* HCI ioctl defines */ |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 7a033111c98f..94ba8693e9d1 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -144,7 +144,6 @@ struct hci_dev { | |||
144 | __u8 features[8]; | 144 | __u8 features[8]; |
145 | __u8 host_features[8]; | 145 | __u8 host_features[8]; |
146 | __u8 commands[64]; | 146 | __u8 commands[64]; |
147 | __u8 ssp_mode; | ||
148 | __u8 hci_ver; | 147 | __u8 hci_ver; |
149 | __u16 hci_rev; | 148 | __u16 hci_rev; |
150 | __u8 lmp_ver; | 149 | __u8 lmp_ver; |
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 8288e303621a..6ec259e84b95 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c | |||
@@ -609,8 +609,8 @@ int hci_conn_check_link_mode(struct hci_conn *conn) | |||
609 | BT_DBG("conn %p", conn); | 609 | BT_DBG("conn %p", conn); |
610 | 610 | ||
611 | if (test_bit(HCI_CONN_SSP_ENABLED, &conn->flags) && | 611 | if (test_bit(HCI_CONN_SSP_ENABLED, &conn->flags) && |
612 | conn->hdev->ssp_mode > 0 && | 612 | test_bit(HCI_SSP_ENABLED, &conn->hdev->dev_flags) && |
613 | !(conn->link_mode & HCI_LM_ENCRYPT)) | 613 | !(conn->link_mode & HCI_LM_ENCRYPT)) |
614 | return 0; | 614 | return 0; |
615 | 615 | ||
616 | return 1; | 616 | return 1; |
@@ -674,7 +674,7 @@ int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type) | |||
674 | key. */ | 674 | key. */ |
675 | if (sec_level == BT_SECURITY_LOW && | 675 | if (sec_level == BT_SECURITY_LOW && |
676 | (!test_bit(HCI_CONN_SSP_ENABLED, &conn->flags) || | 676 | (!test_bit(HCI_CONN_SSP_ENABLED, &conn->flags) || |
677 | !conn->hdev->ssp_mode)) | 677 | !test_bit(HCI_SSP_ENABLED, &conn->hdev->dev_flags))) |
678 | return 1; | 678 | return 1; |
679 | 679 | ||
680 | /* For other security levels we need the link key. */ | 680 | /* For other security levels we need the link key. */ |
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 02ad53801732..eb198ccbc10d 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -429,7 +429,10 @@ static void hci_cc_read_ssp_mode(struct hci_dev *hdev, struct sk_buff *skb) | |||
429 | if (rp->status) | 429 | if (rp->status) |
430 | return; | 430 | return; |
431 | 431 | ||
432 | hdev->ssp_mode = rp->mode; | 432 | if (rp->mode) |
433 | set_bit(HCI_SSP_ENABLED, &hdev->dev_flags); | ||
434 | else | ||
435 | clear_bit(HCI_SSP_ENABLED, &hdev->dev_flags); | ||
433 | } | 436 | } |
434 | 437 | ||
435 | static void hci_cc_write_ssp_mode(struct hci_dev *hdev, struct sk_buff *skb) | 438 | static void hci_cc_write_ssp_mode(struct hci_dev *hdev, struct sk_buff *skb) |
@@ -446,7 +449,10 @@ static void hci_cc_write_ssp_mode(struct hci_dev *hdev, struct sk_buff *skb) | |||
446 | if (!sent) | 449 | if (!sent) |
447 | return; | 450 | return; |
448 | 451 | ||
449 | hdev->ssp_mode = *((__u8 *) sent); | 452 | if (*((u8 *) sent)) |
453 | set_bit(HCI_SSP_ENABLED, &hdev->dev_flags); | ||
454 | else | ||
455 | clear_bit(HCI_SSP_ENABLED, &hdev->dev_flags); | ||
450 | } | 456 | } |
451 | 457 | ||
452 | static u8 hci_get_inquiry_mode(struct hci_dev *hdev) | 458 | static u8 hci_get_inquiry_mode(struct hci_dev *hdev) |
@@ -1264,7 +1270,7 @@ static int hci_outgoing_auth_needed(struct hci_dev *hdev, | |||
1264 | 1270 | ||
1265 | /* Only request authentication for SSP connections or non-SSP | 1271 | /* Only request authentication for SSP connections or non-SSP |
1266 | * devices with sec_level HIGH or if MITM protection is requested */ | 1272 | * devices with sec_level HIGH or if MITM protection is requested */ |
1267 | if (!(hdev->ssp_mode > 0 && | 1273 | if (!(test_bit(HCI_SSP_ENABLED, &hdev->dev_flags) && |
1268 | test_bit(HCI_CONN_SSP_ENABLED, &conn->flags)) && | 1274 | test_bit(HCI_CONN_SSP_ENABLED, &conn->flags)) && |
1269 | conn->pending_sec_level != BT_SECURITY_HIGH && | 1275 | conn->pending_sec_level != BT_SECURITY_HIGH && |
1270 | !(conn->auth_type & 0x01)) | 1276 | !(conn->auth_type & 0x01)) |
@@ -1840,7 +1846,7 @@ static inline void hci_auth_complete_evt(struct hci_dev *hdev, struct sk_buff *s | |||
1840 | 1846 | ||
1841 | if (!ev->status) { | 1847 | if (!ev->status) { |
1842 | if (!(test_bit(HCI_CONN_SSP_ENABLED, &conn->flags) && | 1848 | if (!(test_bit(HCI_CONN_SSP_ENABLED, &conn->flags) && |
1843 | hdev->ssp_mode > 0) && | 1849 | test_bit(HCI_SSP_ENABLED, &hdev->dev_flags)) && |
1844 | test_bit(HCI_CONN_REAUTH_PEND, &conn->flags)) { | 1850 | test_bit(HCI_CONN_REAUTH_PEND, &conn->flags)) { |
1845 | BT_INFO("re-auth of legacy device is not possible."); | 1851 | BT_INFO("re-auth of legacy device is not possible."); |
1846 | } else { | 1852 | } else { |
@@ -1855,7 +1861,8 @@ static inline void hci_auth_complete_evt(struct hci_dev *hdev, struct sk_buff *s | |||
1855 | clear_bit(HCI_CONN_REAUTH_PEND, &conn->flags); | 1861 | clear_bit(HCI_CONN_REAUTH_PEND, &conn->flags); |
1856 | 1862 | ||
1857 | if (conn->state == BT_CONFIG) { | 1863 | if (conn->state == BT_CONFIG) { |
1858 | if (!ev->status && hdev->ssp_mode > 0 && | 1864 | if (!ev->status && |
1865 | test_bit(HCI_SSP_ENABLED, &hdev->dev_flags) && | ||
1859 | test_bit(HCI_CONN_SSP_ENABLED, &conn->flags)) { | 1866 | test_bit(HCI_CONN_SSP_ENABLED, &conn->flags)) { |
1860 | struct hci_cp_set_conn_encrypt cp; | 1867 | struct hci_cp_set_conn_encrypt cp; |
1861 | cp.handle = ev->handle; | 1868 | cp.handle = ev->handle; |
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index ae9283d47e65..89707996d352 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -297,7 +297,7 @@ static u32 get_current_settings(struct hci_dev *hdev) | |||
297 | if (test_bit(HCI_AUTH, &hdev->flags)) | 297 | if (test_bit(HCI_AUTH, &hdev->flags)) |
298 | settings |= MGMT_SETTING_LINK_SECURITY; | 298 | settings |= MGMT_SETTING_LINK_SECURITY; |
299 | 299 | ||
300 | if (hdev->ssp_mode > 0) | 300 | if (test_bit(HCI_SSP_ENABLED, &hdev->dev_flags)) |
301 | settings |= MGMT_SETTING_SSP; | 301 | settings |= MGMT_SETTING_SSP; |
302 | 302 | ||
303 | return settings; | 303 | return settings; |
@@ -416,7 +416,7 @@ static int update_eir(struct hci_dev *hdev) | |||
416 | if (!(hdev->features[6] & LMP_EXT_INQ)) | 416 | if (!(hdev->features[6] & LMP_EXT_INQ)) |
417 | return 0; | 417 | return 0; |
418 | 418 | ||
419 | if (hdev->ssp_mode == 0) | 419 | if (!test_bit(HCI_SSP_ENABLED, &hdev->dev_flags)) |
420 | return 0; | 420 | return 0; |
421 | 421 | ||
422 | if (test_bit(HCI_SERVICE_CACHE, &hdev->dev_flags)) | 422 | if (test_bit(HCI_SERVICE_CACHE, &hdev->dev_flags)) |