Commit Graph

68 Commits

Author SHA1 Message Date
Ali Sabil 3805cb6f2f mqtt: Dissect connect last will message as bytes
The MQTT specification says "The Will Message defines the Application
Message that is to be published to the Will Topic", Application
Messages are defined as being application specific.

Change-Id: I3fad1cb5f676b0232ba9e29af0d213b536ce4ef6
Reviewed-on: https://code.wireshark.org/review/34749
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2019-10-09 06:32:21 +00:00
Guy Harris 20800366dd HTTPS (almost) everywhere.
Change all wireshark.org URLs to use https.

Fix some broken links while we're at it.

Change-Id: I161bf8eeca43b8027605acea666032da86f5ea1c
Reviewed-on: https://code.wireshark.org/review/34089
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-07-26 18:44:40 +00:00
Stig Bjørlykke 707f46459f mqtt: Add a preference to show message as text
Make a configurable preference to show the publish message as text
to bring back the old behavior.

Ping-Bug: 15738
Change-Id: I90ff4ab4c8fe857fa7ea585f67aef516d84c22c1
Reviewed-on: https://code.wireshark.org/review/33284
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2019-05-21 07:28:16 +00:00
Stig Bjørlykke 7bc066aa0c mqtt: Dissect publish message as bytes
The MQTT documentation states "The Payload contains the Application
Message that is being published. The content and format of the data
is application specific."

Bug: 15738
Change-Id: Ie9d603049821fd7fe73add675a95245d5f27e0b0
Reviewed-on: https://code.wireshark.org/review/33020
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2019-05-02 06:40:35 +00:00
Stig Bjørlykke d8d1d6409e mqtt: Check for a valid payload protocol
Make the "Payload protocol" mandatory when configuring message decoding.

Change-Id: Ia3cd8cb1b789b80439f55bdd87e7f1bd806013e0
Ping-Bug: 15738
Reviewed-on: https://code.wireshark.org/review/33021
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2019-04-30 12:14:15 +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
Peter Wu 2e13c4adb2 mqtt: document UTF-8 requirement for topic_str
If someone changes this in the future and the data is no longer valid
UTF-8, then crashes can occur.

Change-Id: I2b153d48ee1ef7093a5141001a391dd440c30e58
Ping-Bug: 14905
Reviewed-on: https://code.wireshark.org/review/31942
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-02-08 18:19:16 +00:00
Roger Light 10bcb40c5e MQTT v5 malformed packet fixes.
PUBACK, PUBREC, PUBREL, and PUBCOMP can all have abbreviated packets
which are not currently handled, leading to those forms being marked as
malformed.

Bug: 15428
Change-Id: I1e6e5dbbca29e7e731683d5c166f9abf978f62b2
Reviewed-on: https://code.wireshark.org/review/31580
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-18 07:49:12 +00:00
Roger Light 63a1eb2eea MQTT v5 malformed packet fixes.
Neither of the following situations were reading MQTT v5 properties from
the packet, leading to valid MQTT 5 packets being marked as malformed.

CONNECT packet with a Will
UNSUBSCRIBE packet

Bug: 15257
Change-Id: Iedb68e7285832fc5692f793b4354a6402ca8ac8d
Reviewed-on: https://code.wireshark.org/review/30464
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-01 22:43:10 +00:00
Gerald Combs 50dbe4df7f Rename packet-ssl* to packet-tls*
Rename packet-ssl{,-utils}.[ch] to packet-tls{,-utils}.[ch].

Change-Id: I4732162ec131ddf0734b3dd191ccc9e48a76ce06
Reviewed-on: https://code.wireshark.org/review/29659
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-09-25 13:24:17 +00:00
Stig Bjørlykke d442414884 mqtt: Add option to uncompress message when decoding
Add support for uncompressing message data before dissecting
based on topic.

Bug: 14591
Change-Id: Ibaead205a4df791d8e903935dfd29b9b8c13ddc5
Reviewed-on: https://code.wireshark.org/review/26794
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Reviewed-by: Christopher Maynard <Christopher.Maynard@gtech.com>
Tested-by: Petri Dish Buildbot
2018-04-08 19:37:18 +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 3d574a4b2b mqtt: Put msgid and topic in Info column
Change-Id: If6e149f21a9c8bd122daa6d751f72b8d8c0454ff
Reviewed-on: https://code.wireshark.org/review/25578
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-03 22:01:42 +00:00
Alexis La Goutte 0bde3e96f0 Add ENC_VARINT_QUIC
Used to support variable length in QUIC protocol

