Received: by 2002:a05:7412:8d08:b0:f9:2d0a:d759 with SMTP id bj8csp209751rdb; Sun, 17 Dec 2023 08:21:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IGtrxK8V0kg9S11OoQogsIS5dqFreX7yePEhdHI4ZQsDm6SfKGctCWN6e7s8pZEO+iOEoNp X-Received: by 2002:a05:600c:c1b:b0:40c:835:c64b with SMTP id fm27-20020a05600c0c1b00b0040c0835c64bmr3932823wmb.29.1702830085438; Sun, 17 Dec 2023 08:21:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702830085; cv=none; d=google.com; s=arc-20160816; b=K7bDNjvefDvca3qw0InYdNSaYH/jB6MgqSulo9nfEXdJFpvimgTo+8lqBKDL5V+Mfq BvHHtBJvpETpQsWUpYXI8lFjLYU3kTBvCeLQCgyMLAlrWKD2BOdd0Cuit/BVhgbZUEp2 0FmBFyTYKNCN6gRvp+KKD77HXb0d02WQVA28aUFzPRl/3rWzaarQItfDqWR7t1tFcQ8Q XOQA4Nb2X10SjEEH437SHq7vfrR7Jmw9c3Hlmf6YQ77sDhFFj6q3VkWdCNhSy+nniB/y ymoxRers1GdNMXLO7PFGx5K774LoTIUFwuEWPQ8T79/9CkEITPAh+Vs+zeo6laY2Zbfj 4pOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=/+aCDSDvCkWff7kQfh+ZT1atrjsQegON3DWG1uWF/Gw=; fh=fCExiXiuTlYOWDfLoJ9IAePUxYc6kP1PDQ2XRLOnkY4=; b=T6668ohzEYCW7UbLMzBkD4pMYDkjTiqQv4JWOL75Oy/CcNg1GZ2I7J+8X72Ln2hatL YFGksEwC4ppalAXfQgnNdxwFEr7dgLDbLdBJQIX4d6TPprmYOEyvoUlPqyOf3xKUe9UK Hn8UJJP/SNs5pSimEhaM0Ev6+sR4gBtHYphfKe7UfHKD5j5Z6hoUj86sj0vsC8fbFc2S ypRrMGMl0o6MF92LUH2lBdLUlxv0v+402qv9Nd3QISoVGdR4Lk6HgE9kC9Ek13X7dXZM R88WoeQutC/trdp1WJuTTMRkmq6a79wd/uTp35EFwwM1HefkXXRmNqdtGKgYxfLZwZeM SoGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@126.com header.s=s110527 header.b=fAPS6Zmh; spf=pass (google.com: domain of linux-bluetooth+bounces-638-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-638-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=126.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id e4-20020a170906c00400b00a230fafaef3si3407580ejz.865.2023.12.17.08.21.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Dec 2023 08:21:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-638-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@126.com header.s=s110527 header.b=fAPS6Zmh; spf=pass (google.com: domain of linux-bluetooth+bounces-638-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-638-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=126.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 342241F229C0 for ; Sun, 17 Dec 2023 16:21:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2D14C45BE4; Sun, 17 Dec 2023 16:21:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=126.com header.i=@126.com header.b="fAPS6Zmh" X-Original-To: linux-bluetooth@vger.kernel.org Received: from m126.mail.126.com (m126.mail.126.com [220.181.12.35]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 00BB545970 for ; Sun, 17 Dec 2023 16:21:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=126.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=126.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=/+aCD SDvCkWff7kQfh+ZT1atrjsQegON3DWG1uWF/Gw=; b=fAPS6Zmhe4hXyvq7BCIGA kcN1FtTlcP9Kugj1fIbYHpa4JaQbYD5dVLgYOZoSjX6KdG2M/uQvrpb9MBvQ/gih ebLnr4miOKaBUjxBUhyWb0hOkCuASYBSKKVy0TsKDSoc22HBy2EN9gZPWqd/ctHl xO1DWCJVRupwMneqipW9ck= Received: from localhost.localdomain (unknown [58.22.7.114]) by zwqz-smtp-mta-g3-0 (Coremail) with SMTP id _____wDHDjic_H5ldFh4EA--.9809S2; Sun, 17 Dec 2023 21:50:22 +0800 (CST) From: Xiao Yao To: linux-bluetooth@vger.kernel.org Cc: antiz@archlinux.org, Xiao Yao Subject: [PATCH BlueZ] adapter: Fix link key address type for old kernels Date: Sun, 17 Dec 2023 21:50:12 +0800 Message-Id: <20231217135012.1476534-1-xiaokeqinhealth@126.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:_____wDHDjic_H5ldFh4EA--.9809S2 X-Coremail-Antispam: 1Uf129KBjvdXoWrtr4DJry3uryrJF13GFWktFb_yoWkWrXE9a 1UWryxGrW5AFsxGa95X3Z7uryxKw4furykZ3Wftas3Ar15Xa13XFnrXFs3ArnxJa15ta9r JFs8Wr98tF1xGjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUjAhL5UUUUU== X-CM-SenderInfo: 50ld0yhhtl0xhhdo3xa6rslhhfrp/1tbiEANJ1WVLY6CMOgAAsU From: Xiao Yao Fixes: https://github.com/bluez/bluez/issues/686 Signed-off-by: Xiao Yao --- 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