Commit Graph

114 Commits

Author SHA1 Message Date
Stig Bjørlykke db966fdd2f coap: Do retransmission detection only for CON and NON
Only do retransmission detection for CON and NON type messages.

Change-Id: I5b5d93800918a98d4d321d1dcd0f3090b485ba9e
Reviewed-on: https://code.wireshark.org/review/37842
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-07-13 05:14:18 +00:00
Stig Bjørlykke f0f2480f3c coap: Add Hop-Limit Option
Add Hop-Limit Option from RFC 8768.

Change-Id: I029cd1528f6cfdb87e8c259d2169633a72f1f418
Reviewed-on: https://code.wireshark.org/review/37640
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2020-07-01 18:40:02 +00:00
Stig Bjørlykke 4af7888cae coap: Fix "End of Block #" indication
The M bit is used in Block1 Option in a request and in Block2 Option
in a response. Use this to determine when to prefix the block number
information with "End of".

Change-Id: I11c741b15f97f68d668d6cbec97660a6ea392dc1
Reviewed-on: https://code.wireshark.org/review/37629
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-07-01 08:17:54 +00:00
Stig Bjørlykke 40f3c393c3 coap: Move dissection of payload before state tracking
Change-Id: Icd8bce0a12167cc3edb3cb70fad5dd696af0b796
Reviewed-on: https://code.wireshark.org/review/37623
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2020-06-30 21:09:38 +00:00
Stig Bjørlykke 90d63ba075 coap: Add items for block payload and block length
Add items for block_payload and block_length to be used for block
analysis when reassembly is not complete.

Change-Id: I969cac9a50903431c727a2fc424eca464f0167d7
Reviewed-on: https://code.wireshark.org/review/37622
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2020-06-30 21:09:21 +00:00
Stig Bjørlykke 2dcf32bc9c coap: Mark private and vendor-specific options as unknown
Any private or vendor-specific options are not invalid, so mark them
as unknown. Move expert info to option entry. Add the unknown option
number to the item.

Change-Id: I567c397787d4afddffdca407a8c2e39db828ab83
Reviewed-on: https://code.wireshark.org/review/37562
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-06-27 13:48:16 +00:00
Stig Bjørlykke d3845de256 coap: Add block reassembly
Reassemble blocks before passing to payload dissector.

Change-Id: I09d81abe016989c8d705355a117cf12e40f07e59
Reviewed-on: https://code.wireshark.org/review/37440
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2020-06-11 06:37:41 +00:00
Stig Bjørlykke 86c6befcab coap: Fix "More Flag" value
Use the raw value for the block "More Flag", not the already adjusted one.

Change-Id: I13ddd24c4f9b9201798d18abe008945879f03774
Reviewed-on: https://code.wireshark.org/review/37442
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2020-06-11 06:36:55 +00:00
Mališa Vučinić 5aaec7f16d oscore: Update to RFC8613.
-Update dissection of the OSCORE option.
-Enable zero-length Sender and Recipient ID.
-Add ID Context field in preferences.
-Update context derivation to rfc8613.
-Extend context lookup to include ID context.
-Fix Observe responses.

Bug: 16585
Change-Id: Ib9823a54cf535be3559e1c41a19b8b612458777f
Reviewed-on: https://code.wireshark.org/review/37314
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-05-27 06:59:47 +00:00
Pascal Quantin 75e1b69e88 CoAP: change detection logic for CoAP over TCP or TLS
Do not assume that having a TCP port means that CoAP is running directly
over TCP: this is not the case with MQTT for example (see bug 14591 for
a capture). Instead explicitly check that the parent dissector is TCP or
TLS.

Bug: 15910
Change-Id: Ib4880623b8525fe6be52a685397005eac86da135
Reviewed-on: https://code.wireshark.org/review/35879
Petri-Dish: Pascal Quantin <pascal@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2020-01-21 22:09:51 +00:00
Cenk Gündoğan 5199a61e79 coap: use correct OSCORE option type
The current implementation assumes a wrong OSCORE option type
"21". RFC 8613 was release in July 2019 and defines an OSCORE option
type of "9". See: https://tools.ietf.org/html/rfc8613#section-2

