This commit is contained in:
Peter Robinson 2023-09-29 10:31:57 +01:00
parent f9916450f1
commit 42fca29953
3 changed files with 116 additions and 4 deletions

View File

@ -5,7 +5,7 @@
%endif
Name: bluez
Version: 5.69
Version: 5.70
Release: 1%{?dist}
Summary: Bluetooth utilities
License: GPLv2+
@ -146,12 +146,13 @@ Object Exchange daemon for sharing files, contacts etc over bluetooth
%build
autoreconf -vif
%configure --enable-tools --enable-library --disable-optimization \
%configure --enable-tools --enable-library \
--enable-external-ell --disable-optimization \
%if %{with deprecated}
--enable-deprecated \
%endif
--enable-sixaxis --enable-cups --enable-nfc --enable-mesh \
--enable-hid2hci --enable-testing \
--enable-hid2hci --enable-testing --enable-experimental \
--with-systemdsystemunitdir=%{_unitdir} \
--with-systemduserunitdir=%{_userunitdir}
@ -322,6 +323,10 @@ install emulator/btvirt ${RPM_BUILD_ROOT}/%{_libexecdir}/bluetooth/
%{_userunitdir}/obex.service
%changelog
* Fri Sep 29 2023 Peter Robinson <pbrobinson@fedoraproject.org> - 5.70-1
- Update to 5.70
- Enable some Bluetooth LE features
* Fri Aug 25 2023 Peter Robinson <pbrobinson@fedoraproject.org> - 5.69-1
- Update to 5.69

View File

@ -0,0 +1,107 @@
From 2d2389d967025a5629f00f125abffa9d2c1b4771 Mon Sep 17 00:00:00 2001
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date: Mon, 11 Sep 2023 15:30:01 -0700
Subject: [PATCH] device: Fix not handling initiator properly
Previously initiator would be set whenever a central key was found
which turns out to be unreliable besides the MGMT New Connection event
does in fact inform if the connection was initiated locally or not.
Fixes: https://github.com/bluez/bluez/issues/598
---
src/adapter.c | 10 ++++++----
src/device.c | 15 +++++----------
src/device.h | 3 ++-
3 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/src/adapter.c b/src/adapter.c
index 5ebfc4752a..8a7c53a9e3 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -5163,9 +5163,10 @@ static void adapter_remove_device(struct btd_adapter *adapter,
static void adapter_add_connection(struct btd_adapter *adapter,
struct btd_device *device,
- uint8_t bdaddr_type)
+ uint8_t bdaddr_type,
+ uint32_t flags)
{
- device_add_connection(device, bdaddr_type);
+ device_add_connection(device, bdaddr_type, flags);
if (g_slist_find(adapter->connections, device)) {
btd_error(adapter->dev_id,
@@ -5218,7 +5219,7 @@ static void get_connections_complete(uint8_t status, uint16_t length,
device = btd_adapter_get_device(adapter, &addr->bdaddr,
addr->type);
if (device)
- adapter_add_connection(adapter, device, addr->type);
+ adapter_add_connection(adapter, device, addr->type, 0);
}
}
@@ -9426,7 +9427,8 @@ static void connected_callback(uint16_t index, uint16_t length,
if (eir_data.class != 0)
device_set_class(device, eir_data.class);
- adapter_add_connection(adapter, device, ev->addr.type);
+ adapter_add_connection(adapter, device, ev->addr.type,
+ le32_to_cpu(ev->flags));
name_known = device_name_known(device);
diff --git a/src/device.c b/src/device.c
index 9b58e0c4e6..35ce1df0fe 100644
--- a/src/device.c
+++ b/src/device.c
@@ -312,16 +312,9 @@ static struct bearer_state *get_state(struct btd_device *dev,
bool btd_device_is_initiator(struct btd_device *dev)
{
- if (dev->le_state.connected) {
- /* Mark as initiator if not set yet and auto-connect flag is
- * set and LTK key is for a peripheral.
- */
- if (!dev->le_state.initiator && dev->auto_connect &&
- dev->ltk && !dev->ltk->central)
- dev->le_state.initiator = true;
-
+ if (dev->le_state.connected)
return dev->le_state.initiator;
- } else if (dev->bredr_state.connected)
+ else if (dev->bredr_state.connected)
return dev->bredr_state.initiator;
return dev->att_io ? true : false;
@@ -3226,7 +3219,8 @@ static void clear_temporary_timer(struct btd_device *dev)
}
}
-void device_add_connection(struct btd_device *dev, uint8_t bdaddr_type)
+void device_add_connection(struct btd_device *dev, uint8_t bdaddr_type,
+ uint32_t flags)
{
struct bearer_state *state = get_state(dev, bdaddr_type);
@@ -3249,6 +3243,7 @@ void device_add_connection(struct btd_device *dev, uint8_t bdaddr_type)
device_set_le_support(dev, bdaddr_type);
state->connected = true;
+ state->initiator = flags & BIT(3);
if (dev->le_state.connected && dev->bredr_state.connected)
return;
diff --git a/src/device.h b/src/device.h
index 3252e14eff..0a9e51533c 100644
--- a/src/device.h
+++ b/src/device.h
@@ -124,7 +124,8 @@ int device_notify_pincode(struct btd_device *device, gboolean secure,
const char *pincode);
void device_cancel_authentication(struct btd_device *device, gboolean aborted);
gboolean device_is_authenticating(struct btd_device *device);
-void device_add_connection(struct btd_device *dev, uint8_t bdaddr_type);
+void device_add_connection(struct btd_device *dev, uint8_t bdaddr_type,
+ uint32_t flags);
void device_remove_connection(struct btd_device *device, uint8_t bdaddr_type,
bool *remove);
void device_request_disconnect(struct btd_device *device, DBusMessage *msg);

View File

@ -1 +1 @@
SHA512 (bluez-5.69.tar.xz) = 4d5618cd083fe375c41faff868b5d9f072aeaccdffed758f6b69fd0cb46b058431cbf63182bd4a3f4f4e7a24b092729a4125687af730cd4250b273d66107bf42
SHA512 (bluez-5.70.tar.xz) = 3a5f8caf7730dcdbbe0bb92154b41651a9d6619038447bf4c25e5e3e5316effcd7242a7a0456d731ce21d55b8daea5212a359acc5e5fc460499b9356b7d364cf