From: Andrei Emeltchenko <andrei.emeltchenko.news@gmail.com>
To: Brian Gix <bgix@codeaurora.org>
Cc: BlueZ development <linux-bluetooth@vger.kernel.org>
Subject: Re: [RFC 1/1] Bluetooth: Add LE SecMgr and mgmtops support
Date: Thu, 10 Nov 2011 14:58:08 +0200 [thread overview]
Message-ID: <20111110125807.GC8486@aemeltch-MOBL1> (raw)
In-Reply-To: <4EB854F0.60808@codeaurora.org>
Hi Brian,
On Mon, Nov 07, 2011 at 02:00:16PM -0800, Brian Gix wrote:
...
> hci_extended_inquiry_result_evt(struct hci_dev *hdev, struct
>
> static inline u8 hci_get_auth_req(struct hci_conn *conn)
> {
> + BT_DBG("%p", conn);
> +
> /* If remote requests dedicated bonding follow that lead */
> if (conn->remote_auth == 0x02 || conn->remote_auth == 0x03) {
> /* If both remote and local IO capabilities allow MITM
> * protection then require it, otherwise don't */
> - if (conn->remote_cap == 0x03 || conn->io_capability == 0x03)
> + if (conn->remote_cap == 0x03 || conn->io_capability == 0x03) {
> return 0x02;
> - else
> + } else {
> + conn->auth_type |= 0x01;
> return 0x03;
> + }
> }
Maybe you could also fix those magic numbers issues. We shall define
capabilities.
>
> /* If remote requests no-bonding follow that lead */
> - if (conn->remote_auth == 0x00 || conn->remote_auth == 0x01)
> - return conn->remote_auth | (conn->auth_type & 0x01);
> + if (conn->remote_auth <= 0x01)
> + return 0x00;
>
> return conn->auth_type;
> }
> @@ -2626,11 +2660,15 @@ static inline void
> hci_io_capa_request_evt(struct hci_dev *hdev, struct sk_buff
> if (test_bit(HCI_PAIRABLE, &hdev->flags) ||
> (conn->remote_auth & ~0x01) == HCI_AT_NO_BONDING) {
> struct hci_cp_io_capability_reply cp;
> + u8 io_cap = conn->io_capability;
>
> + /* ACL-SSP does not support IO CAP 0x04 */
> + cp.capability = (io_cap == 0x04) ? 0x01 : io_cap;
> bacpy(&cp.bdaddr, &ev->bdaddr);
> - cp.capability = conn->io_capability;
> - conn->auth_type = hci_get_auth_req(conn);
> - cp.authentication = conn->auth_type;
> + if (conn->auth_initiator)
> + cp.authentication = conn->auth_type;
> + else
> + cp.authentication = hci_get_auth_req(conn);
>
> if ((conn->out == 0x01 || conn->remote_oob == 0x01) &&
> hci_find_remote_oob_data(hdev, &conn->dst))
> @@ -2675,24 +2713,28 @@ unlock:
> hci_dev_unlock(hdev);
...
Best regards
Andrei Emeltchenko
prev parent reply other threads:[~2011-11-10 12:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-07 22:00 [RFC 1/1] Bluetooth: Add LE SecMgr and mgmtops support Brian Gix
2011-11-07 22:58 ` Gustavo Padovan
2011-11-07 23:07 ` Brian Gix
2011-11-10 12:58 ` Andrei Emeltchenko [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111110125807.GC8486@aemeltch-MOBL1 \
--to=andrei.emeltchenko.news@gmail.com \
--cc=bgix@codeaurora.org \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).