Change-Id: I5fea8dffc2d1586f891b2b3b9fa42183b138e0ab
Reviewed-on: https://code.wireshark.org/review/35163
Reviewed-by: Pascal Quantin <pascal@wireshark.org>
Petri-Dish: Pascal Quantin <pascal@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-11-21 11:31:34 +00:00
Pascal Quantin f75f128462 CoAP: add a separator between messages in info column
Ping-Bug: 15910
Change-Id: I9845ded5986565328c5228b8a6e6f9aed0a98166
Reviewed-on: https://code.wireshark.org/review/35011
Reviewed-by: Pascal Quantin <pascal@wireshark.org>
Petri-Dish: Pascal Quantin <pascal@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-11-07 12:13:25 +00:00
Pascal Quantin 5db18c604e CoAP: fixes for TCP transport
- switch from tcp_dissect_pdus() to pinfo based reassembly as the header
size is variable
- use the proper message length when dissecting the payload
- reuse the conversation from the TCP disector instead of creating a new
one and breaking the TCP analysis

Ping-Bug: 15910
Change-Id: Ie2689363a01343bbb45cba6a48ce3475521954ec
Reviewed-on: https://code.wireshark.org/review/34987
Petri-Dish: Pascal Quantin <pascal@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-11-05 17:09:40 +00:00
Stig Bjørlykke a7838d9403 coap: Distinguish observe option for request and response
The observe option has different values for request and response. For
request it identifies register or deregister, and for response it is a
sequence number for reordering detection. RFC 7641 chapter 2.

Change-Id: I09515864997a32f7259e344532ea770b74030b04
Reviewed-on: https://code.wireshark.org/review/34368
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2019-08-26 17:26:15 +00:00
Stig Bjørlykke d966c0dd5e coap: Improve request/response tracking
Use both Token and Message ID in request/response tracking and retransmission
detection. The token is the same when using observables but the message id is
increasing.

Change-Id: I545416ce139328e6a8eb67258d7b51bddb6b278e
Reviewed-on: https://code.wireshark.org/review/34367
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2019-08-26 17:24:36 +00:00
Peter Wu 1da2caa0e0 CoAP: add frame support for CoAP over TCP, TLS, WebSockets (RFC 8323)
Support is limited to message framing.

Bug: 15910
Change-Id: Ia27c0b8428842618af00720441a9ef9cf163fecb
Reviewed-on: https://code.wireshark.org/review/34001
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-07-19 06:12:09 +00:00
Peter Wu 8499ad93c5 CoAP: add CoAP Signalling Codes (RFC 8323)
Update names and RFC references based on the IANA registry at
https://www.iana.org/assignments/core-parameters/core-parameters.xhtml

Bug: 15910
Change-Id: I56a4cc3c23fee321b09547254a33f6a76d46cc9d
Reviewed-on: https://code.wireshark.org/review/34002
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2019-07-18 07:34:04 +00:00
Gerald Combs 8d3ac3af86 epan: Convert our PROTO_ITEM_ macros to inline functions.
Convert our various PROTO_ITEM_ macros to inline functions and document
them.

Change-Id: I070b15d4f70d2189217a177ee8ba2740be36327c
Reviewed-on: https://code.wireshark.org/review/32706
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-04-04 04:03:38 +00:00
Stig Bjørlykke d916e0741a coap: Add retransmission detection
Show as expert info and in info column. Link to first request/response.

Change-Id: I990d9a5aec5904dabe22bcb103426a8549cef31b
Reviewed-on: https://code.wireshark.org/review/32615
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-03-29 04:42:38 +00:00
Uli Heilmeier 7ef8ddcad4 CoAP: Add RFC8516 response code
RFC8516 adds new response code 4.29

Change-Id: I4a1d57a0632939d0b59a7f625720d07be3cdb866
Reviewed-on: https://code.wireshark.org/review/31719
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2019-01-24 22:14:27 +00:00
Stig Bjørlykke 01c8397fd1 coap: Add request/response arrows
Change-Id: I72393548f5a51e60f516c0999c8a779e75d0c14a
Reviewed-on: https://code.wireshark.org/review/31093
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2018-12-18 13:15:13 +00:00
Peter Wu 5a2aafef7a coap: ensure that piv_len matches piv
In frame 121, piv_len was 1 while piv was NULL. Ensure that both piv and
piv_len are reset to avoid this. Adjust another check to ensure that piv
and piv_len are in sync (probably not necessary, but it seems the
intention).

Bug: 15172
Change-Id: If8636d32f3273d6707749c807bd7d676ca9ab96d
Fixes: v2.5.2rc0-9-g830ea5731a ("CoAP: Hooks to OSCORE")
Reviewed-on: https://code.wireshark.org/review/30100
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-10-10 04:57:38 +00:00
Guy Harris aa6d5ee1a7 Use the time stamps in the packet_info structure, not the frame_data structure.
In the long run, we'd like to remove the time stamp from the frame_data
structure, as, in Wireshark, and in TShark in two-pass mode, there's one
allocated for every frame in the file, and shrinking the size of that
structure reduces the memory usage.

