linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ 1/2] att: Return error in case Exchange MTU is used over BR/EDR link
@ 2019-07-03 15:42 Luiz Augusto von Dentz
  2019-07-03 15:42 ` [PATCH BlueZ 2/2] gatt: Require medium security for ATT socket over BR/EDR Luiz Augusto von Dentz
  2019-07-09  8:14 ` [PATCH BlueZ 1/2] att: Return error in case Exchange MTU is used over BR/EDR link Luiz Augusto von Dentz
  0 siblings, 2 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2019-07-03 15:42 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

In case of BR/EDR the L2CAP MTU negotion is used instead:

  BLUETOOTH CORE SPECIFICATION Version 5.1 | Vol 3, Part G page 2370
  4.3.1 Exchange MTU

  This sub-procedure shall not be used on a BR/EDR physical link since
  the MTU size is negotiated using L2CAP channel configuration
  procedures.
---
 src/shared/att.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/src/shared/att.c b/src/shared/att.c
index 04577eddd..0ea6d55bd 100644
--- a/src/shared/att.c
+++ b/src/shared/att.c
@@ -836,6 +836,22 @@ static void handle_notify(struct bt_att *att, uint8_t opcode, uint8_t *pdu,
 		if (!opcode_match(notify->opcode, opcode))
 			continue;
 
+		/* BLUETOOTH CORE SPECIFICATION Version 5.1 | Vol 3, Part G
+		 * page 2370
+		 *
+		 * 4.3.1 Exchange MTU
+		 *
+		 * This sub-procedure shall not be used on a BR/EDR physical
+		 * link since the MTU size is negotiated using L2CAP channel
+		 * configuration procedures.
+		 */
+		if (bt_att_get_link_type(att) == BT_ATT_LINK_BREDR) {
+			switch (opcode) {
+			case BT_ATT_OP_MTU_REQ:
+				goto not_supported;
+			}
+		}
+
 		found = true;
 
 		if (notify->callback)
@@ -847,6 +863,7 @@ static void handle_notify(struct bt_att *att, uint8_t opcode, uint8_t *pdu,
 			break;
 	}
 
+not_supported:
 	/*
 	 * If this was not a command and no handler was registered for it,
 	 * respond with "Not Supported"
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH BlueZ 2/2] gatt: Require medium security for ATT socket over BR/EDR
  2019-07-03 15:42 [PATCH BlueZ 1/2] att: Return error in case Exchange MTU is used over BR/EDR link Luiz Augusto von Dentz
@ 2019-07-03 15:42 ` Luiz Augusto von Dentz
  2019-07-09  8:14 ` [PATCH BlueZ 1/2] att: Return error in case Exchange MTU is used over BR/EDR link Luiz Augusto von Dentz
  1 sibling, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2019-07-03 15:42 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Encryption is required according to the spec:

  BLUETOOTH CORE SPECIFICATION Version 5.1 | Vol 3, Part G page 2397:

  5.1.2 BR/EDR channel requirements

  The channel shall be encrypted. The Key_Type shall be either an
  Unauthenticated Combination Key or an Authenticated Combination Key.
---
 src/gatt-database.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gatt-database.c b/src/gatt-database.c
index 548eabaa3..d90927559 100644
--- a/src/gatt-database.c
+++ b/src/gatt-database.c
@@ -3535,7 +3535,7 @@ struct btd_gatt_database *btd_gatt_database_new(struct btd_adapter *adapter)
 	database->l2cap_io = bt_io_listen(connect_cb, NULL, NULL, NULL, &gerr,
 					BT_IO_OPT_SOURCE_BDADDR, addr,
 					BT_IO_OPT_PSM, ATT_PSM,
-					BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_LOW,
+					BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_MEDIUM,
 					BT_IO_OPT_MTU, main_opts.gatt_mtu,
 					BT_IO_OPT_INVALID);
 	if (database->l2cap_io == NULL) {
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH BlueZ 1/2] att: Return error in case Exchange MTU is used over BR/EDR link
  2019-07-03 15:42 [PATCH BlueZ 1/2] att: Return error in case Exchange MTU is used over BR/EDR link Luiz Augusto von Dentz
  2019-07-03 15:42 ` [PATCH BlueZ 2/2] gatt: Require medium security for ATT socket over BR/EDR Luiz Augusto von Dentz
@ 2019-07-09  8:14 ` Luiz Augusto von Dentz
  1 sibling, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2019-07-09  8:14 UTC (permalink / raw)
  To: linux-bluetooth

Hi,

On Wed, Jul 3, 2019 at 6:42 PM Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
>
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>
> In case of BR/EDR the L2CAP MTU negotion is used instead:
>
>   BLUETOOTH CORE SPECIFICATION Version 5.1 | Vol 3, Part G page 2370
>   4.3.1 Exchange MTU
>
>   This sub-procedure shall not be used on a BR/EDR physical link since
>   the MTU size is negotiated using L2CAP channel configuration
>   procedures.
> ---
>  src/shared/att.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
>
> diff --git a/src/shared/att.c b/src/shared/att.c
> index 04577eddd..0ea6d55bd 100644
> --- a/src/shared/att.c
> +++ b/src/shared/att.c
> @@ -836,6 +836,22 @@ static void handle_notify(struct bt_att *att, uint8_t opcode, uint8_t *pdu,
>                 if (!opcode_match(notify->opcode, opcode))
>                         continue;
>
> +               /* BLUETOOTH CORE SPECIFICATION Version 5.1 | Vol 3, Part G
> +                * page 2370
> +                *
> +                * 4.3.1 Exchange MTU
> +                *
> +                * This sub-procedure shall not be used on a BR/EDR physical
> +                * link since the MTU size is negotiated using L2CAP channel
> +                * configuration procedures.
> +                */
> +               if (bt_att_get_link_type(att) == BT_ATT_LINK_BREDR) {
> +                       switch (opcode) {
> +                       case BT_ATT_OP_MTU_REQ:
> +                               goto not_supported;
> +                       }
> +               }
> +
>                 found = true;
>
>                 if (notify->callback)
> @@ -847,6 +863,7 @@ static void handle_notify(struct bt_att *att, uint8_t opcode, uint8_t *pdu,
>                         break;
>         }
>
> +not_supported:
>         /*
>          * If this was not a command and no handler was registered for it,
>          * respond with "Not Supported"
> --
> 2.21.0

Applied.


-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-07-09  8:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-03 15:42 [PATCH BlueZ 1/2] att: Return error in case Exchange MTU is used over BR/EDR link Luiz Augusto von Dentz
2019-07-03 15:42 ` [PATCH BlueZ 2/2] gatt: Require medium security for ATT socket over BR/EDR Luiz Augusto von Dentz
2019-07-09  8:14 ` [PATCH BlueZ 1/2] att: Return error in case Exchange MTU is used over BR/EDR link Luiz Augusto von Dentz

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).