Skip to content

monitor: Add an OBEX protocol decoder to btmon

Frédéric Danis linux-bluetooth 2 versions In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest4 patches 1 replyIn review
  2. v14 patches 2 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4monitor: Strip trailing L2CAP FCS before upper layer dissectorsmonitor/l2cap.c+51 -01 reply
2/4monitor: Add OBEX protocol decoderMakefile.tools monitor/l2cap.c monitor/obex.c +4 more+1214 -80 replies
3/4monitor: Decode PBAP/MAP/BIP Application Parameters tagsmonitor/obex.c+310 -130 replies
4/4monitor: Reassemble L2CAP ERTM/Streaming fragments before dissectingmonitor/l2cap.c monitor/obex.c monitor/obex.h +1 more+216 -270 replies

Reviews trailers per patch

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

Read the v2 thread

Cover letter [PATCH BlueZ v2 0/4] monitor: Add an OBEX protocol decoder to btmon

btmon currently hexdumps all OBEX traffic (RFCOMM and L2CAP GOEP), making PBAP/MAP/BIP/OPP sessions hard to follow in a trace. This series adds a dedicated OBEX dissector (monitor/obex.c) and wires it into the RFCOMM, L2CAP and SDP monitors.

Patch 1 adds the core decoder: opcodes, response codes, CONNECT/SETPATH fixed fields, all generic header IDs, BIP's IMG-Handle/IMG-Descriptor extension headers, and Target/Who UUID recognition for the well known OBEX profiles.
It tracks sessions on both RFCOMM (learned from SDP ProtocolDescriptorList) and L2CAP (fixed PSM 0x1001 or a dynamically negotiated one learned from the GoepL2capPsm SDP attribute), keyed direction-independently so CONNECT requests and responses are correctly matched to the same session.

Patch 2 adds per-profile Application Parameters (Tag/Len/Value) decoding for PBAP, MAP and BIP, replacing the generic 'Tag 0xNN len N' hexdump with named, typed values, using the profile learned from each session's Target/Who header.

Patch 3 adds SDU reassembly for L2CAP ERTM/Streaming mode, since OBEX PDUs routinely span multiple SAR fragments; without it, any segmented PDU failed to parse ('frame too short'). Reassembled PDUs are decoded once, on the End fragment, while raw per-fragment hexdumps are kept for Start/Continuation fragments so no bytes are lost from the trace.

Sample decode, a PBAP CONNECT followed by a GET with Application Parameters:

OBEX: Connect (0x00) final 1 len 35
Version: 1.0
Flags: 0x00
Max Packet Length: 8087
Target: Phonebook Access (PBAP)
Application Parameters: [len 6]

     Supported Features: 1023 (0x000003ff)

...
OBEX: Get (0x03) final 1 len 87
Connection ID: 1 (0x00000001)
Single Response Mode: 1 (0x01)
Name: telecom/fav.vcf
Type: x-bt/phonebook
Application Parameters: [len 21]

     Format: 1 (0x01)
     Max List Count: 65535 (0xffff)
     Filter: 0x0000000018b111af
     List Start Offset: 0 (0x0000)

v1->v2: Fix commit title issue

Frédéric Danis (4):
monitor: Strip trailing L2CAP FCS before upper layer dissectors
monitor: Add OBEX protocol decoder
monitor: Decode PBAP/MAP/BIP Application Parameters tags
monitor: Reassemble L2CAP ERTM/Streaming fragments before dissecting

 Makefile.tools   |    1 +
 monitor/l2cap.c  |  246 +++++++-
 monitor/obex.c   | 1390 ++++++++++++++++++++++++++++++++++++++++++++++
 monitor/obex.h   |  119 ++++
 monitor/packet.c |    5 +-
 monitor/rfcomm.c |   20 +-
 monitor/sdp.c    |   12 +-
 7 files changed, 1768 insertions(+), 25 deletions(-)
 create mode 100644 monitor/obex.c
 create mode 100644 monitor/obex.h
Signature · 1 line
2.43.0