This removes one obstacle to that.

Change-Id: Ia8f87522cd974555c57e0ac1e742b097e8b0f2fc
Reviewed-on: https://code.wireshark.org/review/29881
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-09-26 20:34:21 +00:00
Stig Bjørlykke abc1f64576 coap: Use proto_tree_add_item for strings in the packet
Change from proto_tree_add_string() to proto_tree_add_item() for strings
which is fetched from the packet.

Change-Id: Iae6538977b2ecf69f83c62b47ac02198f5f09d54
Reviewed-on: https://code.wireshark.org/review/29348
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-08-30 12:07:59 +00:00
Jaap Keuter b9c18a4188 CoAP: handle per packet data properly
Bug: 14966
Change-Id: I9c5c1da923a0cc2881465bcc484850d042a314d6
Signed-off-by: Jaap Keuter <jaap.keuter@xs4all.nl>
Reviewed-on: https://code.wireshark.org/review/28694
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2018-07-13 08:50:27 +00:00
Stig Bjørlykke 1bdc98936f coap: Revert "Store ctype values in transaction tracking"
This change was based on a incomplete/incorrect implementation of
LwM2M and is not correct because the payload encoding is mandatory
in the response.

This reverts commit 46fcf452ac.
This reverts commit b1e0cb01b3.

Change-Id: I89ae1f84e2735ad049a0f7c9045175940bed25cb
Reviewed-on: https://code.wireshark.org/review/27770
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2018-05-24 10:38:11 +00:00
Stig Bjørlykke 171d92cc14 lwm2mtlv: Add Resource name tables
Add one fixed table for OMA (Normative) defined resource names and
one table for user defined resource names. All resources are identified
by a object ID and a resource ID.

Show number of elements in arrays instead of number of bytes.

Next iteration will add proper hf entries for OMA elements.

Change-Id: I4d6c053a7c448cc65692ba1d1e92a2033ff3b397
Reviewed-on: https://code.wireshark.org/review/27551
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-15 10:30:18 +00:00
Peter Wu b1e0cb01b3 coap: fix use-after-free of "coinfo->ctype_str"
A use-after-free is possible through the following path:

    // returns wmem_packet_scope() memory
    coinfo->ctype_str = val_to_str(coinfo->ctype_value, vals_ctype, "Unknown Type %u");
    // leaks packet scoped memory into conversation
    coap_trans = wmem_new0(wmem_file_scope(), coap_transaction);
    coap_trans->req_ctype_str = coinfo->ctype_str;  // <-- oops
    // next packet: use-after-free of packet scoped memory
    coinfo->ctype_str = coap_trans->req_ctype_str;

This could be fixed by duplicating "ctype_str" with wmem_file_scope, but
since all "ctype_str" strings are constant, make the problematic
"ctype_str" assignment also constant for unknown types (the numeric type
is also stored in "ctype_value" if necessary).

Change-Id: I6249e076fa282bbe0982b8c709788e27f6fdf86e
Fixes: v2.9.0rc0-317-g46fcf452ac ("coap: Store ctype values in transaction tracking")
Link: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8196
Reviewed-on: https://code.wireshark.org/review/27477
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-13 12:02:37 +00:00
Stig Bjørlykke 46fcf452ac coap: Store ctype values in transaction tracking
Transfer ctype values from GET request to response to be able
to decode the payload correctly.

Change-Id: Ida7598aefbd3f245dd487d50562539395f130ac4
Reviewed-on: https://code.wireshark.org/review/27163
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2018-04-26 15:03:29 +00:00
Mališa Vučinić 093efd9c30 OSCORE: Decrypt responses and dissect plaintext with CoAP functions
Add support for decrypting Observe responses with Partial IV within the
response. CoAP prioritizes the Partial IV from the response if present,
if not it passes Partial IV from the corresponding request.

Bug: 14417
Change-Id: Icb0f782de67bd0507db4f1f2a2ea90c72a4b6f0a
Reviewed-on: https://code.wireshark.org/review/25483
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-03-16 15:02:48 +00:00
Mališa Vučinić de9a4ff91f CoAP: Refactor code, option and payload dissection
OSCORE plaintext contains CoAP code, some CoAP options and CoAP payload.
To avoid code duplication, CoAP dissection of these fields used by
OSCORE is generalized and exported in packet-coap.h. Exported functions
and their subroutines now operate explicitly on local variables. This
allows OSCORE dissector to pass its header fields.

Use of "offset_end" instead of "coap_length" to denote the end of
message.

