* [PATCH BlueZ v2] device: Reply br-connection-key-missing on connection bonding error
@ 2025-05-15 16:34 Frédéric Danis
2025-05-15 18:02 ` [BlueZ,v2] " bluez.test.bot
2025-05-15 20:10 ` [PATCH BlueZ v2] " patchwork-bot+bluetooth
0 siblings, 2 replies; 3+ messages in thread
From: Frédéric Danis @ 2025-05-15 16:34 UTC (permalink / raw)
To: linux-bluetooth
Currently when connection is removed while the client is waiting for
Connect() the failed message is br-connection-canceled, even if this
is due to bonding error.
Implement to reply with br-connection-key-missing, when the connection
request fails due to a bonding authentication error, allowing the client
to differentiate connection failure reasons.
This has been tested by:
- pair a device
- disconnect
- edit pairing info to change last character of Key entry of [LinkKey] in
/var/lib/bluetooth/<adapter_address>/<device_address>?info
- restart bluetoothd
- in bluetoothctl, connect <device_address>
---
v1->v2:
- Improve commit message.
- Reply br-connection-key-missing only on authentication error.
- Request disconnection on authentication error instead of waiting for
normal disconnection.
src/device.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/device.c b/src/device.c
index c364d72c3..d230af0a8 100644
--- a/src/device.c
+++ b/src/device.c
@@ -246,6 +246,7 @@ struct btd_device {
struct browse_req *browse; /* service discover request */
struct bonding_req *bonding;
struct authentication_req *authr; /* authentication request */
+ uint8_t bonding_status;
GSList *disconnects; /* disconnects message */
DBusMessage *connect; /* connect message */
DBusMessage *disconnect; /* disconnect message */
@@ -1917,10 +1918,17 @@ void device_request_disconnect(struct btd_device *device, DBusMessage *msg)
}
if (device->connect) {
- DBusMessage *reply = btd_error_failed(device->connect,
- ERR_BREDR_CONN_CANCELED);
+ const char *err_str;
+ DBusMessage *reply;
+
+ if (device->bonding_status == MGMT_STATUS_AUTH_FAILED)
+ err_str = ERR_BREDR_CONN_KEY_MISSING;
+ else
+ err_str = ERR_BREDR_CONN_CANCELED;
+ reply = btd_error_failed(device->connect, err_str);
g_dbus_send_message(dbus_conn, reply);
dbus_message_unref(device->connect);
+ device->bonding_status = 0;
device->connect = NULL;
}
@@ -6763,6 +6771,10 @@ void device_bonding_complete(struct btd_device *device, uint8_t bdaddr_type,
DBG("bonding %p status 0x%02x", bonding, status);
+ device->bonding_status = status;
+ if (status == MGMT_STATUS_AUTH_FAILED)
+ device_request_disconnect(device, NULL);
+
if (auth && auth->agent)
agent_cancel(auth->agent);
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* RE: [BlueZ,v2] device: Reply br-connection-key-missing on connection bonding error
2025-05-15 16:34 [PATCH BlueZ v2] device: Reply br-connection-key-missing on connection bonding error Frédéric Danis
@ 2025-05-15 18:02 ` bluez.test.bot
2025-05-15 20:10 ` [PATCH BlueZ v2] " patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2025-05-15 18:02 UTC (permalink / raw)
To: linux-bluetooth, frederic.danis
[-- Attachment #1: Type: text/plain, Size: 1261 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=963312
---Test result---
Test Summary:
CheckPatch PENDING 0.28 seconds
GitLint PENDING 0.34 seconds
BuildEll PASS 20.22 seconds
BluezMake PASS 2706.04 seconds
MakeCheck PASS 20.51 seconds
MakeDistcheck PASS 198.22 seconds
CheckValgrind PASS 274.95 seconds
CheckSmatch PASS 302.48 seconds
bluezmakeextell PASS 130.07 seconds
IncrementalBuild PENDING 0.35 seconds
ScanBuild PASS 903.40 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH BlueZ v2] device: Reply br-connection-key-missing on connection bonding error
2025-05-15 16:34 [PATCH BlueZ v2] device: Reply br-connection-key-missing on connection bonding error Frédéric Danis
2025-05-15 18:02 ` [BlueZ,v2] " bluez.test.bot
@ 2025-05-15 20:10 ` patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2025-05-15 20:10 UTC (permalink / raw)
To: =?utf-8?b?RnLDqWTDqXJpYyBEYW5pcyA8ZnJlZGVyaWMuZGFuaXNAY29sbGFib3JhLmNvbT4=?=
Cc: linux-bluetooth
Hello:
This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Thu, 15 May 2025 18:34:48 +0200 you wrote:
> Currently when connection is removed while the client is waiting for
> Connect() the failed message is br-connection-canceled, even if this
> is due to bonding error.
>
> Implement to reply with br-connection-key-missing, when the connection
> request fails due to a bonding authentication error, allowing the client
> to differentiate connection failure reasons.
>
> [...]
Here is the summary with links:
- [BlueZ,v2] device: Reply br-connection-key-missing on connection bonding error
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=00969bdb17ea
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] 3+ messages in thread
end of thread, other threads:[~2025-05-15 20:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-15 16:34 [PATCH BlueZ v2] device: Reply br-connection-key-missing on connection bonding error Frédéric Danis
2025-05-15 18:02 ` [BlueZ,v2] " bluez.test.bot
2025-05-15 20:10 ` [PATCH BlueZ v2] " patchwork-bot+bluetooth
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.