Bluetooth: Add management command for enabling Secure Connections
Subsystems (2)
Marcel Holtmann
maintainerPATCH v2 8/13 Bluetooth: Add management command for enabling Secure Connections
The support for Secure Connections need to be explicitly enabled by userspace. This is required since only userspace that can handle the new link key types should enable support for Secure Connections.
This command handling is similar to how Secure Simple Pairing enabling is done. It also tracks the case when Secure Connections support is enabled via raw HCI commands. This makes sure that the host features page is updated as well.
Signed-off-by Marcel Holtmann <[email protected]>
--- include/net/bluetooth/hci_core.h | 1 + include/net/bluetooth/mgmt.h | 2 + net/bluetooth/hci_event.c | 32 ++++++++++++ net/bluetooth/mgmt.c | 106 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 141 insertions(+)
include/net/bluetooth/hci_core.h +1 -0
@@ -1125,6 +1125,7 @@ void mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, u8 addr_type, u8 status);void mgmt_auth_enable_complete (struct hci_dev *hdev,u8 status);void mgmt_ssp_enable_complete (struct hci_dev *hdev,u8 enable,u8 status); +void mgmt_sc_enable_complete (struct hci_dev *hdev,u8 enable,u8 status);void mgmt_set_class_of_dev_complete (struct hci_dev *hdev,u8 *dev_class,u8 status);void mgmt_set_local_name_complete (struct hci_dev *hdev,u8 *name,u8 status);
include/net/bluetooth/mgmt.h +2 -0
@@ -370,6 +370,8 @@ struct mgmt_cp_set_scan_params { } __packed;#define MGMT_SET_SCAN_PARAMS_SIZE 4 +#define MGMT_OP_SET_SECURE_CONN 0x002D +#define MGMT_EV_CMD_COMPLETE 0x0001struct mgmt_ev_cmd_complete {__le16 opcode;
net/bluetooth/hci_event.c +32 -0
@@ -461,6 +461,34 @@ static void hci_cc_write_ssp_mode(struct hci_dev *hdev, struct sk_buff *skb) } } +static void hci_cc_write_sc_support (struct hci_dev *hdev,struct sk_buff *skb) +{ +__u8 status = *((__u8 *) skb->data); +struct hci_cp_write_sc_support *sent; + +BT_DBG ("%s status 0x%2.2x" , hdev->name, status); + + sent =hci_sent_cmd_data (hdev,HCI_OP_WRITE_SC_SUPPORT ); +if (!sent) +return ; + +if (!status) { +if (sent->support) + hdev->features[1 ][0 ] |=LMP_HOST_SC ; +else + hdev->features[1 ][0 ] &= ~LMP_HOST_SC ; + } + +if (test_bit (HCI_MGMT , &hdev->dev_flags)) +mgmt_sc_enable_complete (hdev, sent->support, status); +else if (!status) { +if (sent->support) +set_bit (HCI_SC_ENABLED , &hdev->dev_flags); +else +clear_bit (HCI_SC_ENABLED , &hdev->dev_flags); + } +} +static void hci_cc_read_local_version (struct hci_dev *hdev,struct sk_buff *skb) {struct hci_rp_read_local_version *rp = (void *) skb->data;
@@ -2147,6 +2175,10 @@ static void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)hci_cc_write_ssp_mode (hdev, skb);break ; +case HCI_OP_WRITE_SC_SUPPORT : +hci_cc_write_sc_support (hdev, skb); +break ; +case HCI_OP_READ_LOCAL_VERSION :hci_cc_read_local_version (hdev, skb);break ;
net/bluetooth/mgmt.c +106 -0
124 lines not on this page · raw message
Signature · 1 line
1.8.4.2