Bug: 14417
Change-Id: If51b0d585ab29d46c1c550fbf264fd3765ed4c32
Reviewed-on: https://code.wireshark.org/review/25482
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-03-16 15:02:36 +00:00
Mališa Vučinić 830ea5731a CoAP: Hooks to OSCORE
Structure oscore_info_t carries parameters needed by OSCORE for
decryption. These parameters are communicated in the CoAP layer within
the Object-Security option. To decrypt a response, OSCORE needs the
parameters from the corresponding request. Matching of responses to
requests on the CoAP layer is leveraged to pass the correct parameters
to OSCORE. This change adds an oscore_info_t pointer to coap_info and
coap_transaction structures in order to pass the parameters on to the
OSCORE dissector. Dissection of Object-Security option is reworked to
make  use of the new coap_info element, instead of relying on local
variables.

Bug: 14417
Change-Id: I173057ba95407675aaa539ddbff51d02337551bc
Reviewed-on: https://code.wireshark.org/review/25481
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-03-16 15:02:26 +00:00
Dario Lombardo fe219637a6 dissectors: use SPDX identifiers.
Change-Id: I92c94448e6641716d03158a5f332c8b53709423a
Reviewed-on: https://code.wireshark.org/review/25756
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-12 16:49:58 +00:00
Stig Bjørlykke d86f820206 coap: Change Uri-Path from hidden to generated
This field is generated so mark it so.  It may also be usable so
make it visible.

Change-Id: I10d951f234f1fba240059bc791b40d25dede07a9
Reviewed-on: https://code.wireshark.org/review/25350
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2018-01-17 14:10:44 +00:00
Niels Widger d122ba3a53 CoAP: Shift block mflag so it is 0/1 instead of 0/8
Shift the value stored in coinfo->block_mflag in
dissect_coap_opt_block so that we store 0/1 instead of 0/8.

Change-Id: I45ac08564ff1fdcaf4e7306692db862b6a70989b
Reviewed-on: https://code.wireshark.org/review/25248
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Niels Widger <niels@qacafe.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2018-01-10 21:24:56 +00:00
Alexis La Goutte 56cca5bd58 coap: Fix Dead Store (Dead assignement/Dead increment) Warning found by Clang
Change-Id: Ib23241887ef91ef44a31703445a0ce6d31104b8e
Reviewed-on: https://code.wireshark.org/review/24951
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-12-22 21:59:10 +00:00
Mališa Vučinić 40415fffa3 CoAP: Various improvements
1. Add Object-Security option handling to CoAP.
2. Add RFC8132 defined codes.
3. Fix indentation.
4. Use macros for masks.

Change-Id: I48c71513db14e79133fe323578123f99946cbaa9
Reviewed-on: https://code.wireshark.org/review/24913
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-12-22 14:17:53 +00:00
Michael Mann abfb644117 Add conversation endpoint type
For the moment this mirrors the port_type enumeration (PT_XXX), but the
intent is to move away from using "port types", eliminating most (if not
all)

Added conversation_pt_to_endpoint_type() so that conversations deal with the
correct enumeration.  This is for dissector that use pinfo->ptype as input
to conversation APIs.  Explicit use of port types are converted to using
ENDPOINT_XXX type.

Change-Id: Ia0bf553a3943b702c921f185407e03ce93ebf0ef
Reviewed-on: https://code.wireshark.org/review/24166
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-10-29 16:53:57 +00:00
Anton Butenko e60319e54b coap: Added dissection for LWM2M JSON inside CoAP protocol
Change-Id: I29429f731b7e2f25568d44de455816ac70e079b6
Reviewed-on: https://code.wireshark.org/review/23740
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-09-26 12:25:29 +00:00
Anton Butenko 5598faa342 CoAP: added new TLV code 11542 according to changes in LwM2M OMA Spec.
Bug: 13761
Change-Id: I3cd5bca6e6959aeb74bf3ae8141c3b2afa70e028
Reviewed-on: https://code.wireshark.org/review/21999
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-06-07 13:17:20 +00:00
Stig Bjørlykke e61189d838 coap: Add filterable payload length
Also fix payload desc abbrev.

Change-Id: I355658d7722383e5d1ef84efddf43e545bfda269
Reviewed-on: https://code.wireshark.org/review/20695
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-03-24 09:26:55 +00:00
Stig Bjørlykke 0b2eb9d242 coap: Put payload protocol in parent tree
Change-Id: I15cc9df174a42d284c55306cd43f9a86eebd93a2
Reviewed-on: https://code.wireshark.org/review/20694
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-03-24 09:26:44 +00:00
Robert Cragie f7b784c968 CoAP: Enhancements to improve conversation recording.
Conversation recording now uses a hash map instead of a tree. URI
reconstruction for responses has also been added to assist Thread CoAP
decoding.

