提交 2e05550c 编写于 作者: L Luiz Augusto von Dentz 提交者: Zheng Zengkai

Bluetooth: Fix not sending Set Extended Scan Response

stable inclusion
from stable-5.10.50
commit c5fedfcc2046ab8b67befdf78ebd34ad561088b3
bugzilla: 174522 https://gitee.com/openeuler/kernel/issues/I4DNFY

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=c5fedfcc2046ab8b67befdf78ebd34ad561088b3

--------------------------------

[ Upstream commit a76a0d36 ]

Current code is actually failing on the following tests of mgmt-tester
because get_adv_instance_scan_rsp_len did not account for flags that
cause scan response data to be included resulting in non-scannable
instance when in fact it should be scannable.
Signed-off-by: NLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: NJohan Hedberg <johan.hedberg@intel.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 c7056362
...@@ -1060,9 +1060,10 @@ static u8 get_adv_instance_scan_rsp_len(struct hci_dev *hdev, u8 instance) ...@@ -1060,9 +1060,10 @@ static u8 get_adv_instance_scan_rsp_len(struct hci_dev *hdev, u8 instance)
if (!adv_instance) if (!adv_instance)
return 0; return 0;
/* TODO: Take into account the "appearance" and "local-name" flags here. if (adv_instance->flags & MGMT_ADV_FLAG_APPEARANCE ||
* These are currently being ignored as they are not supported. adv_instance->flags & MGMT_ADV_FLAG_LOCAL_NAME)
*/ return 1;
return adv_instance->scan_rsp_len; return adv_instance->scan_rsp_len;
} }
...@@ -1599,14 +1600,11 @@ void __hci_req_update_scan_rsp_data(struct hci_request *req, u8 instance) ...@@ -1599,14 +1600,11 @@ void __hci_req_update_scan_rsp_data(struct hci_request *req, u8 instance)
memset(&cp, 0, sizeof(cp)); memset(&cp, 0, sizeof(cp));
/* Extended scan response data doesn't allow a response to be if (instance)
* set if the instance isn't scannable.
*/
if (get_adv_instance_scan_rsp_len(hdev, instance))
len = create_instance_scan_rsp_data(hdev, instance, len = create_instance_scan_rsp_data(hdev, instance,
cp.data); cp.data);
else else
len = 0; len = create_default_scan_rsp_data(hdev, cp.data);
if (hdev->scan_rsp_data_len == len && if (hdev->scan_rsp_data_len == len &&
!memcmp(cp.data, hdev->scan_rsp_data, len)) !memcmp(cp.data, hdev->scan_rsp_data, len))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册