Bug: 13881
Change-Id: Ia274b1530152376c5fb4e364fc4cf5ab246be1b3
Reviewed-on: https://code.wireshark.org/review/24990
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Craig Jackson <cejackson51@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-01-02 05:29:39 +00:00
Stig Bjørlykke 4a08c63e88 mqtt: Add sanity checks for MQTT v5.0 Reason Codes
Check if mqtt_msg_type is within boundaries of hf_rcode and gives
a valid hfindex.

Change-Id: Ib8ea710d7cd6c61ec493e218d64b50f6faa720c4
Reviewed-on: https://code.wireshark.org/review/24509
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-11-21 07:42:17 +00:00
Flavio Santes c26ad500ec dissector/mqtt: Add the MQTT v5.0 Reason Codes
RCs and their text descriptions are added by this
patch. We use defines for the values and descriptions
because they are shared by many Control Packets, so
in this patch we parameterize them to avoid writing
the descriptions multiple times.

Change-Id: I0afc2cbe69e8cfffa4f65df0b72f09045bb9b3a1
Signed-off-by: Flavio Santes <flavio.santes@1byt3.com>
Reviewed-on: https://code.wireshark.org/review/24263
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-11-20 13:48:23 +00:00
Michael Mann bb47a68e09 Move dissect_leb128 to file-elf.c
This allows for the removal of epan/dwarf.[ch]

Functionality could probably be handled by an encoding (like dissect_uleb128),
but for now keep it in file-elf.c as that's the only functionality
currently using it.

Change-Id: I84cf6af02abb3d53ea7d9b774e3313d77a1ff497
Reviewed-on: https://code.wireshark.org/review/24486
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-11-19 05:14:57 +00:00
Michael Mann 752d0ef753 dissect_uleb128 -> tvb_get_varint/proto_tree_add_item_ret_length
Also update ENC_VARINT_PROTOBUF documentation while we're at it

Change-Id: I72e1f9175adc0c6a8bb03ceddba04ffd4844a12e
Reviewed-on: https://code.wireshark.org/review/24485
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-11-19 05:14:27 +00:00
Stig Bjørlykke f2ee064bbb mqtt: Copy UAT match_criteria value
Change-Id: Ifdb743bcf1f644d412d1ac35801347b5355d1754
Reviewed-on: https://code.wireshark.org/review/24410
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-11-14 18:07:19 +00:00
Stig Bjørlykke 7deb2b432b mqtt: Use proto_tree_add_item_ret_uint()
Change-Id: Iccbbb007b4d733b812e2a2cb528477b1417bed6e
Reviewed-on: https://code.wireshark.org/review/24394
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Reviewed-by: Flavio Santes <flavio.santes@1byt3.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-11-12 21:45:03 +00:00
Stig Bjørlykke 95d6217193 mqtt: Whitespace and indent fixes
Change-Id: Ie6470cd20871b0aac17d19c67aba4b7229f906e6
Reviewed-on: https://code.wireshark.org/review/24367
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-11-11 20:18:47 +00:00
Alexis La Goutte 1cf6d365b2 mqtt: Fix Dead Store (Dead assignement/Dead increment) Warning found by Clang
Change-Id: Ibd0041e0031c92073c89a1535677167e4fc90443
Reviewed-on: https://code.wireshark.org/review/24348
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-11-11 15:44:42 +00:00
Stig Bjørlykke eaee0678ce mqtt: Use guint for offset
Change-Id: Ie7b4a540e68121dbe5cd14a9aac80a1f9aae90b3
Reviewed-on: https://code.wireshark.org/review/24342
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2017-11-11 10:55:04 +00:00
Flavio Santes f35aa91c1a dissector/mqtt: Dissect the UNSUBACK payload
MQTT v5.0/UNSUBACK includes a payload conformed
by a list of reason codes. There is no length
field for this payload, so it must be computed
as the difference between the full message size
and the current offset.

