linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ville Tervo <ville.tervo@nokia.com>
To: ext Anderson Briglia <anderson.briglia@openbossa.org>
Cc: "linux-bluetooth@vger.kernel.org"
	<linux-bluetooth@vger.kernel.org>,
	Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Subject: Re: [PATCH 2/6] Bluetooth: fix receiving L2CAP packets over LE
Date: Fri, 29 Oct 2010 13:44:35 +0300	[thread overview]
Message-ID: <20101029104435.GQ15050@null> (raw)
In-Reply-To: <1287791820-22693-3-git-send-email-anderson.briglia@openbossa.org>

Hi Anderson,

On Sat, Oct 23, 2010 at 01:56:56AM +0200, ext Anderson Briglia wrote:
> From: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
> 
> As L2CAP packets coming over LE don't have any more encapsulation,
> other than L2CAP, we are able to process them as soon as they arrive.

Why is this change needed? Was something broken without this patch?



> 
> Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
> ---
>  net/bluetooth/l2cap.c |   17 +++++++++++++++--
>  1 files changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
> index 2bf083e..1ac44f4 100644
> --- a/net/bluetooth/l2cap.c
> +++ b/net/bluetooth/l2cap.c
> @@ -4768,17 +4768,30 @@ static int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt)
>  static int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags)
>  {
>  	struct l2cap_conn *conn = hcon->l2cap_data;
> +	struct l2cap_hdr *hdr;
> +	int len;
>  
>  	if (!conn && !(conn = l2cap_conn_add(hcon, 0)))
>  		goto drop;
>  
>  	BT_DBG("conn %p len %d flags 0x%x", conn, skb->len, flags);
>  
> +	if (hcon->type == LE_LINK) {
> +		hdr = (struct l2cap_hdr *) skb->data;
> +		len = __le16_to_cpu(hdr->len) + L2CAP_HDR_SIZE;
> +
> +		if (len == skb->len) {
> +			/* Complete frame received */
> +			l2cap_recv_frame(conn, skb);
> +			return 0;
> +		}
> +
> +		goto drop;
> +	}
> +
>  	if (flags & ACL_START) {
> -		struct l2cap_hdr *hdr;
>  		struct sock *sk;
>  		u16 cid;
> -		int len;
>  
>  		if (conn->rx_len) {
>  			BT_ERR("Unexpected start frame (len %d)", skb->len);
> -- 
> 1.7.0.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Ville

  reply	other threads:[~2010-10-29 10:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-22 23:56 [PATCH 2/6] Bluetooth: fix receiving L2CAP packets over LE Anderson Briglia
2010-10-29 10:44 ` Ville Tervo [this message]
2010-10-29 13:41   ` Vinicius Gomes
2010-10-29 20:50     ` Gustavo F. Padovan
2010-10-30  3:31       ` Vinicius Gomes
2010-11-01  8:51       ` Ville Tervo

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=20101029104435.GQ15050@null \
    --to=ville.tervo@nokia.com \
    --cc=anderson.briglia@openbossa.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=vinicius.gomes@openbossa.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).