From: Johan Hedberg <johan.hedberg@gmail.com>
To: Mikel Astiz <mikel.astiz.oss@gmail.com>
Cc: linux-bluetooth@vger.kernel.org,
Mikel Astiz <mikel.astiz@bmw-carit.de>,
Timo Mueller <timo.mueller@bmw-carit.de>
Subject: Re: [RFC v2 1/2] Bluetooth: Use defines instead of integer literals
Date: Thu, 13 Jun 2013 11:15:50 +0300 [thread overview]
Message-ID: <20130613081550.GA15607@x220> (raw)
In-Reply-To: <1369906016-17006-2-git-send-email-mikel.astiz.oss@gmail.com>
Hi Mikel,
On Thu, May 30, 2013, Mikel Astiz wrote:
> Make the code in hci_get_auth_req() more readable by using the
> defined macros instead of inlining magic numbers.
>
> Signed-off-by: Timo Mueller <timo.mueller@bmw-carit.de>
> Signed-off-by: Mikel Astiz <mikel.astiz@bmw-carit.de>
> ---
> net/bluetooth/hci_event.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
> index 0437200..777a040 100644
> --- a/net/bluetooth/hci_event.c
> +++ b/net/bluetooth/hci_event.c
> @@ -31,6 +31,7 @@
> #include <net/bluetooth/mgmt.h>
> #include <net/bluetooth/a2mp.h>
> #include <net/bluetooth/amp.h>
> +#include <net/bluetooth/smp.h>
>
> /* Handle HCI Event packets */
>
> @@ -3024,17 +3025,18 @@ unlock:
> static u8 hci_get_auth_req(struct hci_conn *conn)
> {
> /* If remote requests dedicated bonding follow that lead */
> - if (conn->remote_auth == 0x02 || conn->remote_auth == 0x03) {
> + if ((conn->remote_auth & ~0x01) == HCI_AT_DEDICATED_BONDING) {
> /* 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 == SMP_IO_NO_INPUT_OUTPUT ||
> + conn->io_capability == SMP_IO_NO_INPUT_OUTPUT)
Why are you using SMP_* defines here and not HCI_*? If the HCI ones are
missing in some header file please feel free to add them.
Johan
next prev parent reply other threads:[~2013-06-13 8:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-30 9:26 [RFC v2 0/2] SSP MITM protection for General Bonding Mikel Astiz
2013-05-30 9:26 ` [RFC v2 1/2] Bluetooth: Use defines instead of integer literals Mikel Astiz
2013-06-13 8:15 ` Johan Hedberg [this message]
2013-05-30 9:26 ` [RFC v2 2/2] Bluetooth: Use MITM protection when responding LM Mikel Astiz
2013-06-13 8:32 ` Johan Hedberg
2013-06-17 6:50 ` Mikel Astiz
2013-06-13 8:08 ` [RFC v2 0/2] SSP MITM protection for General Bonding Mikel Astiz
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=20130613081550.GA15607@x220 \
--to=johan.hedberg@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=mikel.astiz.oss@gmail.com \
--cc=mikel.astiz@bmw-carit.de \
--cc=timo.mueller@bmw-carit.de \
/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).