From c661da414d5ddb506e0c23d3169cff45b6211398 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stig=20Bj=C3=B8rlykke?= Date: Thu, 25 Aug 2016 12:44:41 +0200 Subject: [PATCH] xmpp: Add whitespace keepalive indication MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RFC 6120 section 4.6.1 defines the use of a single whitespace as "whitespace keepalive", so indicate this in the Info column. Change-Id: I685431d91be2a37fbd66f8d1cdabe53f33092e93 Reviewed-on: https://code.wireshark.org/review/17323 Petri-Dish: Stig Bjørlykke Reviewed-by: Jaap Keuter Petri-Dish: Jaap Keuter Tested-by: Petri Dish Buildbot Reviewed-by: Stig Bjørlykke --- epan/dissectors/packet-xmpp.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/epan/dissectors/packet-xmpp.c b/epan/dissectors/packet-xmpp.c index bea9bab5c9..ae98bd2702 100644 --- a/epan/dissectors/packet-xmpp.c +++ b/epan/dissectors/packet-xmpp.c @@ -423,13 +423,18 @@ dissect_xmpp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ } col_set_str(pinfo->cinfo, COL_PROTOCOL, "XMPP"); - col_clear(pinfo->cinfo, COL_INFO); /*if tree == NULL then xmpp_item and xmpp_tree will also NULL*/ xmpp_item = proto_tree_add_item(tree, proto_xmpp, tvb, 0, -1, ENC_NA); xmpp_tree = proto_item_add_subtree(xmpp_item, ett_xmpp); + if ((tvb_reported_length(tvb) == 1) && tvb_get_guint8(tvb, 0) == ' ') { + /* RFC 6120 section 4.6.1 */ + col_set_str(pinfo->cinfo, COL_INFO, "Whitespace Keepalive"); + return tvb_captured_length(tvb); + } + call_dissector_with_data(xml_handle, tvb, pinfo, xmpp_tree, NULL); /* If XML dissector is disabled, we can't do much */ @@ -523,9 +528,9 @@ dissect_xmpp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ xmpp_features(xmpp_tree, tvb, pinfo, packet); } else if (strcmp(packet->name, "starttls") == 0) { xmpp_starttls(xmpp_tree, tvb, pinfo, packet, xmpp_info); - }else if (strcmp(packet->name, "proceed") == 0) { + } else if (strcmp(packet->name, "proceed") == 0) { xmpp_proceed(xmpp_tree, tvb, pinfo, packet, xmpp_info); - }else { + } else { xmpp_proto_tree_show_first_child(xmpp_tree); expert_add_info_format(pinfo, xmpp_tree, &ei_xmpp_packet_unknown, "Unknown packet: %s", packet->name); col_set_str(pinfo->cinfo, COL_INFO, "UNKNOWN PACKET ");