linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dylan Taft <dylanetaft@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: Odd l2cap_sock.c Code?
Date: Sun, 11 Nov 2018 22:14:12 -0500	[thread overview]
Message-ID: <CAKz1w-==yXd4EL39ULE6bcYU3fTpZB9D0EqdgRhq4L38kVzYEg@mail.gmail.com> (raw)

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/net/bluetooth/l2cap_sock.c

Per the bluetooth core spec
https://www.bluetooth.com/specifications/bluetooth-core-specification
Page 2184, section 3.4.2.1 Exchange MTU Request, PDUs may be sent to
negotiate MTU size upon connection

Line 415 in l2cap_sock.c, if address types being used are Bluetooth 2 types,
it looks like setsockopt(xx, SOL_L2CAP, L2CAP_OPTIONS, xx, xx) is
INTENDED to fail with EINVAL errno, but for Bluetooth 2.x connections
it would work fine.

Line 920 - setsockopt(xx,SOL_BLUETOOTH,BT_RCVMTU,xx,xx) looks to be
INTENDED to fail if a connection is already established on the socket

The legacy kernel code goes and sets imtu and omtu without any other code.

Per the bluetooth spec - inbound and outbound MTU should be set to the
minimum MTU between the devices during this ATT PDU handshake.

As it stands right now, it looks like the kernel would require
disconnecting\reconnecting the socket.

I bet it could be changed to mirror the old setsockopt SOL_L2CAP code,
so BT2 behaves like BT4+ - but it's not my code and I'm not a BT guru
so I'd hate to just submit a patch for it.

Is this all intentional?

It seems like both imtu and omtu should be allowed to be set in the
new code, like the legacy code.

Thanks!
Dylan

             reply	other threads:[~2018-11-12  3:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-12  3:14 Dylan Taft [this message]
2018-11-12  3:43 ` Odd l2cap_sock.c Code? Dylan Taft
2018-11-12  5:25   ` Dylan Taft
2018-11-12  9:51     ` Luiz Augusto von Dentz

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='CAKz1w-==yXd4EL39ULE6bcYU3fTpZB9D0EqdgRhq4L38kVzYEg@mail.gmail.com' \
    --to=dylanetaft@gmail.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;
as well as URLs for NNTP newsgroup(s).