Change-Id: Ibf7ef4131408e26e2389c3ab89107c22c16412a1
Signed-off-by: Flavio Santes <flavio.santes@1byt3.com>
Reviewed-on: https://code.wireshark.org/review/24337
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-11-11 09:33:48 +00:00
Flavio Santes d337f4c5b7 dissector/mqtt: Payload length computation
This patch modifies how the payload length is
computed. With this patch we want to simplify
and reduce the number of operations.

Change-Id: Ie1c9a3f26c689e92fbbd57c34e4f68abd3ea7d02
Signed-off-by: Flavio Santes <flavio.santes@1byt3.com>
Reviewed-on: https://code.wireshark.org/review/24336
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-11-11 09:33:37 +00:00
Flavio Santes 645dff11e1 dissector/mqtt: Replace proto_tree_add_uint64 by proto_tree_add_uint
Change-Id: I51d5dfdcbf13cca79ca354d0a63bf7dc328e5dc9
Signed-off-by: Flavio Santes <flavio.santes@1byt3.com>
Reviewed-on: https://code.wireshark.org/review/24312
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-11-09 18:41:27 +00:00
Flavio Santes 4367855163 dissector/mqtt: Rewrite the SUBSCRIBE payload size computation
- FIX: subtract the property length from the message length
- Replace the 'for' loop by a 'while' loop, now that the
  arithmetic is done before.

TODO: It's a protocol error (v5.0)/violation (v3.1.1) not to
include the payload in the SUBSCRIBE control packet. It would
be nice to display a "malformed packet legend" in such that
case.

Change-Id: I99ef3862aa19b3a31ea03d1c194e54f489674115
Signed-off-by: Flavio Santes <flavio.santes@1byt3.com>
Reviewed-on: https://code.wireshark.org/review/24313
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-11-09 08:45:04 +00:00
Stig Bjørlykke 1c25b71c7b mqtt: Rename mqtt_conv to mqtt_conv_t
This will clarify that it's a type.  Also remove unneeded init values.

Change-Id: If61b32a264ff60a26e775dc99f1c06d0aa555a4d
Reviewed-on: https://code.wireshark.org/review/24307
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-11-08 22:01:09 +00:00
Flavio Santes 87431fef28 dissector/mqtt: Add 'Subscription Options/Retain Handling' text descriptions
Change-Id: I6dea2e9c190095105dc1441197ad00c9b3a66f89
Signed-off-by: Flavio Santes <flavio.santes@1byt3.com>
Reviewed-on: https://code.wireshark.org/review/24272
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-11-08 17:26:47 +00:00
Flavio Santes af285603ee dissector/mqtt: Dissect the User Property field
Change-Id: I0a0e484a814a11b785d20fda6eba5c251db98188
Signed-off-by: Flavio Santes <flavio.santes@1byt3.com>
Reviewed-on: https://code.wireshark.org/review/24269
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-11-08 16:50:32 +00:00
Flavio Santes 9f67e0a0d6 dissector/mqtt: Dissect MQTT v5.0 String/Binary Properties
Add routines to dissect the following MQTT v5.0 String/Binary Data
Property fields:

- Content Type
- Response Topic
- Correlation Data
- Assigned Client Identifier
- Authentication Method
- Authentication Data
- Response Information
- Server Reference
- Reason String

Change-Id: Ia0ad0597d32bacc58228376bb738b7092f4a1ad6
Signed-off-by: Flavio Santes <flavio.santes@1byt3.com>
Reviewed-on: https://code.wireshark.org/review/24268
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-11-08 16:27:18 +00:00
Flavio Santes d5759b72e6 dissector/mqtt: Add the 'Subscription Options' dissector
Change-Id: I400430ca59c7492ae64dba6c4cca2485553988b9
Signed-off-by: Flavio Santes <flavio.santes@1byt3.com>
Reviewed-on: https://code.wireshark.org/review/24271
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-11-08 16:26:27 +00:00
Flavio Santes 3f189bed2f dissector/mqtt: Dissect the Subscription Identifier Property
Change-Id: Ia60b9c344fd572193374f57299b1829f17dfa24e
Signed-off-by: Flavio Santes <flavio.santes@1byt3.com>
Reviewed-on: https://code.wireshark.org/review/24267
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-11-08 14:45:47 +00:00
Pascal Quantin 465f75b529 MQTT: add a missing break
Change-Id: I0a17fd44607a5a7452a7c2789140cce7cdcbd17b
Reviewed-on: https://code.wireshark.org/review/24298
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-11-08 10:52:18 +00:00
Flavio Santes bf8d8ebfa4 dissector/mqtt: DISCONNECT and AUTH may not include the Property field
From the spec:

