Re: [PATCH 2/6] Bluetooth: fix receiving L2CAP packets over LE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Ville,

On Fri, Oct 29, 2010 at 6:44 AM, Ville Tervo <ville.tervo@xxxxxxxxx> wrote:
> Hi Anderson,
>
> On Sat, Oct 23, 2010 at 01:56:56AM +0200, ext Anderson Briglia wrote:
>> From: Vinicius Costa Gomes <vinicius.gomes@xxxxxxxxxxxxx>
>>
>> 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?
>

This change is needed because without it the receiving side would
always think that it was receiving continuation frames.

As the flags parameter is zero, it would fall into the "} else {"
condition, and because no frame was received before, conn->rx_len
would be zero and the frame would be discarded. Without this patch I
was seeing those "Unexpected continuation frame ..." messages on the
receiving side.

>
>
>>
>> Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@xxxxxxxxxxxxx>
>> ---
>> Â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@xxxxxxxxxxxxxxx
>> More majordomo info at Âhttp://vger.kernel.org/majordomo-info.html
>
> --
> Ville
>


Cheers,
--
Vinicius
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux