diff options
author | Ali Sabil <ali.sabil@koperadev.com> | 2019-10-08 22:17:53 +0200 |
---|---|---|
committer | Stig Bjørlykke <stig@bjorlykke.org> | 2019-10-09 06:32:21 +0000 |
commit | 3805cb6f2f0190d81f2d68c7e83f3323da51209f (patch) | |
tree | 02454697339e20bfbb93bbb1361bea62b801ee5d | |
parent | 09d16a64abe32b5afed7b00856ccb590248f45f4 (diff) |
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>
-rw-r--r-- | epan/dissectors/packet-mqtt.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/epan/dissectors/packet-mqtt.c b/epan/dissectors/packet-mqtt.c index 69f3f6b427..ab29b3e864 100644 --- a/epan/dissectors/packet-mqtt.c +++ b/epan/dissectors/packet-mqtt.c @@ -514,6 +514,7 @@ static int hf_mqtt_will_topic_len = -1; static int hf_mqtt_will_topic = -1; static int hf_mqtt_will_msg_len = -1; static int hf_mqtt_will_msg = -1; +static int hf_mqtt_will_msg_text = -1; static int hf_mqtt_username_len = -1; static int hf_mqtt_username = -1; static int hf_mqtt_passwd_len = -1; @@ -1031,7 +1032,14 @@ static int dissect_mqtt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi proto_tree_add_item_ret_uint(mqtt_tree, hf_mqtt_will_msg_len, tvb, offset, 2, ENC_BIG_ENDIAN, &mqtt_str_len); offset += 2; - proto_tree_add_item(mqtt_tree, hf_mqtt_will_msg, tvb, offset, mqtt_str_len, ENC_UTF_8|ENC_NA); + if (show_msg_as_text) + { + proto_tree_add_item(mqtt_tree, hf_mqtt_will_msg_text, tvb, offset, mqtt_str_len, ENC_UTF_8|ENC_NA); + } + else + { + proto_tree_add_item(mqtt_tree, hf_mqtt_will_msg, tvb, offset, mqtt_str_len, ENC_NA); + } offset += mqtt_str_len; } @@ -1414,6 +1422,10 @@ void proto_register_mqtt(void) NULL, HFILL }}, { &hf_mqtt_will_msg, { "Will Message", "mqtt.willmsg", + FT_BYTES, BASE_NONE, NULL, 0, + NULL, HFILL }}, + { &hf_mqtt_will_msg_text, + { "Will Message", "mqtt.willmsg", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_mqtt_will_msg_len, |