dissector/mqtt: Dissect the UNSUBACK payload
authorFlavio Santes <flavio.santes@1byt3.com>
Fri, 10 Nov 2017 17:35:49 +0000 (12:35 -0500)
committerAnders Broman <a.broman58@gmail.com>
Sat, 11 Nov 2017 09:33:48 +0000 (09:33 +0000)
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>
epan/dissectors/packet-mqtt.c

index f9bed189f852da72ea645f3bba8da4d927180ebf..b83fdd62dd8189bcd91a918808b2ca74551f49a2 100644 (file)
@@ -926,6 +926,12 @@ static int dissect_mqtt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi
         if (mqtt->runtime_proto_version == MQTT_PROTO_V50)
         {
           offset += dissect_mqtt_properties(tvb, mqtt_tree, offset);
+
+          while (offset < tvb_reported_length(tvb))
+          {
+            proto_tree_add_item(mqtt_tree, hf_mqtt_reason_code, tvb, offset, 1, ENC_BIG_ENDIAN);
+            offset += 1;
+          }
         }
         break;