All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ] adapter: Fix link key address type for old kernels
@ 2023-12-17 13:50 Xiao Yao
  2023-12-17 17:31 ` [BlueZ] " bluez.test.bot
  2023-12-18 17:18 ` [PATCH BlueZ] " Luiz Augusto von Dentz
  0 siblings, 2 replies; 3+ messages in thread
From: Xiao Yao @ 2023-12-17 13:50 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: antiz, Xiao Yao

From: Xiao Yao <xiaoyao@rock-chips.com>

Fixes: https://github.com/bluez/bluez/issues/686

Signed-off-by: Xiao Yao <xiaoyao@rock-chips.com>
---
 src/adapter.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/adapter.c b/src/adapter.c
index ee70b00d2..b4628a411 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -4347,7 +4347,17 @@ static void load_link_keys(struct btd_adapter *adapter, GSList *keys,
 		struct link_key_info *info = l->data;
 
 		bacpy(&key->addr.bdaddr, &info->bdaddr);
-		key->addr.type = info->bdaddr_type;
+
+		/*
+		 * According to the Bluetooth specification, the address
+		 * type of the link key is not fixed. However, the
+		 * load_link_keys function in the old kernel code requires
+		 * that the address type must be BREDR. Since the address
+		 * type is not actually used by the link key, to maintain
+		 * compatibility with older kernel versions, the addr.type
+		 * of the link key is set to BDADDR_BREDR.
+		 */
+		key->addr.type = BDADDR_BREDR;
 		key->type = info->type;
 		memcpy(key->val, info->key, 16);
 		key->pin_len = info->pin_len;
-- 
2.34.1


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

* RE: [BlueZ] adapter: Fix link key address type for old kernels
  2023-12-17 13:50 [PATCH BlueZ] adapter: Fix link key address type for old kernels Xiao Yao
@ 2023-12-17 17:31 ` bluez.test.bot
  2023-12-18 17:18 ` [PATCH BlueZ] " Luiz Augusto von Dentz
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2023-12-17 17:31 UTC (permalink / raw)
  To: linux-bluetooth, xiaokeqinhealth

[-- Attachment #1: Type: text/plain, Size: 946 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=810816

---Test result---

Test Summary:
CheckPatch                    PASS      1.04 seconds
GitLint                       PASS      0.37 seconds
BuildEll                      PASS      23.78 seconds
BluezMake                     PASS      699.36 seconds
MakeCheck                     PASS      11.67 seconds
MakeDistcheck                 PASS      153.15 seconds
CheckValgrind                 PASS      214.28 seconds
CheckSmatch                   PASS      317.31 seconds
bluezmakeextell               PASS      100.06 seconds
IncrementalBuild              PASS      641.96 seconds
ScanBuild                     PASS      915.99 seconds



---
Regards,
Linux Bluetooth


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

* Re: [PATCH BlueZ] adapter: Fix link key address type for old kernels
  2023-12-17 13:50 [PATCH BlueZ] adapter: Fix link key address type for old kernels Xiao Yao
  2023-12-17 17:31 ` [BlueZ] " bluez.test.bot
@ 2023-12-18 17:18 ` Luiz Augusto von Dentz
  1 sibling, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2023-12-18 17:18 UTC (permalink / raw)
  To: Xiao Yao; +Cc: linux-bluetooth, antiz, Xiao Yao

Hi Xiao,

On Sun, Dec 17, 2023 at 11:21 AM Xiao Yao <xiaokeqinhealth@126.com> wrote:
>
> From: Xiao Yao <xiaoyao@rock-chips.com>
>
> Fixes: https://github.com/bluez/bluez/issues/686
>
> Signed-off-by: Xiao Yao <xiaoyao@rock-chips.com>
> ---
>  src/adapter.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/src/adapter.c b/src/adapter.c
> index ee70b00d2..b4628a411 100644
> --- a/src/adapter.c
> +++ b/src/adapter.c
> @@ -4347,7 +4347,17 @@ static void load_link_keys(struct btd_adapter *adapter, GSList *keys,
>                 struct link_key_info *info = l->data;
>
>                 bacpy(&key->addr.bdaddr, &info->bdaddr);
> -               key->addr.type = info->bdaddr_type;
> +
> +               /*
> +                * According to the Bluetooth specification, the address
> +                * type of the link key is not fixed. However, the
> +                * load_link_keys function in the old kernel code requires
> +                * that the address type must be BREDR. Since the address
> +                * type is not actually used by the link key, to maintain
> +                * compatibility with older kernel versions, the addr.type
> +                * of the link key is set to BDADDR_BREDR.
> +                */
> +               key->addr.type = BDADDR_BREDR;

We probably want to find a way to detect if the kernel is capable of
handling the addr type or not, maybe attempt to load with it set and
in case it doesn't work then use BREDR.

>                 key->type = info->type;
>                 memcpy(key->val, info->key, 16);
>                 key->pin_len = info->pin_len;
> --
> 2.34.1
>
>


-- 
Luiz Augusto von Dentz

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

end of thread, other threads:[~2023-12-18 17:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-17 13:50 [PATCH BlueZ] adapter: Fix link key address type for old kernels Xiao Yao
2023-12-17 17:31 ` [BlueZ] " bluez.test.bot
2023-12-18 17:18 ` [PATCH BlueZ] " Luiz Augusto von Dentz

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.