Change-Id: I83dc0dc48534d5182cf37ba50dad67e1b095188a
Reviewed-on: https://code.wireshark.org/review/20553
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-03-16 13:21:31 +00:00
Peter Wu 4d506a0a0d coap: add support for coaps (DTLS-secured CoAP)
coaps port is defined in RFC 7252, section 12.7.

CoAP (RFC 7252) is defined only for UDP, not TCP. For TCP, the frame
format is slightly different (draft-ietf-core-coap-tcp-tls-05) and
needs more dissector changes, so remove registration for now.

Change-Id: I1fc7163086f8fe66986565aa24b579ef24f72550
Ping-Bug: 13370
Reviewed-on: https://code.wireshark.org/review/19870
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-01-31 00:12:12 +00:00
Michael Mann f4b0abc729 Dissectors don't need a journey of self discovery.
They already know who they are when they register themselves.  Saving the
handle then to avoid finding it later.
Not sure if this will increase unnecessary register_dissector functions
(instead of using create_dissector_handle in proto_reg_handoff function)
when other dissectors copy/paste, but it should make startup time
a few microseconds better.

Change-Id: I3839be791b32b84887ac51a6a65fb5733e9f1f43
Reviewed-on: https://code.wireshark.org/review/19481
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-12-31 07:31:42 +00:00
Michael Mann 2eb7b05b8c Convert most UDP dissectors to use "auto" preferences.
Similar to the "tcp.port" changes in I99604f95d426ad345f4b494598d94178b886eb67,
convert dissectors that use "udp.port".

More cleanup done on dissectors that use both TCP and UDP dissector
tables, so that less preference callbacks exist.

Change-Id: If07be9b9e850c244336a7069599cd554ce312dd3
Reviewed-on: https://code.wireshark.org/review/18120
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-10-13 02:51:18 +00:00
Michael Mann 268841f3e0 Combine Decode As and port preferences for tcp.port dissector table.
This patch introduces new APIs to allow dissectors to have a preference for
a (TCP) port, but the underlying data is actually part of Decode As functionality.
For now the APIs are intentionally separate from the regular APIs that register a
dissector within a dissector table.  It may be possible to eventually combine the
two so that all dissectors that register with a dissector table have an opportunity
to "automatically" have a preference to adjust the "table value" through the
preferences dialog.

The tcp.port dissector table was used as the guinea pig.  This will eventually be
expanded to other dissector tables as well (most notably UDP ports).  Some
dissectors that "shared" a TCP/UDP port preference were also converted. It also
removed the need for some preference callback functions (mostly when the callback
function was the proto_reg_handoff function) so there is cleanup around that.

Dissectors that has a port preference whose default was 0 were switched to using
the dissector_add_for_decode_as_with_preference API rather than dissector_add_uint_with_preference

Also added comments for TCP ports used that aren't IANA registered.

Change-Id: I99604f95d426ad345f4b494598d94178b886eb67
Reviewed-on: https://code.wireshark.org/review/17724
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-10-08 02:44:53 +00:00
Pascal Quantin 0a9e842649 COAP: ensure that key_token is always initialized
Even when the token length is 0.

Bug: 12771
Change-Id: I0d77f0411fe90a6702d1f23ba9cd4b61433a5995
Reviewed-on: https://code.wireshark.org/review/17194
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-08-20 22:24:14 +00:00
Michael Mann 2ab4155794 tvb_get_string_enc + proto_tree_add_item = proto_tree_add_item_ret_string
Also some other tricks to remove unnecessary tvb_get_string_enc calls.

Change-Id: I2f40d9175b6c0bb0b1364b4089bfaa287edf0914
Reviewed-on: https://code.wireshark.org/review/16158
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2016-06-27 15:20:06 +00:00
Christoph Burger-Scheidlin 53252df920 Support dissecting the TLV data format specified for Lwm2m
Lightweight M2M is a protocol on top of CoAP that is used for
device management. The specification contains a custom payload
format - a simple type, length, value binary encoding.

This patch adds support for dissecting this payload format.
While not yet officially registered, the main open source
implementation of the lwm2m protocol - eclipse's leshan - uses this
content type 1542 for its messages.

Bug: 12110
Change-Id: Ib022d1f485c706f1d69ceec7200790448d080965
Reviewed-on: https://code.wireshark.org/review/13835
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2016-02-29 21:07:09 +00:00