Skip to content

monitor: Decode Periodic Advertising with Responses

Roland Schober linux-bluetooth 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest10 patches 2 repliesIn review
  2. v39 patches 2 repliesSuperseded
  3. v26 patches 1 replySuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v14 patches1 replySuperseded

Changes in v4 from the cover letter

- Add patch 7, and convert the Sync_Handle and the properties in the new decoders as well. Copilot found two of these places, the test described above two more.
- The fix of the LE Extended Create Connection PHY decoding no longer adds a size to a void pointer, which CodeQL reported.

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10monitor: Fix handle decoding of status_handle_rspmonitor/packet.c+1 -11 reply
2/10monitor: Fix data length of LE PA Report decodingmonitor/packet.c+7 -00 replies
3/10monitor: Fix PHY decoding of LE Ext Create Connectionmonitor/packet.c+23 -30 replies
4/10monitor: Fix advertising handle of LE PA commandsmonitor/packet.c+3 -30 replies
5/10monitor: Fix TX power and CTE Type of LE PA Reportmonitor/packet.c+6 -30 replies
6/10monitor: Fix LE PAST Received decodingmonitor/packet.c+8 -100 replies
7/10monitor: Fix byte order of LE PA Sync Handle and Propertiesmonitor/packet.c+3 -30 replies
8/10monitor: Split LE PA Report decoding into helpersmonitor/packet.c+62 -380 replies
9/10monitor: Add PAwR HCI commands decodingmonitor/bt.h monitor/packet.c+326 -50 replies
10/10monitor: Add PAwR HCI events decodingmonitor/analyze.c monitor/bt.h monitor/packet.c+286 -20 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

Cover letter [PATCH BlueZ v4 00/10] monitor: Decode Periodic Advertising with Responses

This series teaches btmon the HCI commands and events of Periodic Advertising with Responses (PAwR, Bluetooth 5.4). Until now they were only listed by name in the opcode table and the events were printed as unknown.

It is meant as the first step towards supporting the PAwR advertiser role in the kernel and in BlueZ, which is what an access point of the Electronic Shelf Label profile needs: being able to read the traces comes before changing anything else.

Patches 1 to 7 fix existing decoders which the new ones use or which were found on the way:
- the Connection_Handle returned by the Periodic Advertising Sync Transfer commands and by LE Remove ISO Data Path was read as one octet,
- LE Periodic Advertising Report trusted Data_Length and LE Extended Create Connection trusted the number of PHY parameter blocks, so truncated packets made them decode octets outside the packet,
- the LE Set Periodic Advertising commands printed the advertising handle as a connection handle,
- LE Periodic Advertising Report printed an unavailable TX power as 127 dBm and named the AoD CTE type with 1 us slots AoA,
- LE PAST Received printed the handle twice and decoded the clock accuracy as a BR/EDR one,
- the Sync_Handle of two events and the properties of LE Set Periodic Advertising Parameters were printed without byte order conversion.

Patch 8 splits the LE Periodic Advertising Report decoding into helpers without changing its output, so that patch 10 can share it.

Patch 9 decodes the five commands and patch 10 the six events, including the [v2] variants of existing events.

Testing: I have no controller with PAwR support at hand yet. The commands were sent with hcitool to a controller which rejects them, so that btmon decodes what the host sent, and the events and the successful command responses were decoded from hand-made btsnoop traces. Every command and event of these traces was also fed to the decoders cut to every length, in a buffer of exactly that size, with AddressSanitizer, which found no read beyond a packet. The output for well formed packets of the existing decoders was compared with the current tree. I have no big-endian host either: the byte order was checked with a btmon whose little-endian conversions swap, on traces with the fields of more than one octet reversed, which has to print the same as the normal btmon on the normal traces.

v4:
- Add patch 7, and convert the Sync_Handle and the properties in the new decoders as well. Copilot found two of these places, the test described above two more.
- The fix of the LE Extended Create Connection PHY decoding no longer adds a size to a void pointer, which CodeQL reported.

v3:
- Add the fixes of the advertising handle, of the TX power and CTE type and of LE PAST Received, and print these fields the same way in the new decoders.
- LE Periodic Advertising Report fix: also report octets beyond Data_Length.
- LE Extended Create Connection fix: report extra PHY parameter blocks, and do not report the remaining PHYs as unknown after a truncated block.
- Commands: reuse the [v1] decoder for LE Set Periodic Advertising Parameters [v2], print 0x00 subevent timings as none, check Response_Data_Length, and match LE Extended Create Connection [v2] with the events which complete it.
- Events: Data_Status 0xff keeps its reserved meaning in the [v1] LE Periodic Advertising Report, LE Enhanced Connection Complete [v2] is matched with the command which started the connection.
- Commands and events: report a subevent data command or a response report with fewer entries than announced.

v2:
- Add the fixes of the LE Periodic Advertising Report Data_Length and of the LE Extended Create Connection PHY blocks. The two problems Copilot found in v1 were in the [v2] decoders, but they came from the [v1] decoders they reuse, so they are fixed there.
- The patch which splits the LE Periodic Advertising Report decoding keeps the new Data_Length check in the shared helper.

Roland Schober (10):
monitor: Fix handle decoding of status_handle_rsp
monitor: Fix data length of LE PA Report decoding
monitor: Fix PHY decoding of LE Ext Create Connection
monitor: Fix advertising handle of LE PA commands
monitor: Fix TX power and CTE Type of LE PA Report
monitor: Fix LE PAST Received decoding
monitor: Fix byte order of LE PA Sync Handle and Properties
monitor: Split LE PA Report decoding into helpers
monitor: Add PAwR HCI commands decoding
monitor: Add PAwR HCI events decoding

 monitor/analyze.c |   1 +
 monitor/bt.h      | 174 ++++++++++++++
 monitor/packet.c  | 590 +++++++++++++++++++++++++++++++++++++++++-----
 3 files changed, 711 insertions(+), 54 deletions(-)
Signature · 1 line
2.47.3