3.14.2.2.1 Property Length: The length of Properties in the DISCONNECT
packet Variable Header encoded as a Variable Byte Integer. If the
Remaining Length is less than 2, a value of 0 is used

In this commit we also assume that AUTH may not include the Property
field, given that DISCONNECT and AUTH share the same structure.

Change-Id: I5f55151df6b2066d924b2c16fb08a63b0903ef46
Signed-off-by: Flavio Santes <flavio.santes@1byt3.com>
Reviewed-on: https://code.wireshark.org/review/24288
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-11-08 08:32:52 +00:00
Flavio Santes 76eab87c7d dissector/mqtt: Dissect MQTT v5.0 Four Byte Properties
Add routines to dissect the following MQTT v5.0 Four Byte
Property fields:

- Publication Expiry Interval
- Session Expiry Interval
- Will Delay Interval
- Maximum Packet Size

Change-Id: Ie902f679c5424f85f98c9ed113951ed0ee6411be
Signed-off-by: Flavio Santes <flavio.santes@1byt3.com>
Reviewed-on: https://code.wireshark.org/review/24266
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-11-08 08:24:20 +00:00
Flavio Santes 9e7cfd32dd dissector/mqtt: Dissect MQTT v5.0 Two Byte Properties
Add routines to dissect the following MQTT v5.0 Two Byte
Property fields:

- Server Keep Alive
- Receive Maximum
- Topic Alias Maximum
- Topic Alias

Change-Id: I90b43cd315f31a34b10bf6065ea51549307e95f3
Signed-off-by: Flavio Santes <flavio.santes@1byt3.com>
Reviewed-on: https://code.wireshark.org/review/24265
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-11-08 08:20:41 +00:00
Flavio Santes 458f97b1eb dissector/mqtt: Dissect MQTT v5.0 Byte Properties
Add routines to dissect the following MQTT v5.0 Byte
Property fields:

- Payload Format Indicator
- Request Problem Information
- Request Response Information
- Maximum QoS
- Retain Available
- Wildcard Subscription Available
- Subscription Identifier Available
- Shared Subscription Available

Change-Id: I28b95174ce811a92d8f22bf51c331169b5e4b925
Signed-off-by: Flavio Santes <flavio.santes@1byt3.com>
Reviewed-on: https://code.wireshark.org/review/24264
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-11-08 07:54:34 +00:00
Flavio Santes 1344e707b7 dissector/mqtt: Disconnect and Auth variable header
Apply 'Disconnect' (3.14.2) and 'Auth' (3.15.2-1) notes to simplify
and fix the variable header :).

Change-Id: I169a69a0da5b2d5ee338c0f45af978217986f37a
Signed-off-by: Flavio Santes <flavio.santes@1byt3.com>
Reviewed-on: https://code.wireshark.org/review/24274
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-11-07 12:30:32 +00:00
Flavio Santes 19b2ddcce1 dissector/mqtt: Update license notice
Change-Id: Iefd0bead04cc54c55d39b682b7879620c022afb1
Signed-off-by: Flavio Santes <flavio.santes@1byt3.com>
Reviewed-on: https://code.wireshark.org/review/24262
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-11-07 06:14:35 +00:00
Flavio Santes e2179a2ac5 dissector/mqtt: Add partial support for MQTT v5.0
This patch adds partial support for the MQTT v5.0 protocol.
The relevant changes are:

- A new MQTT control packet: AUTH (15)
- The Variable Header is extended with a new section: 'Properties'

Currently, the 'Properties' section is not dissected although
its length is parsed.

