Re: GATT server does not handle "Invalid Offset" and "Invalid Attribute Value Length" errors properly

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

 



Hi Konstantin,

On Thu, Dec 19, 2019 at 12:36 AM Konstantin Forostyan
<konstantin.forostyan@xxxxxxxxxxxxx> wrote:
>
> Hi,
>
> According to Bluetooth specs (BLUETOOTH CORE SPECIFICATION Version 5.1
> | Vol 3, Part F 3.4.6.1 Prepare Write Request):
>
> "... The Attribute Value validation is done when an Execute Write
> Request is received. Hence, any Invalid Offset or Invalid Attribute
> Value Length errors are generated when an Execute Write Request is
> received. ..."
>
> In contrary to the specs, 'bluetoothd' is sending error response during
> prepare write. The following patch changes this behaviour:
>
>
> --- a/src/shared/gatt-server.c  2018-06-01 10:37:36.000000000 +0200
> +++ b/src/shared/gatt-server.c  2019-12-13 12:25:22.000000000 +0100
> @@ -1223,7 +1223,17 @@
>
>         handle = get_le16(pwcd->pdu);
>
> -       if (err) {
> +       if ((0 != err) && (BT_ATT_ERROR_INVALID_OFFSET != err)
> +               && (BT_ATT_ERROR_INVALID_ATTRIBUTE_VALUE_LEN != err)) {
>                 bt_att_send_error_rsp(pwcd->server->att,
>                                         BT_ATT_OP_PREP_WRITE_REQ,
> handle, err);
>                 free(pwcd->pdu);

Yep, I remember this one actually since we did fix something similar
in Zephyr we would need to move the error checking to execute, btw is
this with bluetoothd or gatt-server tool, the later is probably not
recommended for qualification as it is more of a validation tool it
may not be feature complete.


-- 
Luiz Augusto von Dentz



[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