From 69bac0d15c94891398e65fda05fb5d7320eb2989 Mon Sep 17 00:00:00 2001 From: Sake Blok Date: Fri, 23 Jun 2017 12:38:05 -0400 Subject: tcp: add tcp.payload field Make the tcp segment data available on all tcp packets, regardless of reassembly of higher layer protocols. Change-Id: I1a5024e427e07b85bfc3a4aad5d0a401beb1049d Reviewed-on: https://code.wireshark.org/review/22374 Reviewed-by: Sake Blok Petri-Dish: Sake Blok Tested-by: Petri Dish Buildbot Reviewed-by: Martin Kaiser --- epan/dissectors/packet-tcp.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'epan') diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c index bf6818f145..a34fa040e2 100644 --- a/epan/dissectors/packet-tcp.c +++ b/epan/dissectors/packet-tcp.c @@ -324,6 +324,7 @@ static int hf_tcp_proc_dst_pid = -1; static int hf_tcp_proc_dst_uname = -1; static int hf_tcp_proc_dst_cmd = -1; static int hf_tcp_segment_data = -1; +static int hf_tcp_payload = -1; static int hf_tcp_reset_cause = -1; static int hf_tcp_fin_retransmission = -1; static int hf_tcp_option_rvbd_probe_reserved = -1; @@ -5573,8 +5574,14 @@ dissect_tcp_payload(tvbuff_t *tvb, packet_info *pinfo, int offset, guint32 seq, proto_tree *tree, proto_tree *tcp_tree, struct tcp_analysis *tcpd, struct tcpinfo *tcpinfo) { + gint nbytes; gboolean save_fragmented; + nbytes = tvb_reported_length_remaining(tvb, offset); + proto_tree_add_bytes_format(tcp_tree, hf_tcp_payload, tvb, offset, + -1, NULL, "TCP payload (%u byte%s)", nbytes, + plurality(nbytes, "", "s")); + /* Can we desegment this segment? */ if (pinfo->can_desegment) { /* Yes. */ @@ -7161,6 +7168,10 @@ proto_register_tcp(void) { "TCP segment data", "tcp.segment_data", FT_BYTES, BASE_NONE, NULL, 0x0, "A data segment used in reassembly of a lower-level protocol", HFILL}}, + { &hf_tcp_payload, + { "TCP payload", "tcp.payload", FT_BYTES, BASE_NONE, NULL, 0x0, + "The TCP payload of this packet", HFILL}}, + { &hf_tcp_option_scps_binding_data, { "Binding Space Data", "tcp.options.scps.binding.data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, -- cgit v1.2.1