CoAP dissector confuses Content-Format with Accept
Summary
In a CoAP request which specifies both Accept
and Content-Format
options, Wireshark confuses the two options.
Steps to reproduce
Send a CoAP packet with Accept
and Content-Format
options; set to different values.
What is the current bug behavior?
WireShark tries to dissect the packet as if Content-Format
= Accept
. It then complains when it can't understand the payload.
What is the expected correct behavior?
It should ignore Accept
and use Content-Format
to decode the payload.
Sample capture file
Relevant logs and/or screenshots
Frame 1: 93 bytes on wire (744 bits), 93 bytes captured (744 bits)
Raw packet data
Internet Protocol Version 6, Src: fd33:5db7:a637:12:f44c:5240:ee08:4204, Dst: fd9e:e308:e14c:b877::fd
User Datagram Protocol, Src Port: 5683, Dst Port: 61616
Constrained Application Protocol, Confirmable, POST, MID:46922
01.. .... = Version: 1
..00 .... = Type: Confirmable (0)
.... 1000 = Token Length: 8
Code: POST (2)
Message ID: 46922
Token: 5f962159705078ed
Opt Name: #1: If-Match: 3b 50 63 53 71 27 24 6c
Opt Name: #2: Uri-Path: c
Opt Name: #3: Content-Format: text/plain; charset=utf-8
Opt Name: #4: Uri-Query: t=cku24xdK
Opt Name: #5: Accept: application/cbor
End of options marker: 255
Payload: Payload Content-Format: application/cbor, Length: 7
Concise Binary Object Representation
[Malformed Packet: CBOR]
[Expert Info (Error/Malformed): Malformed Packet (Exception occurred)]
Note that:
-
Content-Format
istext/plain
-
Accept
isapplication/cbor
WireShark should not be trying to parse the payload as CBOR because it is plain text!
This has been reported on the mailing list, but to date, no fixes have been forthcoming.
Build information
3.4.7 (Git commit e42cbf6a415f)
Compiled (64-bit) with Qt 5.15.2, with libpcap, with POSIX capabilities (Linux),
with libnl 3, with GLib 2.68.3, with zlib 1.2.11, without SMI, with c-ares
1.17.1, with Lua 5.1.5, with GnuTLS 3.7.2, with Gcrypt 1.8.7, without Kerberos,
without MaxMind DB resolver, without nghttp2, without brotli, without LZ4, with
Zstandard, without Snappy, without libxml2, with QtMultimedia, without automatic
updates, with SpeexDSP (using system library), with Minizip.
Running on Linux 5.13.11-rikishi, with Intel(R) Core(TM) i5-3320M CPU @ 2.60GHz
(with SSE4.2), with 7822 MB of physical memory, with locale en_AU.UTF-8, with
light display mode, without HiDPI, with libpcap version 1.10.1 (with
TPACKET_V3), with GnuTLS 3.7.2, with Gcrypt 1.8.7, with zlib 1.2.11, binary
plugins supported (19 loaded).
Built using gcc 10.3.0.