Change-Id: I059b91304e953d69e4781b170e61057cb38dde19
Signed-off-by: Flavio Santes <flavio.santes@1byt3.com>
Reviewed-on: https://code.wireshark.org/review/24261
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-11-07 06:13:53 +00:00
Stig Bjørlykke f6edbcd643 mqtt: Simplify message decode matching
Change-Id: I93da46808de8a978d49ad0aa3f78c4a1790e7952
Reviewed-on: https://code.wireshark.org/review/24210
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-11-03 05:19:58 +00:00
Stig Bjørlykke 50c337f40a mqtt: Add message decoding
Add support for configuring message decoding based on topic.
Matching criteria is equal-to, contains, starts-with, ends-with
or regular expression.

Change-Id: I677d869716eb1d2798974e2c65605a454421a66c
Reviewed-on: https://code.wireshark.org/review/24196
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-10-31 19:00:04 +00:00
Michael Mann 15ce2db13a mqtt: Use proto_tree_add_bitmask
Change-Id: I8e9cd64edcabf810e70b134ecce7a771babafebc
Reviewed-on: https://code.wireshark.org/review/24017
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2017-10-24 10:31:15 +00:00
Stig Bjørlykke de066346a6 mqtt: Fix some mistakes from previous commit
- PUBREL, SUBSCRIBE and UNSUBSCRIBE does use QoS for v3.1
- CONNACK is also different between v3.1 and v3.1.1
- DUP flag is not reserved, it's Retain which is reserved
- Use proto_tree_add_item for reserved fields
- Use uniform layout and fixed indent (2 spaces in this file)

Change-Id: I26337ad63cd67d832db84993349fa3406e305b72
Reviewed-on: https://code.wireshark.org/review/24025
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-10-22 21:28:36 +00:00
Flavio Santes 89fe6629b7 [RFC] dissector/mqtt: Fix handling of fixed header flags
According to the MQTT v3.1 and v3.1.1 specifications,
the fixed header flags (DUP, QoS and RETAIN) are only set by
the PUBLISH message.

The DUP flag is also set by the PUBREL, SUBSCRIBE and
UNSUBSCRIBE messages but only when version 3.1 is used.

Currently, the MQTT dissector shows the header flags for
all the v3.1 and v3.1.1 messages.

This patch fixes the issues mentioned above.

To track the protocol version used during the connection handshake
a conversation is used. For subsequent messages, the way the header
flags are displayed is determined by this variable.

Change-Id: Iad808f77a2c379f9786152c26d3aa86e24be1b16
Signed-off-by: Flavio Santes <flavio.santes@1byt3.com>
Reviewed-on: https://code.wireshark.org/review/23939
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-10-22 18:18:27 +00:00
Flavio Santes 0d6c5a79eb dissector/mqtt: Fix some inline comments
There are some issues with the inline comments. Rephrase those
comments. Furthermore, use the MQTT v3.1 and v3.1.1 specification
language to fix some inline comments.

Change-Id: Ia3864e1b66ef1eb4bbd8cb90aed674c7d9c4b7be
Signed-off-by: Flavio Santes <flavio.santes@1byt3.com>
Reviewed-on: https://code.wireshark.org/review/23937
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-10-16 12:59:11 +00:00
Flavio Santes 1a8143172c dissector/mqtt: Add the protocol version string
Add the protocol version string:
- 3 maps to MQTT v3.1
- 4 maps to MQTT v3.1.1

Change-Id: I8cf1ba0c1bcabd5718467946b33082e4eb5a37ed
Signed-off-by: Flavio Santes <flavio.santes@1byt3.com>
Reviewed-on: https://code.wireshark.org/review/23938
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-10-16 09:56:08 +00:00
Flavio Santes 5967621d19 dissector/mqtt: Add the MQTT protocol description
The packet-PROTOABBREV.c template recommends to provide a short
description of the protocol below the license header. Currently,
this information is not present in the packet-mqtt.c dissector.

This patch adds the protocol description taken from the official
specification. Links to the v3.1 and v3.1.1 specifications are
also provided by this patch.

Change-Id: I9bb85aa3b78c8804c923f77c163904a7949f6899
Signed-off-by: Flavio Santes <flavio.santes@1byt3.com>
Reviewed-on: https://code.wireshark.org/review/23936
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-10-16 09:31:53 +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