2024-01-30 10:26:12

by Archie Pusaka

[permalink] [raw]
Subject: [Bluez PATCH v2 2/2] Monitor: Avoid printing stale address on connection event

From: Archie Pusaka <[email protected]>

We now remove potentially stale handle when assigning a new handle.
However, that is done after printing the handle and the stale address
associated with it.

Directly use print_field instead of print_handle to avoid printing the
stale address. We still print the correct address on the following
line anyway.

---

(no changes since v1)

monitor/packet.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/monitor/packet.c b/monitor/packet.c
index 164cc82bb2..3c32735b73 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -10083,7 +10083,7 @@ static void conn_complete_evt(struct timeval *tv, uint16_t index,
const struct bt_hci_evt_conn_complete *evt = data;

print_status(evt->status);
- print_handle(evt->handle);
+ print_field("Handle: %d", le16_to_cpu(evt->handle));
print_bdaddr(evt->bdaddr);
print_link_type(evt->link_type);
print_enable("Encryption", evt->encr_mode);
@@ -10655,7 +10655,7 @@ static void sync_conn_complete_evt(struct timeval *tv, uint16_t index,
const struct bt_hci_evt_sync_conn_complete *evt = data;

print_status(evt->status);
- print_handle(evt->handle);
+ print_field("Handle: %d", le16_to_cpu(evt->handle));
print_bdaddr(evt->bdaddr);
print_link_type(evt->link_type);
print_field("Transmission interval: 0x%2.2x", evt->tx_interval);
@@ -11084,7 +11084,7 @@ static void le_conn_complete_evt(struct timeval *tv, uint16_t index,
const struct bt_hci_evt_le_conn_complete *evt = data;

print_status(evt->status);
- print_handle(evt->handle);
+ print_field("Handle: %d", le16_to_cpu(evt->handle));
print_role(evt->role);
print_peer_addr_type("Peer address type", evt->peer_addr_type);
print_addr("Peer address", evt->peer_addr, evt->peer_addr_type);
@@ -11213,7 +11213,7 @@ static void le_enhanced_conn_complete_evt(struct timeval *tv, uint16_t index,
const struct bt_hci_evt_le_enhanced_conn_complete *evt = data;

print_status(evt->status);
- print_handle(evt->handle);
+ print_field("Handle: %d", le16_to_cpu(evt->handle));
print_role(evt->role);
print_peer_addr_type("Peer address type", evt->peer_addr_type);
print_addr("Peer address", evt->peer_addr, evt->peer_addr_type);
--
2.43.0.429.g432eaa2c6b-goog