aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_event.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2011-01-25 06:28:33 -0500
committerGustavo F. Padovan <padovan@profusion.mobi>2011-02-07 22:40:08 -0500
commit17fa4b9dff72fb3a1a68cc80caf98fc941d2b8b3 (patch)
tree34febcb1be7bf64995dd94c5db5755c5d9d7754f /net/bluetooth/hci_event.c
parent980e1a537fed7dfa53e9a4b6e586b43341f8c2d5 (diff)
Bluetooth: Add set_io_capability management command
This patch adds a new set_io_capability management command which is used to set the IO capability for Secure Simple Pairing (SSP) as well as the Security Manager Protocol (SMP). The value is per hci_dev and each hci_conn object inherits it upon creation. Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth/hci_event.c')
-rw-r--r--net/bluetooth/hci_event.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 98bcf78f2021..617f58363dbc 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -2198,6 +2198,25 @@ static inline void hci_extended_inquiry_result_evt(struct hci_dev *hdev, struct
2198 hci_dev_unlock(hdev); 2198 hci_dev_unlock(hdev);
2199} 2199}
2200 2200
2201static inline u8 hci_get_auth_req(struct hci_conn *conn)
2202{
2203 /* If remote requests dedicated bonding follow that lead */
2204 if (conn->remote_auth == 0x02 || conn->remote_auth == 0x03) {
2205 /* If both remote and local IO capabilities allow MITM
2206 * protection then require it, otherwise don't */
2207 if (conn->remote_cap == 0x03 || conn->io_capability == 0x03)
2208 return 0x02;
2209 else
2210 return 0x03;
2211 }
2212
2213 /* If remote requests no-bonding follow that lead */
2214 if (conn->remote_auth == 0x00 || conn->remote_auth == 0x01)
2215 return 0x00;
2216
2217 return conn->auth_type;
2218}
2219
2201static inline void hci_io_capa_request_evt(struct hci_dev *hdev, struct sk_buff *skb) 2220static inline void hci_io_capa_request_evt(struct hci_dev *hdev, struct sk_buff *skb)
2202{ 2221{
2203 struct hci_ev_io_capa_request *ev = (void *) skb->data; 2222 struct hci_ev_io_capa_request *ev = (void *) skb->data;
@@ -2218,8 +2237,15 @@ static inline void hci_io_capa_request_evt(struct hci_dev *hdev, struct sk_buff
2218 2237
2219 if (test_bit(HCI_PAIRABLE, &hdev->flags) || 2238 if (test_bit(HCI_PAIRABLE, &hdev->flags) ||
2220 (conn->remote_auth & ~0x01) == HCI_AT_NO_BONDING) { 2239 (conn->remote_auth & ~0x01) == HCI_AT_NO_BONDING) {
2221 /* FIXME: Do IO capa response based on information 2240 struct hci_cp_io_capability_reply cp;
2222 * provided through the management interface */ 2241
2242 bacpy(&cp.bdaddr, &ev->bdaddr);
2243 cp.capability = conn->io_capability;
2244 cp.oob_data = 0;
2245 cp.authentication = hci_get_auth_req(conn);
2246
2247 hci_send_cmd(hdev, HCI_OP_IO_CAPABILITY_REPLY,
2248 sizeof(cp), &cp);
2223 } else { 2249 } else {
2224 struct hci_cp_io_capability_neg_reply cp; 2250 struct hci_cp_io_capability_neg_reply cp;
2225 2251