* [PATCH BlueZ v2 0/1] Btmon: Fix handling not complete packets
@ 2023-03-11 23:36 Łukasz Rymanowski
2023-03-11 23:36 ` [PATCH BlueZ v2 1/1] btmon: Fix decoding truncated data Łukasz Rymanowski
2023-03-14 19:50 ` [PATCH BlueZ v2 0/1] " patchwork-bot+bluetooth
0 siblings, 2 replies; 4+ messages in thread
From: Łukasz Rymanowski @ 2023-03-11 23:36 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Łukasz Rymanowski
When for security reasons or any other, packets in the btsnoop logs are
not complete, then Included length is smaller then Original size.
For the moment, Bluez always assumes to get complete packets.
If it not happen, then it stops decoding after fist packet which
Original size is bigger then Included lenght. e.g.
In the file where we had some ISO packets but with payload = 0,
btmon ended like that:
./btmon -r btsnoop.log
Bluetooth monitor ver 5.66
After the fix logs looks like that (from the same btsnoop log)
> HCI Event: Number of Completed Packets (0x13) plen 5 #1 0.926288
Num handles: 1
Handle: 96
Count: 2
> HCI Event: Number of Completed Packets (0x13) plen 5 #2 0.932776
Num handles: 1
Handle: 97
Count: 2
> HCI Event: Number of Completed Packets (0x13) plen 5 #3 0.945915
Num handles: 1
Handle: 96
Count: 2
And here is an example how truncated ACL packet will look after fix.
> ACL Data RX: Handle 64 flags 0x02 dlen 51 #138 7.118921
invalid packet size (10 != 51)
2f 00 04 00 1b 05 11 01 01 00 /.........
Łukasz Rymanowski (1):
btmon: Fix decoding truncated data
src/shared/btsnoop.c | 2 +-
tools/btsnoop.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH BlueZ v2 1/1] btmon: Fix decoding truncated data
2023-03-11 23:36 [PATCH BlueZ v2 0/1] Btmon: Fix handling not complete packets Łukasz Rymanowski
@ 2023-03-11 23:36 ` Łukasz Rymanowski
2023-03-12 2:15 ` Btmon: Fix handling not complete packets bluez.test.bot
2023-03-14 19:50 ` [PATCH BlueZ v2 0/1] " patchwork-bot+bluetooth
1 sibling, 1 reply; 4+ messages in thread
From: Łukasz Rymanowski @ 2023-03-11 23:36 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Łukasz Rymanowski
Some platforms use different filtering and for this purpose,
some of the ACL/SCO/ISO/SDP data is truncated.
In such a case, included length is smaller than the original size.
Without this fix, btmon stops working after first truncated packet.
---
src/shared/btsnoop.c | 2 +-
tools/btsnoop.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/shared/btsnoop.c b/src/shared/btsnoop.c
index 0a68282bc..8b93203b3 100644
--- a/src/shared/btsnoop.c
+++ b/src/shared/btsnoop.c
@@ -513,7 +513,7 @@ bool btsnoop_read_hci(struct btsnoop *btsnoop, struct timeval *tv,
return false;
}
- toread = be32toh(pkt.size);
+ toread = be32toh(pkt.len);
if (toread > BTSNOOP_MAX_PACKET_SIZE) {
btsnoop->aborted = true;
return false;
diff --git a/tools/btsnoop.c b/tools/btsnoop.c
index a0d6cf356..efaa45db4 100644
--- a/tools/btsnoop.c
+++ b/tools/btsnoop.c
@@ -283,7 +283,7 @@ next_packet:
if (len < 0 || len != BTSNOOP_PKT_SIZE)
goto close_input;
- toread = be32toh(pkt.size);
+ toread = be32toh(pkt.len);
flags = be32toh(pkt.flags);
opcode = flags & 0x00ff;
@@ -356,7 +356,7 @@ next_packet:
if (len < 0 || len != BTSNOOP_PKT_SIZE)
goto close_input;
- toread = be32toh(pkt.size);
+ toread = be32toh(pkt.len);
flags = be32toh(pkt.flags);
opcode = flags & 0x00ff;
@@ -433,7 +433,7 @@ next_packet:
if (len < 0 || len != BTSNOOP_PKT_SIZE)
goto close_input;
- toread = be32toh(pkt.size);
+ toread = be32toh(pkt.len);
len = read(fd, buf, toread);
if (len < 0 || len != (ssize_t) toread) {
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: Btmon: Fix handling not complete packets
2023-03-11 23:36 ` [PATCH BlueZ v2 1/1] btmon: Fix decoding truncated data Łukasz Rymanowski
@ 2023-03-12 2:15 ` bluez.test.bot
0 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2023-03-12 2:15 UTC (permalink / raw)
To: linux-bluetooth, lukasz.rymanowski
[-- 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=729126
---Test result---
Test Summary:
CheckPatch PASS 0.37 seconds
GitLint PASS 0.24 seconds
BuildEll PASS 27.08 seconds
BluezMake PASS 982.87 seconds
MakeCheck PASS 11.40 seconds
MakeDistcheck PASS 150.81 seconds
CheckValgrind PASS 247.53 seconds
CheckSmatch PASS 330.11 seconds
bluezmakeextell PASS 99.16 seconds
IncrementalBuild PASS 843.22 seconds
ScanBuild PASS 1040.12 seconds
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH BlueZ v2 0/1] Btmon: Fix handling not complete packets
2023-03-11 23:36 [PATCH BlueZ v2 0/1] Btmon: Fix handling not complete packets Łukasz Rymanowski
2023-03-11 23:36 ` [PATCH BlueZ v2 1/1] btmon: Fix decoding truncated data Łukasz Rymanowski
@ 2023-03-14 19:50 ` patchwork-bot+bluetooth
1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+bluetooth @ 2023-03-14 19:50 UTC (permalink / raw)
To: =?utf-8?q?=C5=81ukasz_Rymanowski_=3Clukasz=2Erymanowski=40codecoup=2Epl=3E?=
Cc: linux-bluetooth
Hello:
This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Sun, 12 Mar 2023 00:36:39 +0100 you wrote:
> When for security reasons or any other, packets in the btsnoop logs are
> not complete, then Included length is smaller then Original size.
>
> For the moment, Bluez always assumes to get complete packets.
> If it not happen, then it stops decoding after fist packet which
> Original size is bigger then Included lenght. e.g.
> In the file where we had some ISO packets but with payload = 0,
> btmon ended like that:
>
> [...]
Here is the summary with links:
- [BlueZ,v2,1/1] btmon: Fix decoding truncated data
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=6ae44c74aaf9
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-03-14 19:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-11 23:36 [PATCH BlueZ v2 0/1] Btmon: Fix handling not complete packets Łukasz Rymanowski
2023-03-11 23:36 ` [PATCH BlueZ v2 1/1] btmon: Fix decoding truncated data Łukasz Rymanowski
2023-03-12 2:15 ` Btmon: Fix handling not complete packets bluez.test.bot
2023-03-14 19:50 ` [PATCH BlueZ v2 0/1] " patchwork-bot+bluetooth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).