* [PATCH BlueZ 1/3] gatt: Fix not setting permissions for CCC
@ 2022-09-21 21:46 Luiz Augusto von Dentz
2022-09-21 21:46 ` [PATCH BlueZ 2/3] gatt-db: Check if permissions are set when adding CCC Luiz Augusto von Dentz
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2022-09-21 21:46 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
CCC shall always have both Read and Write permissions set in addition to
what application set.
Fixes: https://github.com/bluez/bluez/issues/399
---
src/gatt-database.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/gatt-database.c b/src/gatt-database.c
index 89a3dc47560b..a212dfc4e694 100644
--- a/src/gatt-database.c
+++ b/src/gatt-database.c
@@ -1238,7 +1238,8 @@ static void populate_gatt_service(struct btd_gatt_database *database)
NULL, NULL, database);
database->svc_chngd_ccc = service_add_ccc(service, database, NULL, NULL,
- 0, NULL);
+ BT_ATT_PERM_READ |
+ BT_ATT_PERM_WRITE, NULL);
bt_uuid16_create(&uuid, GATT_CHARAC_CLI_FEAT);
database->cli_feat = gatt_db_service_add_characteristic(service,
@@ -1726,8 +1727,10 @@ static bool parse_chrc_flags(DBusMessageIter *array, uint8_t *props,
*perm |= BT_ATT_PERM_WRITE;
} else if (!strcmp("notify", flag)) {
*props |= BT_GATT_CHRC_PROP_NOTIFY;
+ *ccc_perm |= BT_ATT_PERM_WRITE;
} else if (!strcmp("indicate", flag)) {
*props |= BT_GATT_CHRC_PROP_INDICATE;
+ *ccc_perm |= BT_ATT_PERM_WRITE;
} else if (!strcmp("authenticated-signed-writes", flag)) {
*props |= BT_GATT_CHRC_PROP_AUTH;
*perm |= BT_ATT_PERM_WRITE;
@@ -2896,6 +2899,9 @@ static bool database_add_ccc(struct external_service *service,
!(chrc->props & BT_GATT_CHRC_PROP_INDICATE))
return true;
+ /* Always set read/write permissions */
+ chrc->ccc_perm |= BT_ATT_PERM_WRITE | BT_ATT_PERM_READ;
+
chrc->ccc = service_add_ccc(service->attrib, service->app->database,
ccc_write_cb, chrc, chrc->ccc_perm, NULL);
if (!chrc->ccc) {
--
2.37.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH BlueZ 2/3] gatt-db: Check if permissions are set when adding CCC
2022-09-21 21:46 [PATCH BlueZ 1/3] gatt: Fix not setting permissions for CCC Luiz Augusto von Dentz
@ 2022-09-21 21:46 ` Luiz Augusto von Dentz
2022-09-21 21:46 ` [PATCH BlueZ 3/3] client/gatt: Fix notification enabled/disabled output Luiz Augusto von Dentz
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2022-09-21 21:46 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
CCC shall always have some permission set.
---
src/shared/gatt-db.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/shared/gatt-db.c b/src/shared/gatt-db.c
index d3b5cec1da86..32cbf6cdc38b 100644
--- a/src/shared/gatt-db.c
+++ b/src/shared/gatt-db.c
@@ -1066,7 +1066,7 @@ gatt_db_service_add_ccc(struct gatt_db_attribute *attrib, uint32_t permissions)
struct gatt_db_attribute *value;
uint16_t handle = 0;
- if (!attrib)
+ if (!attrib || !permissions)
return NULL;
db = attrib->service->db;
--
2.37.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH BlueZ 3/3] client/gatt: Fix notification enabled/disabled output
2022-09-21 21:46 [PATCH BlueZ 1/3] gatt: Fix not setting permissions for CCC Luiz Augusto von Dentz
2022-09-21 21:46 ` [PATCH BlueZ 2/3] gatt-db: Check if permissions are set when adding CCC Luiz Augusto von Dentz
@ 2022-09-21 21:46 ` Luiz Augusto von Dentz
2022-09-21 23:09 ` [BlueZ,1/3] gatt: Fix not setting permissions for CCC bluez.test.bot
2022-09-22 1:10 ` [PATCH BlueZ 1/3] " patchwork-bot+bluetooth
3 siblings, 0 replies; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2022-09-21 21:46 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
When notifications are enabled/disable the output was not print a new
line.
---
client/gatt.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/client/gatt.c b/client/gatt.c
index 4c1efaf75ac8..efd736b2359a 100644
--- a/client/gatt.c
+++ b/client/gatt.c
@@ -2518,7 +2518,7 @@ static DBusMessage *chrc_start_notify(DBusConnection *conn, DBusMessage *msg,
chrc->notifying = true;
bt_shell_printf("[" COLORED_CHG "] Attribute %s (%s) notifications "
- "enabled", chrc->path, bt_uuidstr_to_str(chrc->uuid));
+ "enabled\n", chrc->path, bt_uuidstr_to_str(chrc->uuid));
g_dbus_emit_property_changed(conn, chrc->path, CHRC_INTERFACE,
"Notifying");
@@ -2538,7 +2538,8 @@ static DBusMessage *chrc_stop_notify(DBusConnection *conn, DBusMessage *msg,
chrc->notifying = false;
bt_shell_printf("[" COLORED_CHG "] Attribute %s (%s) notifications "
- "disabled", chrc->path, bt_uuidstr_to_str(chrc->uuid));
+ "disabled\n", chrc->path,
+ bt_uuidstr_to_str(chrc->uuid));
g_dbus_emit_property_changed(conn, chrc->path, CHRC_INTERFACE,
"Notifying");
--
2.37.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* RE: [BlueZ,1/3] gatt: Fix not setting permissions for CCC
2022-09-21 21:46 [PATCH BlueZ 1/3] gatt: Fix not setting permissions for CCC Luiz Augusto von Dentz
2022-09-21 21:46 ` [PATCH BlueZ 2/3] gatt-db: Check if permissions are set when adding CCC Luiz Augusto von Dentz
2022-09-21 21:46 ` [PATCH BlueZ 3/3] client/gatt: Fix notification enabled/disabled output Luiz Augusto von Dentz
@ 2022-09-21 23:09 ` bluez.test.bot
2022-09-22 1:10 ` [PATCH BlueZ 1/3] " patchwork-bot+bluetooth
3 siblings, 0 replies; 5+ messages in thread
From: bluez.test.bot @ 2022-09-21 23:09 UTC (permalink / raw)
To: linux-bluetooth, luiz.dentz
[-- Attachment #1: Type: text/plain, Size: 2160 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=679174
---Test result---
Test Summary:
CheckPatch PASS 3.42 seconds
GitLint PASS 2.26 seconds
Prep - Setup ELL PASS 26.17 seconds
Build - Prep PASS 0.68 seconds
Build - Configure PASS 8.15 seconds
Build - Make PASS 740.85 seconds
Make Check PASS 10.95 seconds
Make Check w/Valgrind PASS 287.39 seconds
Make Distcheck PASS 237.16 seconds
Build w/ext ELL - Configure PASS 8.19 seconds
Build w/ext ELL - Make PASS 83.30 seconds
Incremental Build w/ patches PASS 294.92 seconds
Scan Build WARNING 509.27 seconds
Details
##############################
Test: Scan Build - WARNING
Desc: Run Scan Build with patches
Output:
*****************************************************************************
The bugs reported by the scan-build may or may not be caused by your patches.
Please check the list and fix the bugs if they are caused by your patch.
*****************************************************************************
src/gatt-database.c:1138:10: warning: Value stored to 'bits' during its initialization is never read
uint8_t bits[] = { BT_GATT_CHRC_CLI_FEAT_ROBUST_CACHING,
^~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/gatt-database.c:3541:14: warning: Value stored to 'iface' during its initialization is never read
const char *iface = g_dbus_proxy_get_interface(proxy);
^~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/gatt-database.c:3542:14: warning: Value stored to 'path' during its initialization is never read
const char *path = g_dbus_proxy_get_path(proxy);
^~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 warnings generated.
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH BlueZ 1/3] gatt: Fix not setting permissions for CCC
2022-09-21 21:46 [PATCH BlueZ 1/3] gatt: Fix not setting permissions for CCC Luiz Augusto von Dentz
` (2 preceding siblings ...)
2022-09-21 23:09 ` [BlueZ,1/3] gatt: Fix not setting permissions for CCC bluez.test.bot
@ 2022-09-22 1:10 ` patchwork-bot+bluetooth
3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+bluetooth @ 2022-09-22 1:10 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
Hello:
This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Wed, 21 Sep 2022 14:46:54 -0700 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>
> CCC shall always have both Read and Write permissions set in addition to
> what application set.
>
> Fixes: https://github.com/bluez/bluez/issues/399
>
> [...]
Here is the summary with links:
- [BlueZ,1/3] gatt: Fix not setting permissions for CCC
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=fbf17ac497bb
- [BlueZ,2/3] gatt-db: Check if permissions are set when adding CCC
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=50782b0eeb05
- [BlueZ,3/3] client/gatt: Fix notification enabled/disabled output
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=c2734c41f7c0
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-09-22 1:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-21 21:46 [PATCH BlueZ 1/3] gatt: Fix not setting permissions for CCC Luiz Augusto von Dentz
2022-09-21 21:46 ` [PATCH BlueZ 2/3] gatt-db: Check if permissions are set when adding CCC Luiz Augusto von Dentz
2022-09-21 21:46 ` [PATCH BlueZ 3/3] client/gatt: Fix notification enabled/disabled output Luiz Augusto von Dentz
2022-09-21 23:09 ` [BlueZ,1/3] gatt: Fix not setting permissions for CCC bluez.test.bot
2022-09-22 1:10 ` [PATCH BlueZ 1/3] " patchwork-bot+bluetooth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox