diff options
author | Johan Hedberg <johan.hedberg@nokia.com> | 2011-04-28 14:28:56 -0400 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-04-28 15:13:57 -0400 |
commit | 55bc1a378cc35f21a26e07af2ff2b71820808cd4 (patch) | |
tree | 06da1dd02bc268f6d375c4b1992a9e00ca0c3091 /net | |
parent | 79c6c70cbe35c270e7b59207ab76b44183a1030a (diff) |
Bluetooth: Add confirm_hint parameter to user confirmation requests
When accepting a pairing request which fulfills the SSP auto-accept
criteria we need to push the request all the way to the user for
confirmation. This patch adds a new hint to the user_confirm_request
management event so user space can know when to show a numeric
comparison dialog and when to show a simple yes/no confirmation dialog.
Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net')
-rw-r--r-- | net/bluetooth/hci_event.c | 16 | ||||
-rw-r--r-- | net/bluetooth/mgmt.c | 4 |
2 files changed, 17 insertions, 3 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index ce8e09955834..29310c78ebb3 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -2497,7 +2497,7 @@ static inline void hci_user_confirm_request_evt(struct hci_dev *hdev, | |||
2497 | struct sk_buff *skb) | 2497 | struct sk_buff *skb) |
2498 | { | 2498 | { |
2499 | struct hci_ev_user_confirm_req *ev = (void *) skb->data; | 2499 | struct hci_ev_user_confirm_req *ev = (void *) skb->data; |
2500 | int loc_mitm, rem_mitm; | 2500 | int loc_mitm, rem_mitm, confirm_hint = 0; |
2501 | struct hci_conn *conn; | 2501 | struct hci_conn *conn; |
2502 | 2502 | ||
2503 | BT_DBG("%s", hdev->name); | 2503 | BT_DBG("%s", hdev->name); |
@@ -2529,6 +2529,16 @@ static inline void hci_user_confirm_request_evt(struct hci_dev *hdev, | |||
2529 | /* If no side requires MITM protection; auto-accept */ | 2529 | /* If no side requires MITM protection; auto-accept */ |
2530 | if ((!loc_mitm || conn->remote_cap == 0x03) && | 2530 | if ((!loc_mitm || conn->remote_cap == 0x03) && |
2531 | (!rem_mitm || conn->io_capability == 0x03)) { | 2531 | (!rem_mitm || conn->io_capability == 0x03)) { |
2532 | |||
2533 | /* If we're not the initiators request authorization to | ||
2534 | * proceed from user space (mgmt_user_confirm with | ||
2535 | * confirm_hint set to 1). */ | ||
2536 | if (!test_bit(HCI_CONN_AUTH_PEND, &conn->pend)) { | ||
2537 | BT_DBG("Confirming auto-accept as acceptor"); | ||
2538 | confirm_hint = 1; | ||
2539 | goto confirm; | ||
2540 | } | ||
2541 | |||
2532 | BT_DBG("Auto-accept of user confirmation with %ums delay", | 2542 | BT_DBG("Auto-accept of user confirmation with %ums delay", |
2533 | hdev->auto_accept_delay); | 2543 | hdev->auto_accept_delay); |
2534 | 2544 | ||
@@ -2543,7 +2553,9 @@ static inline void hci_user_confirm_request_evt(struct hci_dev *hdev, | |||
2543 | goto unlock; | 2553 | goto unlock; |
2544 | } | 2554 | } |
2545 | 2555 | ||
2546 | mgmt_user_confirm_request(hdev->id, &ev->bdaddr, ev->passkey); | 2556 | confirm: |
2557 | mgmt_user_confirm_request(hdev->id, &ev->bdaddr, ev->passkey, | ||
2558 | confirm_hint); | ||
2547 | 2559 | ||
2548 | unlock: | 2560 | unlock: |
2549 | hci_dev_unlock(hdev); | 2561 | hci_dev_unlock(hdev); |
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index a7b4937d761c..a1b0ec4e5178 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -1995,13 +1995,15 @@ int mgmt_pin_code_neg_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status) | |||
1995 | return err; | 1995 | return err; |
1996 | } | 1996 | } |
1997 | 1997 | ||
1998 | int mgmt_user_confirm_request(u16 index, bdaddr_t *bdaddr, __le32 value) | 1998 | int mgmt_user_confirm_request(u16 index, bdaddr_t *bdaddr, __le32 value, |
1999 | u8 confirm_hint) | ||
1999 | { | 2000 | { |
2000 | struct mgmt_ev_user_confirm_request ev; | 2001 | struct mgmt_ev_user_confirm_request ev; |
2001 | 2002 | ||
2002 | BT_DBG("hci%u", index); | 2003 | BT_DBG("hci%u", index); |
2003 | 2004 | ||
2004 | bacpy(&ev.bdaddr, bdaddr); | 2005 | bacpy(&ev.bdaddr, bdaddr); |
2006 | ev.confirm_hint = confirm_hint; | ||
2005 | put_unaligned_le32(value, &ev.value); | 2007 | put_unaligned_le32(value, &ev.value); |
2006 | 2008 | ||
2007 | return mgmt_event(MGMT_EV_USER_CONFIRM_REQUEST, index, &ev, sizeof(ev), | 2009 | return mgmt_event(MGMT_EV_USER_CONFIRM_REQUEST, index, &ev, sizeof(ev), |