Linux bluetooth development
 help / color / mirror / Atom feed
From: Johan Hedberg <johan.hedberg@gmail.com>
To: Jaganath Kanakkassery <jaganath.k@samsung.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 1/2] Bluetooth: Move hci_outgoing_auth_needed() to hci_conn.c
Date: Thu, 3 Jan 2013 15:51:45 +0200	[thread overview]
Message-ID: <20130103135145.GA18154@x220.ger.corp.intel.com> (raw)
In-Reply-To: <1357218329-21399-1-git-send-email-jaganath.k@samsung.com>

Hi Jaganath,

On Thu, Jan 03, 2013, Jaganath Kanakkassery wrote:
> This is done so that other files can use this function
> 
> Signed-off-by: Jaganath Kanakkassery <jaganath.k@samsung.com>
> ---
>  include/net/bluetooth/hci_core.h |    1 +
>  net/bluetooth/hci_conn.c         |   17 +++++++++++++++++
>  net/bluetooth/hci_event.c        |   18 ------------------
>  3 files changed, 18 insertions(+), 18 deletions(-)
> 
> diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
> index 014a2ea..2e1897c 100644
> --- a/include/net/bluetooth/hci_core.h
> +++ b/include/net/bluetooth/hci_core.h
> @@ -706,6 +706,7 @@ int hci_get_dev_info(void __user *arg);
>  int hci_get_conn_list(void __user *arg);
>  int hci_get_conn_info(struct hci_dev *hdev, void __user *arg);
>  int hci_get_auth_info(struct hci_dev *hdev, void __user *arg);
> +int hci_outgoing_auth_needed(struct hci_dev *hdev, struct hci_conn *conn);
>  int hci_inquiry(void __user *arg);
>  
>  struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev,
> diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
> index 25bfce0..7fbabae 100644
> --- a/net/bluetooth/hci_conn.c
> +++ b/net/bluetooth/hci_conn.c
> @@ -1027,3 +1027,20 @@ struct hci_chan *hci_chan_lookup_handle(struct hci_dev *hdev, __u16 handle)
>  
>  	return hchan;
>  }
> +
> +int hci_outgoing_auth_needed(struct hci_dev *hdev, struct hci_conn *conn)
> +{
> +	if (conn->state != BT_CONFIG || !conn->out)
> +		return 0;
> +
> +	if (conn->pending_sec_level == BT_SECURITY_SDP)
> +		return 0;
> +
> +	/* Only request authentication for SSP connections or non-SSP
> +	 * devices with sec_level HIGH or if MITM protection is requested */
> +	if (!hci_conn_ssp_enabled(conn) && !(conn->auth_type & 0x01) &&
> +	    conn->pending_sec_level != BT_SECURITY_HIGH)
> +		return 0;
> +
> +	return 1;
> +}

Since you're moving this to hci_conn.c I'd prefix the function with
hci_conn_*. You should also remove the hdev parameter since it's not
used in the function (I believe the only reason it was there was for
consistency in hci_core.c).

Johan

      parent reply	other threads:[~2013-01-03 13:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-03 13:05 [PATCH 1/2] Bluetooth: Move hci_outgoing_auth_needed() to hci_conn.c Jaganath Kanakkassery
2013-01-03 13:05 ` [PATCH 2/2] Bluetooth: Fix authentication if acl data comes before remote feature evt Jaganath Kanakkassery
2013-01-03 14:00   ` Johan Hedberg
2013-01-04  5:57     ` Jaganath Kanakkassery
2013-01-03 13:51 ` Johan Hedberg [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=20130103135145.GA18154@x220.ger.corp.intel.com \
    --to=johan.hedberg@gmail.com \
    --cc=jaganath.k@samsung.com \
    --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