1998-09-16 02:39:15 +00:00
|
|
|
/* packet-tcp.c
|
|
|
|
* Routines for TCP packet disassembly
|
|
|
|
*
|
2004-07-18 00:24:25 +00:00
|
|
|
* $Id$
|
1998-09-16 03:22:19 +00:00
|
|
|
*
|
2006-05-21 04:49:01 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
1998-09-16 02:39:15 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1998-09-16 02:39:15 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1998-09-16 02:39:15 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1998-09-16 02:39:15 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2006-10-28 21:32:38 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
1998-09-16 02:39:15 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
1999-03-23 03:14:46 +00:00
|
|
|
#include <stdio.h>
|
2000-11-05 09:26:47 +00:00
|
|
|
#include <string.h>
|
1999-03-23 03:14:46 +00:00
|
|
|
#include <glib.h>
|
2004-09-28 00:06:32 +00:00
|
|
|
#include <epan/in_cksum.h>
|
1998-09-16 02:39:15 +00:00
|
|
|
|
2003-07-11 09:30:49 +00:00
|
|
|
#include <epan/packet.h>
|
2004-08-06 19:57:49 +00:00
|
|
|
#include <epan/addr_resolv.h>
|
2004-09-29 00:52:45 +00:00
|
|
|
#include <epan/ipproto.h>
|
2005-09-17 00:02:31 +00:00
|
|
|
#include <epan/ip_opts.h>
|
2005-02-09 23:38:00 +00:00
|
|
|
#include <epan/follow.h>
|
2004-09-27 22:55:15 +00:00
|
|
|
#include <epan/prefs.h>
|
2006-03-20 10:52:53 +00:00
|
|
|
#include <epan/emem.h>
|
2000-04-16 22:46:25 +00:00
|
|
|
#include "packet-tcp.h"
|
Make a "tcp_dissect_pdus()" with the standard loop for a TCP segment,
extracting PDUs from it and possibly doing reassembly. Make the COPS,
DNS, DSI, Gryphon, and SCCP dissectors use it.
Add "set_actual_length()", "tcp_dissect_pdus()",
"decode_boolean_bitfield()", "decode_numeric_bitfield()", and
"decode_enumerated_bitfield()" to the list of routines available to
dissectors on platforms where routines in the main program aren't
available to dynamically-loaded code.
Declare routines in "to_str.h" as "extern"; as I remember, that's
necessary to allow the "decode_XXX_bitfield()" routines declared therein
to be made available to plugins as per the above.
Note that new exported routines should be added to the end of the table
if that's the only change being made to the table.
Create a new "plugin_api_decls.h" header file, used to declare both the
"p_" variables and the "p_" structure members in the routine-exporting
mechanism; this reduces the number of places you have to change to
change the list of exported routines.
svn path=/trunk/; revision=5394
2002-05-05 00:16:38 +00:00
|
|
|
#include "packet-frame.h"
|
2002-01-21 07:37:49 +00:00
|
|
|
#include <epan/conversation.h>
|
2005-02-09 23:38:00 +00:00
|
|
|
#include <epan/reassemble.h>
|
2004-09-29 00:06:36 +00:00
|
|
|
#include <epan/tap.h>
|
2005-08-26 23:05:38 +00:00
|
|
|
#include <epan/slab.h>
|
2005-09-11 16:55:34 +00:00
|
|
|
#include <epan/expert.h>
|
2002-12-17 11:49:32 +00:00
|
|
|
|
|
|
|
static int tcp_tap = -1;
|
1999-03-23 03:14:46 +00:00
|
|
|
|
2000-07-13 14:16:49 +00:00
|
|
|
/* Place TCP summary in proto tree */
|
2000-12-13 02:24:23 +00:00
|
|
|
static gboolean tcp_summary_in_tree = TRUE;
|
2000-07-13 14:16:49 +00:00
|
|
|
|
2002-01-18 22:35:19 +00:00
|
|
|
/*
|
2002-05-05 22:25:14 +00:00
|
|
|
* Flag to control whether to check the TCP checksum.
|
|
|
|
*
|
|
|
|
* In at least some Solaris network traces, there are packets with bad
|
|
|
|
* TCP checksums, but the traffic appears to indicate that the packets
|
|
|
|
* *were* received; the packets were probably sent by the host on which
|
|
|
|
* the capture was being done, on a network interface to which
|
2002-01-18 22:35:19 +00:00
|
|
|
* checksumming was offloaded, so that DLPI supplied an un-checksummed
|
|
|
|
* packet to the capture program but a checksummed packet got put onto
|
2002-05-05 22:25:14 +00:00
|
|
|
* the wire.
|
2002-01-18 22:35:19 +00:00
|
|
|
*/
|
2008-04-05 00:15:29 +00:00
|
|
|
static gboolean tcp_check_checksum = FALSE;
|
2002-01-18 22:35:19 +00:00
|
|
|
|
1998-09-17 03:12:28 +00:00
|
|
|
extern FILE* data_out_file;
|
|
|
|
|
1999-11-02 05:03:02 +00:00
|
|
|
static int proto_tcp = -1;
|
|
|
|
static int hf_tcp_srcport = -1;
|
|
|
|
static int hf_tcp_dstport = -1;
|
|
|
|
static int hf_tcp_port = -1;
|
2008-09-30 12:24:27 +00:00
|
|
|
static int hf_tcp_stream = -1;
|
1999-11-02 05:03:02 +00:00
|
|
|
static int hf_tcp_seq = -1;
|
2000-09-21 00:44:09 +00:00
|
|
|
static int hf_tcp_nxtseq = -1;
|
1999-11-02 05:03:02 +00:00
|
|
|
static int hf_tcp_ack = -1;
|
1999-11-02 07:04:46 +00:00
|
|
|
static int hf_tcp_hdr_len = -1;
|
1999-11-02 05:03:02 +00:00
|
|
|
static int hf_tcp_flags = -1;
|
2000-09-14 21:58:48 +00:00
|
|
|
static int hf_tcp_flags_cwr = -1;
|
|
|
|
static int hf_tcp_flags_ecn = -1;
|
1999-11-02 05:03:02 +00:00
|
|
|
static int hf_tcp_flags_urg = -1;
|
|
|
|
static int hf_tcp_flags_ack = -1;
|
|
|
|
static int hf_tcp_flags_push = -1;
|
|
|
|
static int hf_tcp_flags_reset = -1;
|
|
|
|
static int hf_tcp_flags_syn = -1;
|
|
|
|
static int hf_tcp_flags_fin = -1;
|
|
|
|
static int hf_tcp_window_size = -1;
|
|
|
|
static int hf_tcp_checksum = -1;
|
2001-02-28 19:33:49 +00:00
|
|
|
static int hf_tcp_checksum_bad = -1;
|
2006-10-29 13:53:07 +00:00
|
|
|
static int hf_tcp_checksum_good = -1;
|
2002-04-21 02:57:01 +00:00
|
|
|
static int hf_tcp_len = -1;
|
1999-11-02 05:03:02 +00:00
|
|
|
static int hf_tcp_urgent_pointer = -1;
|
2002-08-21 23:57:38 +00:00
|
|
|
static int hf_tcp_analysis_flags = -1;
|
2008-08-25 02:15:36 +00:00
|
|
|
static int hf_tcp_analysis_bytes_in_flight = -1;
|
2002-08-02 22:41:56 +00:00
|
|
|
static int hf_tcp_analysis_acks_frame = -1;
|
|
|
|
static int hf_tcp_analysis_ack_rtt = -1;
|
2005-07-10 05:27:38 +00:00
|
|
|
static int hf_tcp_analysis_rto = -1;
|
|
|
|
static int hf_tcp_analysis_rto_frame = -1;
|
2002-08-02 22:41:56 +00:00
|
|
|
static int hf_tcp_analysis_retransmission = -1;
|
2003-10-25 00:25:38 +00:00
|
|
|
static int hf_tcp_analysis_fast_retransmission = -1;
|
|
|
|
static int hf_tcp_analysis_out_of_order = -1;
|
2007-08-31 15:06:27 +00:00
|
|
|
static int hf_tcp_analysis_reused_ports = -1;
|
2002-08-02 22:41:56 +00:00
|
|
|
static int hf_tcp_analysis_lost_packet = -1;
|
|
|
|
static int hf_tcp_analysis_ack_lost_packet = -1;
|
2004-12-03 05:53:09 +00:00
|
|
|
static int hf_tcp_analysis_window_update = -1;
|
2004-12-19 07:18:04 +00:00
|
|
|
static int hf_tcp_analysis_window_full = -1;
|
2002-08-02 22:41:56 +00:00
|
|
|
static int hf_tcp_analysis_keep_alive = -1;
|
2003-09-08 10:19:06 +00:00
|
|
|
static int hf_tcp_analysis_keep_alive_ack = -1;
|
2002-11-01 10:25:35 +00:00
|
|
|
static int hf_tcp_analysis_duplicate_ack = -1;
|
2003-03-27 09:40:27 +00:00
|
|
|
static int hf_tcp_analysis_duplicate_ack_num = -1;
|
|
|
|
static int hf_tcp_analysis_duplicate_ack_frame = -1;
|
2002-11-01 11:05:37 +00:00
|
|
|
static int hf_tcp_analysis_zero_window = -1;
|
|
|
|
static int hf_tcp_analysis_zero_window_probe = -1;
|
2006-01-26 22:50:16 +00:00
|
|
|
static int hf_tcp_analysis_zero_window_probe_ack = -1;
|
2004-03-19 06:14:03 +00:00
|
|
|
static int hf_tcp_continuation_to = -1;
|
2004-11-12 22:04:19 +00:00
|
|
|
static int hf_tcp_pdu_time = -1;
|
2006-10-22 00:21:40 +00:00
|
|
|
static int hf_tcp_pdu_size = -1;
|
2004-11-12 22:04:19 +00:00
|
|
|
static int hf_tcp_pdu_last_frame = -1;
|
2003-08-28 03:35:23 +00:00
|
|
|
static int hf_tcp_reassembled_in = -1;
|
2002-12-19 11:22:38 +00:00
|
|
|
static int hf_tcp_segments = -1;
|
|
|
|
static int hf_tcp_segment = -1;
|
|
|
|
static int hf_tcp_segment_overlap = -1;
|
|
|
|
static int hf_tcp_segment_overlap_conflict = -1;
|
|
|
|
static int hf_tcp_segment_multiple_tails = -1;
|
|
|
|
static int hf_tcp_segment_too_long_fragment = -1;
|
|
|
|
static int hf_tcp_segment_error = -1;
|
2006-10-28 21:32:38 +00:00
|
|
|
static int hf_tcp_options = -1;
|
2003-03-01 04:24:40 +00:00
|
|
|
static int hf_tcp_option_mss = -1;
|
2003-03-01 08:28:59 +00:00
|
|
|
static int hf_tcp_option_mss_val = -1;
|
2003-03-01 08:51:12 +00:00
|
|
|
static int hf_tcp_option_wscale = -1;
|
|
|
|
static int hf_tcp_option_wscale_val = -1;
|
2003-03-01 04:24:40 +00:00
|
|
|
static int hf_tcp_option_sack_perm = -1;
|
|
|
|
static int hf_tcp_option_sack = -1;
|
2003-03-03 03:16:36 +00:00
|
|
|
static int hf_tcp_option_sack_sle = -1;
|
|
|
|
static int hf_tcp_option_sack_sre = -1;
|
2003-03-01 04:24:40 +00:00
|
|
|
static int hf_tcp_option_echo = -1;
|
|
|
|
static int hf_tcp_option_echo_reply = -1;
|
|
|
|
static int hf_tcp_option_time_stamp = -1;
|
|
|
|
static int hf_tcp_option_cc = -1;
|
|
|
|
static int hf_tcp_option_ccnew = -1;
|
|
|
|
static int hf_tcp_option_ccecho = -1;
|
|
|
|
static int hf_tcp_option_md5 = -1;
|
2007-06-04 23:27:12 +00:00
|
|
|
static int hf_tcp_option_qs = -1;
|
2007-09-25 20:37:13 +00:00
|
|
|
static int hf_tcp_ts_relative = -1;
|
|
|
|
static int hf_tcp_ts_delta = -1;
|
2008-08-12 21:08:46 +00:00
|
|
|
static int hf_tcp_option_scps = -1;
|
|
|
|
static int hf_tcp_option_scps_vector = -1;
|
|
|
|
static int hf_tcp_option_scps_binding = -1;
|
|
|
|
static int hf_tcp_scpsoption_flags_bets = -1;
|
|
|
|
static int hf_tcp_scpsoption_flags_snack1 = -1;
|
|
|
|
static int hf_tcp_scpsoption_flags_snack2 = -1;
|
|
|
|
static int hf_tcp_scpsoption_flags_compress = -1;
|
|
|
|
static int hf_tcp_scpsoption_flags_nlts = -1;
|
|
|
|
static int hf_tcp_scpsoption_flags_resv1 = -1;
|
|
|
|
static int hf_tcp_scpsoption_flags_resv2 = -1;
|
|
|
|
static int hf_tcp_scpsoption_flags_resv3 = -1;
|
|
|
|
static int hf_tcp_option_snack = -1;
|
|
|
|
static int hf_tcp_option_snack_offset = -1;
|
|
|
|
static int hf_tcp_option_snack_size = -1;
|
|
|
|
static int hf_tcp_option_snack_le = -1;
|
|
|
|
static int hf_tcp_option_snack_re = -1;
|
2009-05-14 23:33:17 +00:00
|
|
|
static int hf_tcp_proc_src_uid = -1;
|
|
|
|
static int hf_tcp_proc_src_pid = -1;
|
|
|
|
static int hf_tcp_proc_src_uname = -1;
|
|
|
|
static int hf_tcp_proc_src_cmd = -1;
|
|
|
|
static int hf_tcp_proc_dst_uid = -1;
|
|
|
|
static int hf_tcp_proc_dst_pid = -1;
|
|
|
|
static int hf_tcp_proc_dst_uname = -1;
|
|
|
|
static int hf_tcp_proc_dst_cmd = -1;
|
1999-07-17 04:19:15 +00:00
|
|
|
|
1999-11-16 11:44:20 +00:00
|
|
|
static gint ett_tcp = -1;
|
|
|
|
static gint ett_tcp_flags = -1;
|
|
|
|
static gint ett_tcp_options = -1;
|
|
|
|
static gint ett_tcp_option_sack = -1;
|
2008-08-12 21:08:46 +00:00
|
|
|
static gint ett_tcp_option_scps = -1;
|
|
|
|
static gint ett_tcp_option_scps_extended = -1;
|
2002-08-02 22:41:56 +00:00
|
|
|
static gint ett_tcp_analysis = -1;
|
2002-08-21 23:57:38 +00:00
|
|
|
static gint ett_tcp_analysis_faults = -1;
|
2007-09-25 20:37:13 +00:00
|
|
|
static gint ett_tcp_timestamps = -1;
|
2002-12-19 11:22:38 +00:00
|
|
|
static gint ett_tcp_segments = -1;
|
|
|
|
static gint ett_tcp_segment = -1;
|
2006-10-29 13:53:07 +00:00
|
|
|
static gint ett_tcp_checksum = -1;
|
2009-05-14 23:33:17 +00:00
|
|
|
static gint ett_tcp_process_info = -1;
|
2002-12-19 11:22:38 +00:00
|
|
|
|
|
|
|
|
2006-01-30 23:29:09 +00:00
|
|
|
/* not all of the hf_fields below make sense for TCP but we have to provide
|
|
|
|
them anyways to comply with the api (which was aimed for ip fragment
|
2002-12-19 11:22:38 +00:00
|
|
|
reassembly) */
|
|
|
|
static const fragment_items tcp_segment_items = {
|
|
|
|
&ett_tcp_segment,
|
|
|
|
&ett_tcp_segments,
|
|
|
|
&hf_tcp_segments,
|
|
|
|
&hf_tcp_segment,
|
|
|
|
&hf_tcp_segment_overlap,
|
|
|
|
&hf_tcp_segment_overlap_conflict,
|
|
|
|
&hf_tcp_segment_multiple_tails,
|
|
|
|
&hf_tcp_segment_too_long_fragment,
|
|
|
|
&hf_tcp_segment_error,
|
2003-08-28 03:35:23 +00:00
|
|
|
&hf_tcp_reassembled_in,
|
2002-12-19 11:22:38 +00:00
|
|
|
"Segments"
|
|
|
|
};
|
1999-11-16 11:44:20 +00:00
|
|
|
|
2000-04-03 09:24:12 +00:00
|
|
|
static dissector_table_t subdissector_table;
|
Add routines to:
register lists of "heuristic" dissectors, which are handed a
frame that may or may contain a payload for the protocol they
dissect, and that return FALSE if it's not or dissect the packet
and return TRUE if it is;
add a dissector to such a list;
go through such a list, calling each dissector until either a
dissector returns TRUE, in which case the routine returns TRUE,
or it runs out of entries in the list, in which case the routine
returns FALSE.
Have lists of heuristic dissectors for TCP and for COTP when used with
the Inactive Subset of CLNP, and add the GIOP and Yahoo Messenger
dissectors to the first list and the Sinec H1 dissector to the second
list.
Make the dissector name argument to "dissector_add()" and
"dissector_delete()" a "const char *" rarther than just a "char *".
Add "heur_dissector_add()", the routine to add a heuristic dissector to
a list of heuristic dissectors, to the set of routines we can export to
plugins through a table on platforms where dynamically-loaded code can't
call stuff in the main program, and initialize the element in the table
in question for "dissector_add()" (which we'd forgotten to do).
svn path=/trunk/; revision=1909
2000-05-05 09:32:36 +00:00
|
|
|
static heur_dissector_list_t heur_subdissector_list;
|
2001-11-26 04:52:51 +00:00
|
|
|
static dissector_handle_t data_handle;
|
2000-04-03 09:24:12 +00:00
|
|
|
|
1999-03-23 03:14:46 +00:00
|
|
|
/* TCP structs and definitions */
|
|
|
|
|
2002-08-28 21:04:11 +00:00
|
|
|
/* **************************************************************************
|
2006-01-26 22:50:16 +00:00
|
|
|
|
2002-08-02 22:41:56 +00:00
|
|
|
* RTT and reltive sequence numbers.
|
|
|
|
* **************************************************************************/
|
2003-11-13 20:53:44 +00:00
|
|
|
static gboolean tcp_analyze_seq = TRUE;
|
|
|
|
static gboolean tcp_relative_seq = TRUE;
|
2008-08-25 02:15:36 +00:00
|
|
|
static gboolean tcp_track_bytes_in_flight = TRUE;
|
2007-09-25 20:37:13 +00:00
|
|
|
static gboolean tcp_calculate_ts = FALSE;
|
2002-08-02 22:41:56 +00:00
|
|
|
|
2005-08-26 23:05:38 +00:00
|
|
|
/* SLAB allocator for tcp_unacked structures
|
|
|
|
*/
|
|
|
|
SLAB_ITEM_TYPE_DEFINE(tcp_unacked_t)
|
|
|
|
static SLAB_FREE_LIST_DEFINE(tcp_unacked_t)
|
|
|
|
#define TCP_UNACKED_NEW(fi) \
|
|
|
|
SLAB_ALLOC(fi, tcp_unacked_t)
|
|
|
|
#define TCP_UNACKED_FREE(fi) \
|
|
|
|
SLAB_FREE(fi, tcp_unacked_t)
|
|
|
|
|
2002-08-02 22:41:56 +00:00
|
|
|
|
2003-09-08 10:19:06 +00:00
|
|
|
#define TCP_A_RETRANSMISSION 0x0001
|
|
|
|
#define TCP_A_LOST_PACKET 0x0002
|
|
|
|
#define TCP_A_ACK_LOST_PACKET 0x0004
|
|
|
|
#define TCP_A_KEEP_ALIVE 0x0008
|
|
|
|
#define TCP_A_DUPLICATE_ACK 0x0010
|
|
|
|
#define TCP_A_ZERO_WINDOW 0x0020
|
|
|
|
#define TCP_A_ZERO_WINDOW_PROBE 0x0040
|
2006-01-26 22:50:16 +00:00
|
|
|
#define TCP_A_ZERO_WINDOW_PROBE_ACK 0x0080
|
2003-09-08 10:19:06 +00:00
|
|
|
#define TCP_A_KEEP_ALIVE_ACK 0x0100
|
2003-10-25 00:25:38 +00:00
|
|
|
#define TCP_A_OUT_OF_ORDER 0x0200
|
|
|
|
#define TCP_A_FAST_RETRANSMISSION 0x0400
|
2004-12-03 05:53:09 +00:00
|
|
|
#define TCP_A_WINDOW_UPDATE 0x0800
|
2004-12-19 07:18:04 +00:00
|
|
|
#define TCP_A_WINDOW_FULL 0x1000
|
2007-08-31 15:06:27 +00:00
|
|
|
#define TCP_A_REUSED_PORTS 0x2000
|
2006-03-05 05:36:46 +00:00
|
|
|
|
2002-08-02 22:41:56 +00:00
|
|
|
|
2006-01-26 22:50:16 +00:00
|
|
|
static void
|
|
|
|
process_tcp_payload(tvbuff_t *tvb, volatile int offset, packet_info *pinfo,
|
|
|
|
proto_tree *tree, proto_tree *tcp_tree, int src_port, int dst_port,
|
2006-01-30 23:29:09 +00:00
|
|
|
guint32 seq, guint32 nxtseq, gboolean is_tcp_segment,
|
2006-01-26 22:50:16 +00:00
|
|
|
struct tcp_analysis *tcpd);
|
2003-04-23 10:20:29 +00:00
|
|
|
|
2006-01-26 22:50:16 +00:00
|
|
|
|
|
|
|
struct tcp_analysis *
|
2008-09-30 12:24:27 +00:00
|
|
|
init_tcp_conversation_data(packet_info *pinfo)
|
2003-04-23 10:20:29 +00:00
|
|
|
{
|
2009-10-25 11:43:30 +00:00
|
|
|
struct tcp_analysis *tcpd;
|
2003-04-23 10:20:29 +00:00
|
|
|
|
2008-04-05 20:01:09 +00:00
|
|
|
/* Initialize the tcp protocol datat structure to add to the tcp conversation */
|
2008-12-09 17:50:02 +00:00
|
|
|
tcpd=se_alloc0(sizeof(struct tcp_analysis));
|
2007-10-28 23:38:43 +00:00
|
|
|
tcpd->flow1.win_scale=-1;
|
|
|
|
tcpd->flow1.multisegment_pdus=se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "tcp_multisegment_pdus");
|
2009-10-25 11:43:30 +00:00
|
|
|
/*
|
2009-05-14 23:33:17 +00:00
|
|
|
tcpd->flow1.username = NULL;
|
|
|
|
tcpd->flow1.command = NULL;
|
2009-10-25 11:43:30 +00:00
|
|
|
*/
|
2007-10-28 23:38:43 +00:00
|
|
|
tcpd->flow2.win_scale=-1;
|
|
|
|
tcpd->flow2.multisegment_pdus=se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "tcp_multisegment_pdus");
|
2009-10-25 11:43:30 +00:00
|
|
|
/*
|
2009-05-14 23:33:17 +00:00
|
|
|
tcpd->flow2.username = NULL;
|
|
|
|
tcpd->flow2.command = NULL;
|
2009-10-25 11:43:30 +00:00
|
|
|
*/
|
2007-10-28 23:38:43 +00:00
|
|
|
tcpd->acked_table=se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "tcp_analyze_acked_table");
|
|
|
|
tcpd->ts_first.secs=pinfo->fd->abs_ts.secs;
|
|
|
|
tcpd->ts_first.nsecs=pinfo->fd->abs_ts.nsecs;
|
|
|
|
tcpd->ts_prev.secs=pinfo->fd->abs_ts.secs;
|
|
|
|
tcpd->ts_prev.nsecs=pinfo->fd->abs_ts.nsecs;
|
2003-04-23 10:20:29 +00:00
|
|
|
|
2008-12-09 17:50:02 +00:00
|
|
|
return tcpd;
|
2008-04-05 20:01:09 +00:00
|
|
|
}
|
2006-03-20 10:52:53 +00:00
|
|
|
|
2008-09-30 12:24:27 +00:00
|
|
|
conversation_t *
|
|
|
|
get_tcp_conversation(packet_info *pinfo)
|
2008-04-05 20:01:09 +00:00
|
|
|
{
|
|
|
|
conversation_t *conv=NULL;
|
|
|
|
|
2008-09-30 12:24:27 +00:00
|
|
|
/* Have we seen this conversation before? */
|
|
|
|
if( (conv=find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0)) == NULL){
|
|
|
|
/* No this is a new conversation. */
|
|
|
|
conv=conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
|
2007-10-28 23:38:43 +00:00
|
|
|
}
|
2008-09-30 12:24:27 +00:00
|
|
|
return conv;
|
2007-10-28 23:38:43 +00:00
|
|
|
}
|
2003-04-23 10:20:29 +00:00
|
|
|
|
2007-10-28 23:38:43 +00:00
|
|
|
struct tcp_analysis *
|
2008-09-30 12:24:27 +00:00
|
|
|
get_tcp_conversation_data(conversation_t *conv, packet_info *pinfo)
|
2007-10-28 23:38:43 +00:00
|
|
|
{
|
|
|
|
int direction;
|
2009-10-25 11:43:30 +00:00
|
|
|
struct tcp_analysis *tcpd;
|
2007-10-28 23:38:43 +00:00
|
|
|
|
2008-09-30 12:24:27 +00:00
|
|
|
/* Did the caller supply the conversation pointer? */
|
|
|
|
if( conv==NULL )
|
|
|
|
conv = get_tcp_conversation(pinfo);
|
|
|
|
|
|
|
|
/* Get the data for this conversation */
|
|
|
|
tcpd=conversation_get_proto_data(conv, proto_tcp);
|
|
|
|
|
|
|
|
/* If the conversation was just created or it matched a
|
2008-12-09 17:50:02 +00:00
|
|
|
* conversation with template options, tcpd will not
|
2008-09-30 12:24:27 +00:00
|
|
|
* have been initialized. So, initialize
|
|
|
|
* a new tcpd structure for the conversation.
|
|
|
|
*/
|
|
|
|
if (!tcpd) {
|
|
|
|
tcpd = init_tcp_conversation_data(pinfo);
|
|
|
|
conversation_add_proto_data(conv, proto_tcp, tcpd);
|
2007-10-28 23:38:43 +00:00
|
|
|
}
|
2006-01-26 22:50:16 +00:00
|
|
|
|
2007-10-30 22:22:14 +00:00
|
|
|
if (!tcpd) {
|
2008-08-12 21:08:46 +00:00
|
|
|
return NULL;
|
2007-10-30 22:22:14 +00:00
|
|
|
}
|
|
|
|
|
2006-01-26 22:50:16 +00:00
|
|
|
/* check direction and get ua lists */
|
|
|
|
direction=CMP_ADDRESS(&pinfo->src, &pinfo->dst);
|
|
|
|
/* if the addresses are equal, match the ports instead */
|
|
|
|
if(direction==0) {
|
2008-08-13 21:44:53 +00:00
|
|
|
direction= (pinfo->srcport > pinfo->destport) ? 1 : -1;
|
2006-01-26 22:50:16 +00:00
|
|
|
}
|
|
|
|
if(direction>=0){
|
|
|
|
tcpd->fwd=&(tcpd->flow1);
|
|
|
|
tcpd->rev=&(tcpd->flow2);
|
|
|
|
} else {
|
|
|
|
tcpd->fwd=&(tcpd->flow2);
|
|
|
|
tcpd->rev=&(tcpd->flow1);
|
|
|
|
}
|
|
|
|
|
2006-03-02 09:33:49 +00:00
|
|
|
tcpd->ta=NULL;
|
2003-04-23 10:20:29 +00:00
|
|
|
return tcpd;
|
|
|
|
}
|
|
|
|
|
2009-05-14 23:33:17 +00:00
|
|
|
/* Attach process info to a flow */
|
|
|
|
/* XXX - We depend on the TCP dissector finding the conversation first */
|
|
|
|
void
|
|
|
|
add_tcp_process_info(guint32 frame_num, address *local_addr, address *remote_addr, guint16 local_port, guint16 remote_port, guint32 uid, guint32 pid, gchar *username, gchar *command) {
|
|
|
|
conversation_t *conv;
|
|
|
|
struct tcp_analysis *tcpd;
|
|
|
|
tcp_flow_t *flow = NULL;
|
|
|
|
|
|
|
|
conv = find_conversation(frame_num, local_addr, remote_addr, PT_TCP, local_port, remote_port, 0);
|
|
|
|
if (!conv) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
tcpd = conversation_get_proto_data(conv, proto_tcp);
|
|
|
|
if (!tcpd) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (CMP_ADDRESS(local_addr, &conv->key_ptr->addr1) == 0 && local_port == conv->key_ptr->port1) {
|
|
|
|
flow = &tcpd->flow1;
|
|
|
|
} else if (CMP_ADDRESS(remote_addr, &conv->key_ptr->addr1) == 0 && remote_port == conv->key_ptr->port1) {
|
|
|
|
flow = &tcpd->flow2;
|
|
|
|
}
|
|
|
|
if (!flow || flow->command) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
flow->process_uid = uid;
|
|
|
|
flow->process_pid = pid;
|
|
|
|
flow->username = se_strdup(username);
|
|
|
|
flow->command = se_strdup(command);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-25 20:37:13 +00:00
|
|
|
/* Calculate the timestamps relative to this conversation */
|
|
|
|
static void
|
|
|
|
tcp_calculate_timestamps(packet_info *pinfo, struct tcp_analysis *tcpd,
|
|
|
|
struct tcp_per_packet_data_t *tcppd)
|
|
|
|
{
|
|
|
|
if( !tcppd ) {
|
|
|
|
tcppd = se_alloc(sizeof(struct tcp_per_packet_data_t));
|
|
|
|
p_add_proto_data(pinfo->fd, proto_tcp, tcppd);
|
|
|
|
}
|
2007-10-30 22:22:14 +00:00
|
|
|
|
2007-11-08 00:58:38 +00:00
|
|
|
if (!tcpd)
|
|
|
|
return;
|
|
|
|
|
2007-09-25 20:37:13 +00:00
|
|
|
nstime_delta(&tcppd->ts_del, &pinfo->fd->abs_ts, &tcpd->ts_prev);
|
2007-10-30 22:22:14 +00:00
|
|
|
|
2007-09-25 20:37:13 +00:00
|
|
|
tcpd->ts_prev.secs=pinfo->fd->abs_ts.secs;
|
|
|
|
tcpd->ts_prev.nsecs=pinfo->fd->abs_ts.nsecs;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Add a subtree with the timestamps relative to this conversation */
|
|
|
|
static void
|
|
|
|
tcp_print_timestamps(packet_info *pinfo, tvbuff_t *tvb, proto_tree *parent_tree, struct tcp_analysis *tcpd, struct tcp_per_packet_data_t *tcppd)
|
|
|
|
{
|
|
|
|
proto_item *item;
|
|
|
|
proto_tree *tree;
|
|
|
|
nstime_t ts;
|
2007-10-30 22:22:14 +00:00
|
|
|
|
2007-11-08 00:58:38 +00:00
|
|
|
if (!tcpd)
|
|
|
|
return;
|
|
|
|
|
2007-09-25 20:37:13 +00:00
|
|
|
item=proto_tree_add_text(parent_tree, tvb, 0, 0, "Timestamps");
|
|
|
|
PROTO_ITEM_SET_GENERATED(item);
|
|
|
|
tree=proto_item_add_subtree(item, ett_tcp_timestamps);
|
|
|
|
|
|
|
|
nstime_delta(&ts, &pinfo->fd->abs_ts, &tcpd->ts_first);
|
|
|
|
item = proto_tree_add_time(tree, hf_tcp_ts_relative, tvb, 0, 0, &ts);
|
|
|
|
PROTO_ITEM_SET_GENERATED(item);
|
|
|
|
|
2007-10-30 22:22:14 +00:00
|
|
|
if( !tcppd )
|
2007-09-25 20:37:13 +00:00
|
|
|
tcppd = p_get_proto_data(pinfo->fd, proto_tcp);
|
|
|
|
|
|
|
|
if( tcppd ) {
|
|
|
|
item = proto_tree_add_time(tree, hf_tcp_ts_delta, tvb, 0, 0,
|
|
|
|
&tcppd->ts_del);
|
|
|
|
PROTO_ITEM_SET_GENERATED(item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-04-23 10:20:29 +00:00
|
|
|
static void
|
2006-04-28 09:44:02 +00:00
|
|
|
print_pdu_tracking_data(packet_info *pinfo, tvbuff_t *tvb, proto_tree *tcp_tree, struct tcp_multisegment_pdu *msp)
|
2004-11-12 22:04:19 +00:00
|
|
|
{
|
|
|
|
proto_item *item;
|
|
|
|
|
2010-01-15 07:32:04 +00:00
|
|
|
col_prepend_fence_fstr(pinfo->cinfo, COL_INFO, "[Continuation to #%u] ", msp->first_frame);
|
2004-11-12 22:04:19 +00:00
|
|
|
item=proto_tree_add_uint(tcp_tree, hf_tcp_continuation_to,
|
2006-04-28 09:44:02 +00:00
|
|
|
tvb, 0, 0, msp->first_frame);
|
2004-11-12 22:04:19 +00:00
|
|
|
PROTO_ITEM_SET_GENERATED(item);
|
|
|
|
}
|
|
|
|
|
2006-01-30 23:29:09 +00:00
|
|
|
/* if we know that a PDU starts inside this segment, return the adjusted
|
2003-04-23 10:20:29 +00:00
|
|
|
offset to where that PDU starts or just return offset back
|
|
|
|
and let TCP try to find out what it can about this segment
|
|
|
|
*/
|
|
|
|
static int
|
2007-04-06 07:01:01 +00:00
|
|
|
scan_for_next_pdu(tvbuff_t *tvb, proto_tree *tcp_tree, packet_info *pinfo, int offset, guint32 seq, guint32 nxtseq, emem_tree_t *multisegment_pdus)
|
2003-04-23 10:20:29 +00:00
|
|
|
{
|
2006-04-28 09:44:02 +00:00
|
|
|
struct tcp_multisegment_pdu *msp=NULL;
|
2003-04-23 10:20:29 +00:00
|
|
|
|
|
|
|
if(!pinfo->fd->flags.visited){
|
2007-04-06 07:01:01 +00:00
|
|
|
msp=se_tree_lookup32_le(multisegment_pdus, seq-1);
|
2006-04-28 09:44:02 +00:00
|
|
|
if(msp){
|
2006-11-11 22:39:25 +00:00
|
|
|
/* If this is a continuation of a PDU started in a
|
|
|
|
* previous segment we need to update the last_frame
|
|
|
|
* variables.
|
|
|
|
*/
|
|
|
|
if(seq>msp->seq && seq<msp->nxtpdu){
|
|
|
|
msp->last_frame=pinfo->fd->num;
|
|
|
|
msp->last_frame_time=pinfo->fd->abs_ts;
|
|
|
|
print_pdu_tracking_data(pinfo, tvb, tcp_tree, msp);
|
|
|
|
}
|
|
|
|
|
2004-03-19 06:14:03 +00:00
|
|
|
/* If this segment is completely within a previous PDU
|
|
|
|
* then we just skip this packet
|
|
|
|
*/
|
2006-04-28 09:44:02 +00:00
|
|
|
if(seq>msp->seq && nxtseq<=msp->nxtpdu){
|
2004-03-19 06:14:03 +00:00
|
|
|
return -1;
|
2006-01-30 23:29:09 +00:00
|
|
|
}
|
2006-04-28 09:44:02 +00:00
|
|
|
if(seq<msp->nxtpdu && nxtseq>msp->nxtpdu){
|
|
|
|
offset+=msp->nxtpdu-seq;
|
|
|
|
return offset;
|
2003-04-23 10:20:29 +00:00
|
|
|
}
|
2006-04-28 09:44:02 +00:00
|
|
|
|
2003-04-23 10:20:29 +00:00
|
|
|
}
|
|
|
|
} else {
|
2006-11-11 22:39:25 +00:00
|
|
|
/* First we try to find the start and transfer time for a PDU.
|
|
|
|
* We only print this for the very first segment of a PDU
|
|
|
|
* and only for PDUs spanning multiple segments.
|
|
|
|
* Se we look for if there was any multisegment PDU started
|
|
|
|
* just BEFORE the end of this segment. I.e. either inside this
|
|
|
|
* segment or in a previous segment.
|
2007-10-30 22:22:14 +00:00
|
|
|
* Since this might also match PDUs that are completely within
|
2006-11-11 22:39:25 +00:00
|
|
|
* this segment we also verify that the found PDU does span
|
|
|
|
* beyond the end of this segment.
|
|
|
|
*/
|
2007-04-06 07:01:01 +00:00
|
|
|
msp=se_tree_lookup32_le(multisegment_pdus, nxtseq-1);
|
2006-04-28 09:44:02 +00:00
|
|
|
if(msp){
|
2006-11-11 22:39:25 +00:00
|
|
|
if( (pinfo->fd->num==msp->first_frame)
|
|
|
|
){
|
2006-04-28 09:44:02 +00:00
|
|
|
proto_item *item;
|
|
|
|
nstime_t ns;
|
2004-11-12 22:04:19 +00:00
|
|
|
|
2006-04-28 09:44:02 +00:00
|
|
|
item=proto_tree_add_uint(tcp_tree, hf_tcp_pdu_last_frame, tvb, 0, 0, msp->last_frame);
|
|
|
|
PROTO_ITEM_SET_GENERATED(item);
|
2004-11-12 22:04:19 +00:00
|
|
|
|
2006-04-28 09:44:02 +00:00
|
|
|
nstime_delta(&ns, &msp->last_frame_time, &pinfo->fd->abs_ts);
|
|
|
|
item = proto_tree_add_time(tcp_tree, hf_tcp_pdu_time,
|
|
|
|
tvb, 0, 0, &ns);
|
|
|
|
PROTO_ITEM_SET_GENERATED(item);
|
|
|
|
}
|
2006-11-11 22:39:25 +00:00
|
|
|
}
|
2004-11-12 22:04:19 +00:00
|
|
|
|
2006-11-11 22:39:25 +00:00
|
|
|
/* Second we check if this segment is part of a PDU started
|
|
|
|
* prior to the segment (seq-1)
|
|
|
|
*/
|
2007-04-06 07:01:01 +00:00
|
|
|
msp=se_tree_lookup32_le(multisegment_pdus, seq-1);
|
2006-11-11 22:39:25 +00:00
|
|
|
if(msp){
|
2006-04-28 09:44:02 +00:00
|
|
|
/* If this segment is completely within a previous PDU
|
|
|
|
* then we just skip this packet
|
|
|
|
*/
|
|
|
|
if(seq>msp->seq && nxtseq<=msp->nxtpdu){
|
|
|
|
print_pdu_tracking_data(pinfo, tvb, tcp_tree, msp);
|
|
|
|
return -1;
|
|
|
|
}
|
2003-04-23 10:20:29 +00:00
|
|
|
|
2006-04-28 09:44:02 +00:00
|
|
|
if(seq<msp->nxtpdu && nxtseq>msp->nxtpdu){
|
|
|
|
offset+=msp->nxtpdu-seq;
|
|
|
|
return offset;
|
|
|
|
}
|
2003-04-23 10:20:29 +00:00
|
|
|
}
|
2006-11-11 22:39:25 +00:00
|
|
|
|
2003-04-23 10:20:29 +00:00
|
|
|
}
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if we saw a PDU that extended beyond the end of the segment,
|
|
|
|
use this function to remember where the next pdu starts
|
|
|
|
*/
|
2007-04-06 07:01:01 +00:00
|
|
|
struct tcp_multisegment_pdu *
|
|
|
|
pdu_store_sequencenumber_of_next_pdu(packet_info *pinfo, guint32 seq, guint32 nxtpdu, emem_tree_t *multisegment_pdus)
|
2003-04-23 10:20:29 +00:00
|
|
|
{
|
2006-05-01 02:32:16 +00:00
|
|
|
struct tcp_multisegment_pdu *msp;
|
2006-04-28 09:44:02 +00:00
|
|
|
|
|
|
|
msp=se_alloc(sizeof(struct tcp_multisegment_pdu));
|
|
|
|
msp->nxtpdu=nxtpdu;
|
|
|
|
msp->seq=seq;
|
|
|
|
msp->first_frame=pinfo->fd->num;
|
|
|
|
msp->last_frame=pinfo->fd->num;
|
|
|
|
msp->last_frame_time=pinfo->fd->abs_ts;
|
2006-11-07 13:19:31 +00:00
|
|
|
msp->flags=0;
|
2007-04-06 07:01:01 +00:00
|
|
|
se_tree_insert32(multisegment_pdus, seq, (void *)msp);
|
2006-05-01 02:32:16 +00:00
|
|
|
return msp;
|
2003-04-23 10:20:29 +00:00
|
|
|
}
|
2002-08-02 22:41:56 +00:00
|
|
|
|
2004-08-26 10:03:40 +00:00
|
|
|
/* This is called for SYN+ACK packets and the purpose is to verify that we
|
|
|
|
* have seen window scaling in both directions.
|
|
|
|
* If we cant find window scaling being set in both directions
|
|
|
|
* that means it was present in the SYN but not in the SYN+ACK
|
|
|
|
* (or the SYN was missing) and then we disable the window scaling
|
|
|
|
* for this tcp session.
|
|
|
|
*/
|
2006-01-30 23:29:09 +00:00
|
|
|
static void
|
2006-01-26 22:50:16 +00:00
|
|
|
verify_tcp_window_scaling(struct tcp_analysis *tcpd)
|
2004-08-26 10:03:40 +00:00
|
|
|
{
|
2006-01-30 23:29:09 +00:00
|
|
|
if( tcpd && ((tcpd->flow1.win_scale==-1) || (tcpd->flow2.win_scale==-1)) ){
|
2006-01-26 22:50:16 +00:00
|
|
|
tcpd->flow1.win_scale=-1;
|
|
|
|
tcpd->flow2.win_scale=-1;
|
2004-08-26 10:03:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-30 23:29:09 +00:00
|
|
|
/* if we saw a window scaling option, store it for future reference
|
2003-09-12 05:52:38 +00:00
|
|
|
*/
|
2006-01-30 23:29:09 +00:00
|
|
|
static void
|
2006-01-26 22:50:16 +00:00
|
|
|
pdu_store_window_scale_option(guint8 ws, struct tcp_analysis *tcpd)
|
2003-09-12 05:52:38 +00:00
|
|
|
{
|
2007-11-08 00:58:38 +00:00
|
|
|
if (tcpd)
|
|
|
|
tcpd->fwd->win_scale=ws;
|
2003-09-12 05:52:38 +00:00
|
|
|
}
|
|
|
|
|
2002-08-02 22:41:56 +00:00
|
|
|
static void
|
2006-01-26 22:50:16 +00:00
|
|
|
tcp_get_relative_seq_ack(guint32 *seq, guint32 *ack, guint32 *win, struct tcp_analysis *tcpd)
|
2002-08-02 22:41:56 +00:00
|
|
|
{
|
2007-10-30 22:22:14 +00:00
|
|
|
if (tcpd && tcp_relative_seq) {
|
2006-01-26 22:50:16 +00:00
|
|
|
(*seq) -= tcpd->fwd->base_seq;
|
|
|
|
(*ack) -= tcpd->rev->base_seq;
|
|
|
|
if(tcpd->fwd->win_scale!=-1){
|
|
|
|
(*win)<<=tcpd->fwd->win_scale;
|
|
|
|
}
|
2003-09-12 05:52:38 +00:00
|
|
|
}
|
2002-08-02 22:41:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-03-02 09:33:49 +00:00
|
|
|
/* when this function returns, it will (if createflag) populate the ta pointer.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
tcp_analyze_get_acked_struct(guint32 frame, gboolean createflag, struct tcp_analysis *tcpd)
|
|
|
|
{
|
2007-11-08 00:58:38 +00:00
|
|
|
if (!tcpd)
|
|
|
|
return;
|
|
|
|
|
2006-03-20 10:52:53 +00:00
|
|
|
tcpd->ta=se_tree_lookup32(tcpd->acked_table, frame);
|
2006-03-02 09:33:49 +00:00
|
|
|
if((!tcpd->ta) && createflag){
|
2008-11-04 08:31:23 +00:00
|
|
|
tcpd->ta=se_alloc0(sizeof(struct tcp_acked));
|
2006-03-20 10:52:53 +00:00
|
|
|
se_tree_insert32(tcpd->acked_table, frame, (void *)tcpd->ta);
|
2002-08-02 22:41:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-26 22:50:16 +00:00
|
|
|
|
|
|
|
/* fwd contains a list of all segments processed but not yet ACKed in the
|
|
|
|
* same direction as the current segment.
|
|
|
|
* rev contains a list of all segments received but not yet ACKed in the
|
|
|
|
* opposite direction to the current segment.
|
|
|
|
*
|
|
|
|
* New segments are always added to the head of the fwd/rev lists.
|
|
|
|
*
|
|
|
|
*/
|
2002-08-02 22:41:56 +00:00
|
|
|
static void
|
2006-01-26 22:50:16 +00:00
|
|
|
tcp_analyze_sequence_number(packet_info *pinfo, guint32 seq, guint32 ack, guint32 seglen, guint8 flags, guint32 window, struct tcp_analysis *tcpd)
|
2002-08-02 22:41:56 +00:00
|
|
|
{
|
2005-08-26 23:05:38 +00:00
|
|
|
tcp_unacked_t *ual=NULL;
|
2010-01-15 07:20:25 +00:00
|
|
|
tcp_unacked_t *prevual=NULL;
|
2010-01-15 07:07:28 +00:00
|
|
|
guint32 nextseq;
|
2006-01-26 22:50:16 +00:00
|
|
|
int ackcount;
|
2002-08-02 22:41:56 +00:00
|
|
|
|
2006-01-26 22:50:16 +00:00
|
|
|
#ifdef REMOVED
|
2007-04-16 04:52:51 +00:00
|
|
|
printf("analyze_sequence numbers frame:%u direction:%s\n",pinfo->fd->num,direction>=0?"FWD":"REW");
|
2006-01-26 22:50:16 +00:00
|
|
|
printf("FWD list lastflags:0x%04x base_seq:0x%08x:\n",tcpd->fwd->lastsegmentflags,tcpd->fwd->base_seq);for(ual=tcpd->fwd->segments;ual;ual=ual->next)printf("Frame:%d Seq:%d Nextseq:%d\n",ual->frame,ual->seq,ual->nextseq);
|
|
|
|
printf("REV list lastflags:0x%04x base_seq:0x%08x:\n",tcpd->rev->lastsegmentflags,tcpd->rev->base_seq);for(ual=tcpd->rev->segments;ual;ual=ual->next)printf("Frame:%d Seq:%d Nextseq:%d\n",ual->frame,ual->seq,ual->nextseq);
|
|
|
|
#endif
|
|
|
|
|
2007-10-30 22:22:14 +00:00
|
|
|
if (!tcpd) {
|
|
|
|
return;
|
|
|
|
}
|
2006-01-26 22:50:16 +00:00
|
|
|
|
2006-01-30 23:29:09 +00:00
|
|
|
/* if this is the first segment for this list we need to store the
|
2006-01-26 22:50:16 +00:00
|
|
|
* base_seq
|
2007-10-17 07:14:56 +00:00
|
|
|
*
|
|
|
|
* Start relative seq and ack numbers at 1 if this
|
2007-10-30 22:22:14 +00:00
|
|
|
* is not a SYN packet. This makes the relative
|
2007-10-17 07:14:56 +00:00
|
|
|
* seq/ack numbers to be displayed correctly in the
|
|
|
|
* event that the SYN or SYN/ACK packet is not seen
|
|
|
|
* (this solves bug 1542)
|
2006-01-26 22:50:16 +00:00
|
|
|
*/
|
|
|
|
if(tcpd->fwd->base_seq==0){
|
2007-10-17 07:14:56 +00:00
|
|
|
tcpd->fwd->base_seq = (flags & TH_SYN) ? seq : seq-1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Only store reverse sequence if this isn't the SYN
|
|
|
|
* There's no guarantee that the ACK field of a SYN
|
|
|
|
* contains zeros; get the ISN from the first segment
|
|
|
|
* with the ACK bit set instead (usually the SYN/ACK).
|
|
|
|
*/
|
|
|
|
if( (tcpd->rev->base_seq==0) && (flags & TH_ACK) ){
|
|
|
|
tcpd->rev->base_seq = (flags & TH_SYN) ? ack : ack-1;
|
2002-08-02 22:41:56 +00:00
|
|
|
}
|
|
|
|
|
2006-01-26 22:50:16 +00:00
|
|
|
|
|
|
|
/* ZERO WINDOW PROBE
|
|
|
|
* it is a zero window probe if
|
|
|
|
* the sequnece number is the next expected one
|
|
|
|
* the window in the other direction is 0
|
|
|
|
* the segment is exactly 1 byte
|
|
|
|
*/
|
|
|
|
/*QQQ tested*/
|
|
|
|
if( seglen==1
|
|
|
|
&& seq==tcpd->fwd->nextseq
|
|
|
|
&& tcpd->rev->window==0 ){
|
2006-03-02 09:33:49 +00:00
|
|
|
if(!tcpd->ta){
|
|
|
|
tcp_analyze_get_acked_struct(pinfo->fd->num, TRUE, tcpd);
|
2003-10-25 00:25:38 +00:00
|
|
|
}
|
2006-03-02 09:33:49 +00:00
|
|
|
tcpd->ta->flags|=TCP_A_ZERO_WINDOW_PROBE;
|
2006-01-26 22:50:16 +00:00
|
|
|
goto finished_fwd;
|
2003-10-25 00:25:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-01-30 23:29:09 +00:00
|
|
|
/* ZERO WINDOW
|
2006-01-26 22:50:16 +00:00
|
|
|
* a zero window packet has window == 0 but none of the SYN/FIN/RST set
|
|
|
|
*/
|
|
|
|
/*QQQ tested*/
|
2006-01-30 23:29:09 +00:00
|
|
|
if( window==0
|
2006-01-26 22:50:16 +00:00
|
|
|
&& (flags&(TH_RST|TH_FIN|TH_SYN))==0 ){
|
2006-03-02 09:33:49 +00:00
|
|
|
if(!tcpd->ta){
|
|
|
|
tcp_analyze_get_acked_struct(pinfo->fd->num, TRUE, tcpd);
|
2006-01-26 22:50:16 +00:00
|
|
|
}
|
2006-03-02 09:33:49 +00:00
|
|
|
tcpd->ta->flags|=TCP_A_ZERO_WINDOW;
|
2003-03-26 08:00:24 +00:00
|
|
|
}
|
|
|
|
|
2006-01-26 22:50:16 +00:00
|
|
|
|
2007-10-28 23:38:43 +00:00
|
|
|
/* LOST PACKET
|
2006-01-26 22:50:16 +00:00
|
|
|
* If this segment is beyond the last seen nextseq we must
|
|
|
|
* have missed some previous segment
|
2006-01-30 23:29:09 +00:00
|
|
|
*
|
2006-01-26 22:50:16 +00:00
|
|
|
* We only check for this if we have actually seen segments prior to this
|
|
|
|
* one.
|
2006-02-10 22:24:21 +00:00
|
|
|
* RST packets are not checked for this.
|
2006-01-26 22:50:16 +00:00
|
|
|
*/
|
|
|
|
if( tcpd->fwd->nextseq
|
2006-02-10 22:24:21 +00:00
|
|
|
&& GT_SEQ(seq, tcpd->fwd->nextseq)
|
|
|
|
&& (flags&(TH_RST))==0 ){
|
2006-03-02 09:33:49 +00:00
|
|
|
if(!tcpd->ta){
|
|
|
|
tcp_analyze_get_acked_struct(pinfo->fd->num, TRUE, tcpd);
|
2002-08-02 22:41:56 +00:00
|
|
|
}
|
2007-10-28 23:38:43 +00:00
|
|
|
tcpd->ta->flags|=TCP_A_LOST_PACKET;
|
2006-01-26 22:50:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* KEEP ALIVE
|
|
|
|
* a keepalive contains 0 or 1 bytes of data and starts one byte prior
|
|
|
|
* to what should be the next sequence number.
|
|
|
|
* SYN/FIN/RST segments are never keepalives
|
|
|
|
*/
|
|
|
|
/*QQQ tested */
|
|
|
|
if( (seglen==0||seglen==1)
|
|
|
|
&& seq==(tcpd->fwd->nextseq-1)
|
|
|
|
&& (flags&(TH_SYN|TH_FIN|TH_RST))==0 ){
|
2006-03-02 09:33:49 +00:00
|
|
|
if(!tcpd->ta){
|
|
|
|
tcp_analyze_get_acked_struct(pinfo->fd->num, TRUE, tcpd);
|
2003-04-23 10:20:29 +00:00
|
|
|
}
|
2006-03-02 09:33:49 +00:00
|
|
|
tcpd->ta->flags|=TCP_A_KEEP_ALIVE;
|
2002-08-02 22:41:56 +00:00
|
|
|
}
|
|
|
|
|
2006-01-26 22:50:16 +00:00
|
|
|
/* WINDOW UPDATE
|
2006-01-30 23:29:09 +00:00
|
|
|
* A window update is a 0 byte segment with the same SEQ/ACK numbers as
|
2006-01-26 22:50:16 +00:00
|
|
|
* the previous seen segment and with a new window value
|
|
|
|
*/
|
2006-01-30 23:29:09 +00:00
|
|
|
if( seglen==0
|
2006-01-26 22:50:16 +00:00
|
|
|
&& window
|
|
|
|
&& window!=tcpd->fwd->window
|
|
|
|
&& seq==tcpd->fwd->nextseq
|
|
|
|
&& ack==tcpd->fwd->lastack
|
|
|
|
&& (flags&(TH_SYN|TH_FIN|TH_RST))==0 ){
|
2006-03-02 09:33:49 +00:00
|
|
|
if(!tcpd->ta){
|
|
|
|
tcp_analyze_get_acked_struct(pinfo->fd->num, TRUE, tcpd);
|
2003-04-23 10:20:29 +00:00
|
|
|
}
|
2006-03-02 09:33:49 +00:00
|
|
|
tcpd->ta->flags|=TCP_A_WINDOW_UPDATE;
|
2002-08-02 22:41:56 +00:00
|
|
|
}
|
2006-01-30 23:29:09 +00:00
|
|
|
|
2002-08-02 22:41:56 +00:00
|
|
|
|
2006-01-26 22:50:16 +00:00
|
|
|
/* WINDOW FULL
|
|
|
|
* If we know the window scaling
|
|
|
|
* and if this segment contains data ang goes all the way to the
|
|
|
|
* edge of the advertized window
|
|
|
|
* then we mark it as WINDOW FULL
|
|
|
|
* SYN/RST/FIN packets are never WINDOW FULL
|
|
|
|
*/
|
|
|
|
/*QQQ tested*/
|
|
|
|
if( seglen>0
|
|
|
|
&& tcpd->fwd->win_scale!=-1
|
|
|
|
&& tcpd->rev->win_scale!=-1
|
|
|
|
&& (seq+seglen)==(tcpd->rev->lastack+(tcpd->rev->window<<tcpd->rev->win_scale))
|
|
|
|
&& (flags&(TH_SYN|TH_FIN|TH_RST))==0 ){
|
2006-03-02 09:33:49 +00:00
|
|
|
if(!tcpd->ta){
|
|
|
|
tcp_analyze_get_acked_struct(pinfo->fd->num, TRUE, tcpd);
|
2006-01-26 22:50:16 +00:00
|
|
|
}
|
2006-03-02 09:33:49 +00:00
|
|
|
tcpd->ta->flags|=TCP_A_WINDOW_FULL;
|
2006-01-26 22:50:16 +00:00
|
|
|
}
|
2002-08-02 22:41:56 +00:00
|
|
|
|
2002-08-16 20:59:18 +00:00
|
|
|
|
2006-01-26 22:50:16 +00:00
|
|
|
/* KEEP ALIVE ACK
|
|
|
|
* It is a keepalive ack if it repeats the previous ACK and if
|
|
|
|
* the last segment in the reverse direction was a keepalive
|
|
|
|
*/
|
|
|
|
/*QQQ tested*/
|
2006-01-30 23:29:09 +00:00
|
|
|
if( seglen==0
|
2006-01-26 22:50:16 +00:00
|
|
|
&& window
|
|
|
|
&& window==tcpd->fwd->window
|
|
|
|
&& seq==tcpd->fwd->nextseq
|
|
|
|
&& ack==tcpd->fwd->lastack
|
|
|
|
&& (tcpd->rev->lastsegmentflags&TCP_A_KEEP_ALIVE)
|
|
|
|
&& (flags&(TH_SYN|TH_FIN|TH_RST))==0 ){
|
2006-03-02 09:33:49 +00:00
|
|
|
if(!tcpd->ta){
|
|
|
|
tcp_analyze_get_acked_struct(pinfo->fd->num, TRUE, tcpd);
|
2006-01-26 22:50:16 +00:00
|
|
|
}
|
2006-03-02 09:33:49 +00:00
|
|
|
tcpd->ta->flags|=TCP_A_KEEP_ALIVE_ACK;
|
2006-01-26 22:50:16 +00:00
|
|
|
goto finished_fwd;
|
|
|
|
}
|
2002-08-02 22:41:56 +00:00
|
|
|
|
|
|
|
|
2006-01-26 22:50:16 +00:00
|
|
|
/* ZERO WINDOW PROBE ACK
|
|
|
|
* It is a zerowindowprobe ack if it repeats the previous ACK and if
|
|
|
|
* the last segment in the reverse direction was a zerowindowprobe
|
|
|
|
* It also repeats the previous zero window indication
|
|
|
|
*/
|
|
|
|
/*QQQ tested*/
|
2006-01-30 23:29:09 +00:00
|
|
|
if( seglen==0
|
2006-01-26 22:50:16 +00:00
|
|
|
&& window==0
|
|
|
|
&& window==tcpd->fwd->window
|
|
|
|
&& seq==tcpd->fwd->nextseq
|
|
|
|
&& ack==tcpd->fwd->lastack
|
|
|
|
&& (tcpd->rev->lastsegmentflags&TCP_A_ZERO_WINDOW_PROBE)
|
|
|
|
&& (flags&(TH_SYN|TH_FIN|TH_RST))==0 ){
|
2006-03-02 09:33:49 +00:00
|
|
|
if(!tcpd->ta){
|
|
|
|
tcp_analyze_get_acked_struct(pinfo->fd->num, TRUE, tcpd);
|
2006-01-26 22:50:16 +00:00
|
|
|
}
|
2006-03-02 09:33:49 +00:00
|
|
|
tcpd->ta->flags|=TCP_A_ZERO_WINDOW_PROBE_ACK;
|
2006-01-26 22:50:16 +00:00
|
|
|
goto finished_fwd;
|
2002-08-02 22:41:56 +00:00
|
|
|
}
|
|
|
|
|
2006-01-26 22:50:16 +00:00
|
|
|
|
|
|
|
/* DUPLICATE ACK
|
|
|
|
* It is a duplicate ack if window/seq/ack is the same as the previous
|
|
|
|
* segment and if the segment length is 0
|
2002-08-02 22:41:56 +00:00
|
|
|
*/
|
2006-01-30 23:29:09 +00:00
|
|
|
if( seglen==0
|
2006-01-26 22:50:16 +00:00
|
|
|
&& window
|
|
|
|
&& window==tcpd->fwd->window
|
|
|
|
&& seq==tcpd->fwd->nextseq
|
|
|
|
&& ack==tcpd->fwd->lastack
|
|
|
|
&& (flags&(TH_SYN|TH_FIN|TH_RST))==0 ){
|
|
|
|
tcpd->fwd->dupacknum++;
|
2006-03-02 09:33:49 +00:00
|
|
|
if(!tcpd->ta){
|
|
|
|
tcp_analyze_get_acked_struct(pinfo->fd->num, TRUE, tcpd);
|
2003-08-29 11:15:13 +00:00
|
|
|
}
|
2006-03-02 09:33:49 +00:00
|
|
|
tcpd->ta->flags|=TCP_A_DUPLICATE_ACK;
|
|
|
|
tcpd->ta->dupack_num=tcpd->fwd->dupacknum;
|
|
|
|
tcpd->ta->dupack_frame=tcpd->fwd->lastnondupack;
|
2002-08-02 22:41:56 +00:00
|
|
|
}
|
|
|
|
|
2006-01-26 22:50:16 +00:00
|
|
|
|
2008-08-25 02:15:36 +00:00
|
|
|
|
2006-01-26 22:50:16 +00:00
|
|
|
finished_fwd:
|
2006-08-16 20:52:51 +00:00
|
|
|
/* If this was NOT a dupack we must reset the dupack counters */
|
2006-03-02 09:33:49 +00:00
|
|
|
if( (!tcpd->ta) || !(tcpd->ta->flags&TCP_A_DUPLICATE_ACK) ){
|
2006-01-26 22:50:16 +00:00
|
|
|
tcpd->fwd->lastnondupack=pinfo->fd->num;
|
|
|
|
tcpd->fwd->dupacknum=0;
|
2002-08-02 22:41:56 +00:00
|
|
|
}
|
|
|
|
|
2006-01-26 22:50:16 +00:00
|
|
|
|
|
|
|
/* ACKED LOST PACKET
|
|
|
|
* If this segment acks beyond the nextseqnum in the other direction
|
|
|
|
* then that means we have missed packets going in the
|
|
|
|
* other direction
|
|
|
|
*
|
|
|
|
* We only check this if we have actually seen some seq numbers
|
|
|
|
* in the other direction.
|
2003-10-25 00:25:38 +00:00
|
|
|
*/
|
2006-01-26 22:50:16 +00:00
|
|
|
if( tcpd->rev->nextseq
|
2006-08-16 20:52:51 +00:00
|
|
|
&& GT_SEQ(ack, tcpd->rev->nextseq )
|
|
|
|
&& (flags&(TH_ACK))!=0 ){
|
2006-01-26 22:50:16 +00:00
|
|
|
/*QQQ tested*/
|
2006-03-02 09:33:49 +00:00
|
|
|
if(!tcpd->ta){
|
|
|
|
tcp_analyze_get_acked_struct(pinfo->fd->num, TRUE, tcpd);
|
2006-01-26 22:50:16 +00:00
|
|
|
}
|
2006-03-02 09:33:49 +00:00
|
|
|
tcpd->ta->flags|=TCP_A_ACK_LOST_PACKET;
|
2006-01-26 22:50:16 +00:00
|
|
|
/* update nextseq in the other direction so we dont get
|
|
|
|
* this indication again.
|
2003-10-25 00:25:38 +00:00
|
|
|
*/
|
2006-01-26 22:50:16 +00:00
|
|
|
tcpd->rev->nextseq=ack;
|
|
|
|
}
|
2002-08-02 22:41:56 +00:00
|
|
|
|
2003-10-25 00:25:38 +00:00
|
|
|
|
2006-01-26 22:50:16 +00:00
|
|
|
/* RETRANSMISSION/FAST RETRANSMISSION/OUT-OF-ORDER
|
|
|
|
* If the segments contains data and if it does not advance
|
|
|
|
* sequence number it must be either of these three.
|
2006-01-30 23:29:09 +00:00
|
|
|
* Only test for this if we know what the seq number should be
|
2006-01-26 22:50:16 +00:00
|
|
|
* (tcpd->fwd->nextseq)
|
|
|
|
*
|
|
|
|
* Note that a simple KeepAlive is not a retransmission
|
|
|
|
*/
|
|
|
|
if( seglen>0
|
|
|
|
&& tcpd->fwd->nextseq
|
|
|
|
&& (LT_SEQ(seq, tcpd->fwd->nextseq)) ){
|
2007-08-23 21:38:15 +00:00
|
|
|
guint64 t;
|
2006-01-26 22:50:16 +00:00
|
|
|
|
2006-03-02 09:33:49 +00:00
|
|
|
if(tcpd->ta && (tcpd->ta->flags&TCP_A_KEEP_ALIVE) ){
|
2006-01-26 22:50:16 +00:00
|
|
|
goto finished_checking_retransmission_type;
|
2003-10-25 00:25:38 +00:00
|
|
|
}
|
2002-08-02 22:41:56 +00:00
|
|
|
|
2006-05-31 11:15:45 +00:00
|
|
|
/* If there were >=2 duplicate ACKs in the reverse direction
|
2006-01-26 22:50:16 +00:00
|
|
|
* (there might be duplicate acks missing from the trace)
|
|
|
|
* and if this sequence number matches those ACKs
|
2006-01-30 23:29:09 +00:00
|
|
|
* and if the packet occurs within 20ms of the last
|
2006-01-26 22:50:16 +00:00
|
|
|
* duplicate ack
|
|
|
|
* then this is a fast retransmission
|
2002-08-02 22:41:56 +00:00
|
|
|
*/
|
2007-08-23 21:38:15 +00:00
|
|
|
t=(pinfo->fd->abs_ts.secs-tcpd->rev->lastacktime.secs)*1000000000;
|
2006-01-26 22:50:16 +00:00
|
|
|
t=t+(pinfo->fd->abs_ts.nsecs)-tcpd->rev->lastacktime.nsecs;
|
2006-05-31 11:15:45 +00:00
|
|
|
if( tcpd->rev->dupacknum>=2
|
2006-01-26 22:50:16 +00:00
|
|
|
&& tcpd->rev->lastack==seq
|
|
|
|
&& t<20000000 ){
|
2006-03-02 09:33:49 +00:00
|
|
|
if(!tcpd->ta){
|
|
|
|
tcp_analyze_get_acked_struct(pinfo->fd->num, TRUE, tcpd);
|
2003-10-25 00:25:38 +00:00
|
|
|
}
|
2006-03-02 09:33:49 +00:00
|
|
|
tcpd->ta->flags|=TCP_A_FAST_RETRANSMISSION;
|
2006-01-26 22:50:16 +00:00
|
|
|
goto finished_checking_retransmission_type;
|
2003-10-25 00:25:38 +00:00
|
|
|
}
|
|
|
|
|
2006-01-26 22:50:16 +00:00
|
|
|
/* If the segment came <3ms since the segment with the highest
|
|
|
|
* seen sequence number, then it is an OUT-OF-ORDER segment.
|
|
|
|
* (3ms is an arbitrary number)
|
|
|
|
*/
|
2007-08-23 21:38:15 +00:00
|
|
|
t=(pinfo->fd->abs_ts.secs-tcpd->fwd->nextseqtime.secs)*1000000000;
|
2006-01-26 22:50:16 +00:00
|
|
|
t=t+(pinfo->fd->abs_ts.nsecs)-tcpd->fwd->nextseqtime.nsecs;
|
2006-01-30 23:29:09 +00:00
|
|
|
if( t<3000000 ){
|
2006-03-02 09:33:49 +00:00
|
|
|
if(!tcpd->ta){
|
|
|
|
tcp_analyze_get_acked_struct(pinfo->fd->num, TRUE, tcpd);
|
2003-10-25 00:25:38 +00:00
|
|
|
}
|
2006-03-02 09:33:49 +00:00
|
|
|
tcpd->ta->flags|=TCP_A_OUT_OF_ORDER;
|
2006-01-26 22:50:16 +00:00
|
|
|
goto finished_checking_retransmission_type;
|
|
|
|
}
|
2003-10-25 00:25:38 +00:00
|
|
|
|
2006-01-26 22:50:16 +00:00
|
|
|
/* Then it has to be a generic retransmission */
|
2006-03-02 09:33:49 +00:00
|
|
|
if(!tcpd->ta){
|
|
|
|
tcp_analyze_get_acked_struct(pinfo->fd->num, TRUE, tcpd);
|
2002-08-02 22:41:56 +00:00
|
|
|
}
|
2006-03-02 09:33:49 +00:00
|
|
|
tcpd->ta->flags|=TCP_A_RETRANSMISSION;
|
|
|
|
nstime_delta(&tcpd->ta->rto_ts, &pinfo->fd->abs_ts, &tcpd->fwd->nextseqtime);
|
|
|
|
tcpd->ta->rto_frame=tcpd->fwd->nextseqframe;
|
2002-08-02 22:41:56 +00:00
|
|
|
}
|
2006-01-26 22:50:16 +00:00
|
|
|
finished_checking_retransmission_type:
|
|
|
|
|
2002-08-02 22:41:56 +00:00
|
|
|
|
2010-01-15 07:07:28 +00:00
|
|
|
nextseq = seq+seglen;
|
|
|
|
if (seglen || flags&(TH_SYN|TH_FIN)) {
|
|
|
|
/* add this new sequence number to the fwd list */
|
|
|
|
TCP_UNACKED_NEW(ual);
|
|
|
|
ual->next=tcpd->fwd->segments;
|
|
|
|
tcpd->fwd->segments=ual;
|
|
|
|
ual->frame=pinfo->fd->num;
|
|
|
|
ual->seq=seq;
|
|
|
|
ual->ts=pinfo->fd->abs_ts;
|
2004-12-19 07:18:04 +00:00
|
|
|
|
2010-01-15 07:07:28 +00:00
|
|
|
/* next sequence number is seglen bytes away, plus SYN/FIN which counts as one byte */
|
|
|
|
if( (flags&(TH_SYN|TH_FIN)) ){
|
|
|
|
nextseq+=1;
|
|
|
|
}
|
|
|
|
ual->nextseq=nextseq;
|
|
|
|
}
|
2002-08-02 22:41:56 +00:00
|
|
|
|
2006-01-30 23:29:09 +00:00
|
|
|
/* Store the highest number seen so far for nextseq so we can detect
|
2006-01-26 22:50:16 +00:00
|
|
|
* when we receive segments that arrive with a "hole"
|
2006-01-30 23:29:09 +00:00
|
|
|
* If we dont have anything since before, just store what we got.
|
2006-01-26 22:50:16 +00:00
|
|
|
* ZeroWindowProbes are special and dont really advance the nextseq
|
2002-08-02 22:41:56 +00:00
|
|
|
*/
|
2010-01-15 07:07:28 +00:00
|
|
|
if(GT_SEQ(nextseq, tcpd->fwd->nextseq) || !tcpd->fwd->nextseq) {
|
2006-03-02 09:33:49 +00:00
|
|
|
if( !tcpd->ta || !(tcpd->ta->flags&TCP_A_ZERO_WINDOW_PROBE) ){
|
2010-01-15 07:07:28 +00:00
|
|
|
tcpd->fwd->nextseq=nextseq;
|
2006-01-26 22:50:16 +00:00
|
|
|
tcpd->fwd->nextseqframe=pinfo->fd->num;
|
|
|
|
tcpd->fwd->nextseqtime.secs=pinfo->fd->abs_ts.secs;
|
|
|
|
tcpd->fwd->nextseqtime.nsecs=pinfo->fd->abs_ts.nsecs;
|
2002-08-02 22:41:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-01-26 22:50:16 +00:00
|
|
|
/* remember what the ack/window is so we can track window updates and retransmissions */
|
|
|
|
tcpd->fwd->window=window;
|
|
|
|
tcpd->fwd->lastack=ack;
|
|
|
|
tcpd->fwd->lastacktime.secs=pinfo->fd->abs_ts.secs;
|
|
|
|
tcpd->fwd->lastacktime.nsecs=pinfo->fd->abs_ts.nsecs;
|
2002-08-02 22:41:56 +00:00
|
|
|
|
|
|
|
|
2006-01-26 22:50:16 +00:00
|
|
|
/* if there were any flags set for this segment we need to remember them
|
|
|
|
* we only remember the flags for the very last segment though.
|
2002-08-02 22:41:56 +00:00
|
|
|
*/
|
2006-03-02 09:33:49 +00:00
|
|
|
if(tcpd->ta){
|
|
|
|
tcpd->fwd->lastsegmentflags=tcpd->ta->flags;
|
2006-01-26 22:50:16 +00:00
|
|
|
} else {
|
|
|
|
tcpd->fwd->lastsegmentflags=0;
|
2002-08-02 22:41:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-01-26 22:50:16 +00:00
|
|
|
/* remove all segments this ACKs and we dont need to keep around any more
|
2004-12-19 07:18:04 +00:00
|
|
|
*/
|
2006-01-26 22:50:16 +00:00
|
|
|
ackcount=0;
|
2010-01-15 07:20:25 +00:00
|
|
|
prevual = NULL;
|
|
|
|
ual = tcpd->rev->segments;
|
|
|
|
while(ual){
|
2006-01-26 22:50:16 +00:00
|
|
|
tcp_unacked_t *tmpual;
|
2010-01-15 07:20:25 +00:00
|
|
|
|
|
|
|
/* If this ack matches the segment, process accordingly */
|
2006-10-24 07:27:32 +00:00
|
|
|
if(ack==ual->nextseq){
|
|
|
|
tcp_analyze_get_acked_struct(pinfo->fd->num, TRUE, tcpd);
|
|
|
|
tcpd->ta->frame_acked=ual->frame;
|
|
|
|
nstime_delta(&tcpd->ta->ts, &pinfo->fd->abs_ts, &ual->ts);
|
|
|
|
}
|
2010-01-15 07:20:25 +00:00
|
|
|
/* If this acknowledges a segment prior to this one, leave this segment alone and move on */
|
|
|
|
else if (GT_SEQ(ual->nextseq,ack)){
|
|
|
|
prevual = ual;
|
|
|
|
ual = ual->next;
|
|
|
|
continue;
|
2006-01-26 22:50:16 +00:00
|
|
|
}
|
2010-01-15 07:20:25 +00:00
|
|
|
|
|
|
|
/* This segment is old, or an exact match. Delete the segment from the list */
|
2006-01-26 22:50:16 +00:00
|
|
|
ackcount++;
|
2010-01-15 07:20:25 +00:00
|
|
|
tmpual=ual->next;
|
2008-08-12 21:08:46 +00:00
|
|
|
|
|
|
|
if (tcpd->rev->scps_capable) {
|
2010-01-15 07:20:25 +00:00
|
|
|
/* Track largest segment successfully sent for SNACK analysis*/
|
|
|
|
if ((ual->nextseq - ual->seq) > tcpd->fwd->maxsizeacked){
|
2008-08-12 21:08:46 +00:00
|
|
|
tcpd->fwd->maxsizeacked = (ual->nextseq - ual->seq);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-01-15 07:20:25 +00:00
|
|
|
if (!prevual){
|
|
|
|
tcpd->rev->segments = tmpual;
|
|
|
|
TCP_UNACKED_FREE(ual);
|
|
|
|
ual = tmpual;
|
2002-11-01 11:05:37 +00:00
|
|
|
}
|
2010-01-15 07:20:25 +00:00
|
|
|
else{
|
|
|
|
prevual->next = tmpual;
|
|
|
|
TCP_UNACKED_FREE(ual);
|
|
|
|
ual = tmpual;
|
2008-08-12 21:08:46 +00:00
|
|
|
}
|
2002-11-01 11:05:37 +00:00
|
|
|
}
|
|
|
|
|
2008-08-25 02:15:36 +00:00
|
|
|
/* how many bytes of data are there in flight after this frame
|
|
|
|
* was sent
|
|
|
|
*/
|
|
|
|
ual=tcpd->fwd->segments;
|
|
|
|
if (tcp_track_bytes_in_flight && seglen!=0 && ual) {
|
|
|
|
guint32 first_seq, last_seq, in_flight;
|
|
|
|
|
|
|
|
first_seq = ual->seq - tcpd->fwd->base_seq;
|
|
|
|
last_seq = ual->nextseq - tcpd->fwd->base_seq;
|
|
|
|
while (ual) {
|
|
|
|
if ((ual->nextseq-tcpd->fwd->base_seq)>last_seq) {
|
|
|
|
last_seq = ual->nextseq-tcpd->fwd->base_seq;
|
|
|
|
}
|
|
|
|
if ((ual->seq-tcpd->fwd->base_seq)<first_seq) {
|
|
|
|
first_seq = ual->seq-tcpd->fwd->base_seq;
|
|
|
|
}
|
|
|
|
ual = ual->next;
|
|
|
|
}
|
|
|
|
in_flight = last_seq-first_seq;
|
|
|
|
|
|
|
|
if (in_flight>0 && in_flight<2000000000) {
|
|
|
|
if(!tcpd->ta){
|
|
|
|
tcp_analyze_get_acked_struct(pinfo->fd->num, TRUE, tcpd);
|
|
|
|
}
|
|
|
|
tcpd->ta->bytes_in_flight = in_flight;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-08-02 22:41:56 +00:00
|
|
|
}
|
|
|
|
|
2007-10-30 22:22:14 +00:00
|
|
|
/*
|
2007-04-01 16:04:04 +00:00
|
|
|
* Prints results of the sequence number analysis concerning tcp segments
|
2007-10-30 22:22:14 +00:00
|
|
|
* retransmitted or out-of-order
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
tcp_sequence_number_analysis_print_retransmission(packet_info * pinfo,
|
|
|
|
tvbuff_t * tvb,
|
|
|
|
proto_tree * flags_tree,
|
2007-04-01 16:04:04 +00:00
|
|
|
struct tcp_acked *ta
|
|
|
|
)
|
|
|
|
{
|
|
|
|
proto_item * flags_item;
|
|
|
|
|
|
|
|
/* TCP Rentransmission */
|
|
|
|
if (ta->flags & TCP_A_RETRANSMISSION) {
|
2007-10-30 22:22:14 +00:00
|
|
|
flags_item=proto_tree_add_none_format(flags_tree,
|
|
|
|
hf_tcp_analysis_retransmission,
|
|
|
|
tvb, 0, 0,
|
2007-04-01 16:04:04 +00:00
|
|
|
"This frame is a (suspected) "
|
|
|
|
"retransmission"
|
|
|
|
);
|
|
|
|
PROTO_ITEM_SET_GENERATED(flags_item);
|
2007-10-30 22:22:14 +00:00
|
|
|
expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_NOTE,
|
2007-04-01 16:04:04 +00:00
|
|
|
"Retransmission (suspected)");
|
|
|
|
|
2010-01-15 07:32:04 +00:00
|
|
|
col_prepend_fence_fstr(pinfo->cinfo, COL_INFO, "[TCP Retransmission] ");
|
|
|
|
|
|
|
|
if (ta->rto_ts.secs || ta->rto_ts.nsecs) {
|
2007-04-01 16:04:04 +00:00
|
|
|
flags_item = proto_tree_add_time(flags_tree, hf_tcp_analysis_rto,
|
|
|
|
tvb, 0, 0, &ta->rto_ts);
|
|
|
|
PROTO_ITEM_SET_GENERATED(flags_item);
|
|
|
|
flags_item=proto_tree_add_uint(flags_tree, hf_tcp_analysis_rto_frame,
|
|
|
|
tvb, 0, 0, ta->rto_frame);
|
|
|
|
PROTO_ITEM_SET_GENERATED(flags_item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* TCP Fast Rentransmission */
|
|
|
|
if (ta->flags & TCP_A_FAST_RETRANSMISSION) {
|
2007-10-30 22:22:14 +00:00
|
|
|
flags_item=proto_tree_add_none_format(flags_tree,
|
|
|
|
hf_tcp_analysis_fast_retransmission,
|
|
|
|
tvb, 0, 0,
|
|
|
|
"This frame is a (suspected) fast"
|
2007-04-01 16:04:04 +00:00
|
|
|
" retransmission"
|
|
|
|
);
|
|
|
|
PROTO_ITEM_SET_GENERATED(flags_item);
|
2007-10-30 22:22:14 +00:00
|
|
|
expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_WARN,
|
2007-04-01 16:04:04 +00:00
|
|
|
"Fast retransmission (suspected)");
|
2007-10-30 22:22:14 +00:00
|
|
|
flags_item=proto_tree_add_none_format(flags_tree,
|
|
|
|
hf_tcp_analysis_retransmission,
|
|
|
|
tvb, 0, 0,
|
2007-04-01 16:04:04 +00:00
|
|
|
"This frame is a (suspected) "
|
|
|
|
"retransmission"
|
|
|
|
);
|
|
|
|
PROTO_ITEM_SET_GENERATED(flags_item);
|
2010-01-15 07:32:04 +00:00
|
|
|
col_prepend_fence_fstr(pinfo->cinfo, COL_INFO,
|
|
|
|
"[TCP Fast Retransmission] ");
|
2007-04-01 16:04:04 +00:00
|
|
|
}
|
|
|
|
/* TCP Out-Of-Order */
|
|
|
|
if (ta->flags & TCP_A_OUT_OF_ORDER) {
|
2007-10-30 22:22:14 +00:00
|
|
|
flags_item=proto_tree_add_none_format(flags_tree,
|
|
|
|
hf_tcp_analysis_out_of_order,
|
|
|
|
tvb, 0, 0,
|
2007-04-01 16:04:04 +00:00
|
|
|
"This frame is a (suspected) "
|
|
|
|
"out-of-order segment"
|
|
|
|
);
|
|
|
|
PROTO_ITEM_SET_GENERATED(flags_item);
|
2007-10-30 22:22:14 +00:00
|
|
|
expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_WARN,
|
2007-04-01 16:04:04 +00:00
|
|
|
"Out-Of-Order segment");
|
2010-01-15 07:32:04 +00:00
|
|
|
col_prepend_fence_fstr(pinfo->cinfo, COL_INFO, "[TCP Out-Of-Order] ");
|
2007-04-01 16:04:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-10-30 22:22:14 +00:00
|
|
|
/* Prints results of the sequence number analysis concerning reused ports */
|
|
|
|
static void
|
|
|
|
tcp_sequence_number_analysis_print_reused(packet_info * pinfo,
|
|
|
|
tvbuff_t * tvb,
|
|
|
|
proto_tree * flags_tree,
|
2007-08-31 15:06:27 +00:00
|
|
|
struct tcp_acked *ta
|
|
|
|
)
|
|
|
|
{
|
|
|
|
proto_item * flags_item;
|
|
|
|
|
|
|
|
/* TCP Ports Reused */
|
|
|
|
if (ta->flags & TCP_A_REUSED_PORTS) {
|
2007-10-30 22:22:14 +00:00
|
|
|
flags_item=proto_tree_add_none_format(flags_tree,
|
|
|
|
hf_tcp_analysis_reused_ports,
|
|
|
|
tvb, 0, 0,
|
2007-10-28 23:38:43 +00:00
|
|
|
"A new tcp session is started with the same "
|
2007-08-31 15:06:27 +00:00
|
|
|
"ports as an earlier session in this trace"
|
|
|
|
);
|
|
|
|
PROTO_ITEM_SET_GENERATED(flags_item);
|
2007-10-30 22:22:14 +00:00
|
|
|
expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_NOTE,
|
2007-08-31 15:06:27 +00:00
|
|
|
"TCP Port numbers reused for new session");
|
2010-01-15 07:32:04 +00:00
|
|
|
col_prepend_fence_fstr(pinfo->cinfo, COL_INFO,
|
|
|
|
"[TCP Port numbers reused] ");
|
2007-08-31 15:06:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-10-30 22:22:14 +00:00
|
|
|
/* Prints results of the sequence number analysis concerning lost tcp segments */
|
|
|
|
static void
|
|
|
|
tcp_sequence_number_analysis_print_lost(packet_info * pinfo,
|
|
|
|
tvbuff_t * tvb,
|
|
|
|
proto_tree * flags_tree,
|
2007-04-01 16:04:04 +00:00
|
|
|
struct tcp_acked *ta
|
|
|
|
)
|
|
|
|
{
|
|
|
|
proto_item * flags_item;
|
|
|
|
|
|
|
|
/* TCP Lost Segment */
|
|
|
|
if (ta->flags & TCP_A_LOST_PACKET) {
|
2007-10-30 22:22:14 +00:00
|
|
|
flags_item=proto_tree_add_none_format(flags_tree,
|
|
|
|
hf_tcp_analysis_lost_packet,
|
|
|
|
tvb, 0, 0,
|
2007-04-01 16:04:04 +00:00
|
|
|
"A segment before this frame was "
|
|
|
|
"lost"
|
|
|
|
);
|
|
|
|
PROTO_ITEM_SET_GENERATED(flags_item);
|
2007-10-30 22:22:14 +00:00
|
|
|
expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_WARN,
|
2007-04-01 16:04:04 +00:00
|
|
|
"Previous segment lost (common at capture start)");
|
2010-01-15 07:32:04 +00:00
|
|
|
col_prepend_fence_fstr(pinfo->cinfo, COL_INFO,
|
|
|
|
"[TCP Previous segment lost] ");
|
2007-04-01 16:04:04 +00:00
|
|
|
}
|
|
|
|
/* TCP Ack lost segment */
|
|
|
|
if (ta->flags & TCP_A_ACK_LOST_PACKET) {
|
2007-10-30 22:22:14 +00:00
|
|
|
flags_item=proto_tree_add_none_format(flags_tree,
|
|
|
|
hf_tcp_analysis_ack_lost_packet,
|
|
|
|
tvb, 0, 0,
|
2007-04-01 16:04:04 +00:00
|
|
|
"This frame ACKs a segment we have "
|
|
|
|
"not seen (lost?)"
|
|
|
|
);
|
|
|
|
PROTO_ITEM_SET_GENERATED(flags_item);
|
2007-10-30 22:22:14 +00:00
|
|
|
expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_WARN,
|
2007-04-01 16:04:04 +00:00
|
|
|
"ACKed lost segment (common at capture start)");
|
2010-01-15 07:32:04 +00:00
|
|
|
col_prepend_fence_fstr(pinfo->cinfo, COL_INFO,
|
2007-04-01 16:04:04 +00:00
|
|
|
"[TCP ACKed lost segment] ");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-10-30 22:22:14 +00:00
|
|
|
/* Prints results of the sequence number analysis concerning tcp window */
|
|
|
|
static void
|
|
|
|
tcp_sequence_number_analysis_print_window(packet_info * pinfo,
|
|
|
|
tvbuff_t * tvb,
|
|
|
|
proto_tree * flags_tree,
|
2007-04-01 16:04:04 +00:00
|
|
|
struct tcp_acked *ta
|
|
|
|
)
|
|
|
|
{
|
|
|
|
proto_item * flags_item;
|
|
|
|
|
|
|
|
/* TCP Window Update */
|
|
|
|
if (ta->flags & TCP_A_WINDOW_UPDATE) {
|
2007-10-30 22:22:14 +00:00
|
|
|
flags_item=proto_tree_add_none_format(flags_tree,
|
|
|
|
hf_tcp_analysis_window_update,
|
|
|
|
tvb, 0, 0,
|
2007-04-01 16:04:04 +00:00
|
|
|
"This is a tcp window update"
|
|
|
|
);
|
|
|
|
PROTO_ITEM_SET_GENERATED(flags_item);
|
2008-04-05 17:27:29 +00:00
|
|
|
expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_CHAT,
|
2007-04-01 16:04:04 +00:00
|
|
|
"Window update");
|
2010-01-15 07:32:04 +00:00
|
|
|
col_prepend_fence_fstr(pinfo->cinfo, COL_INFO, "[TCP Window Update] ");
|
2007-04-01 16:04:04 +00:00
|
|
|
}
|
|
|
|
/* TCP Full Window */
|
|
|
|
if (ta->flags & TCP_A_WINDOW_FULL) {
|
2007-10-30 22:22:14 +00:00
|
|
|
flags_item=proto_tree_add_none_format(flags_tree,
|
|
|
|
hf_tcp_analysis_window_full,
|
|
|
|
tvb, 0, 0,
|
2007-04-01 16:04:04 +00:00
|
|
|
"The transmission window is now "
|
|
|
|
"completely full"
|
|
|
|
);
|
|
|
|
PROTO_ITEM_SET_GENERATED(flags_item);
|
2008-04-06 16:34:37 +00:00
|
|
|
expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_WARN,
|
2007-04-01 16:04:04 +00:00
|
|
|
"Window is full");
|
2010-01-15 07:32:04 +00:00
|
|
|
col_prepend_fence_fstr(pinfo->cinfo, COL_INFO, "[TCP Window Full] ");
|
2007-04-01 16:04:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-10-30 22:22:14 +00:00
|
|
|
/* Prints results of the sequence number analysis concerning tcp keepalive */
|
|
|
|
static void
|
|
|
|
tcp_sequence_number_analysis_print_keepalive(packet_info * pinfo,
|
|
|
|
tvbuff_t * tvb,
|
|
|
|
proto_tree * flags_tree,
|
2007-04-01 16:04:04 +00:00
|
|
|
struct tcp_acked *ta
|
|
|
|
)
|
|
|
|
{
|
|
|
|
proto_item * flags_item;
|
|
|
|
|
|
|
|
/*TCP Keep Alive */
|
|
|
|
if (ta->flags & TCP_A_KEEP_ALIVE){
|
2007-10-30 22:22:14 +00:00
|
|
|
flags_item=proto_tree_add_none_format(flags_tree,
|
|
|
|
hf_tcp_analysis_keep_alive,
|
|
|
|
tvb, 0, 0,
|
2007-04-01 16:04:04 +00:00
|
|
|
"This is a TCP keep-alive segment"
|
|
|
|
);
|
|
|
|
PROTO_ITEM_SET_GENERATED(flags_item);
|
2007-10-30 22:22:14 +00:00
|
|
|
expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_NOTE,
|
2007-04-01 16:04:04 +00:00
|
|
|
"Keep-Alive");
|
2010-01-15 07:32:04 +00:00
|
|
|
col_prepend_fence_fstr(pinfo->cinfo, COL_INFO, "[TCP Keep-Alive] ");
|
2007-04-01 16:04:04 +00:00
|
|
|
}
|
|
|
|
/* TCP Ack Keep Alive */
|
|
|
|
if (ta->flags & TCP_A_KEEP_ALIVE_ACK) {
|
2007-10-30 22:22:14 +00:00
|
|
|
flags_item=proto_tree_add_none_format(flags_tree,
|
|
|
|
hf_tcp_analysis_keep_alive_ack,
|
|
|
|
tvb, 0, 0,
|
2007-04-01 16:04:04 +00:00
|
|
|
"This is an ACK to a TCP keep-alive "
|
|
|
|
"segment"
|
|
|
|
);
|
|
|
|
PROTO_ITEM_SET_GENERATED(flags_item);
|
2007-10-30 22:22:14 +00:00
|
|
|
expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_NOTE,
|
2007-04-01 16:04:04 +00:00
|
|
|
"Keep-Alive ACK");
|
2010-01-15 07:32:04 +00:00
|
|
|
col_prepend_fence_fstr(pinfo->cinfo, COL_INFO, "[TCP Keep-Alive ACK] ");
|
2007-04-01 16:04:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-10-30 22:22:14 +00:00
|
|
|
/* Prints results of the sequence number analysis concerning tcp duplicate ack */
|
|
|
|
static void
|
|
|
|
tcp_sequence_number_analysis_print_duplicate(packet_info * pinfo,
|
|
|
|
tvbuff_t * tvb,
|
|
|
|
proto_tree * flags_tree,
|
2007-04-01 16:04:04 +00:00
|
|
|
struct tcp_acked *ta,
|
|
|
|
proto_tree * tree
|
|
|
|
)
|
|
|
|
{
|
|
|
|
proto_item * flags_item;
|
|
|
|
|
|
|
|
/* TCP Duplicate ACK */
|
|
|
|
if (ta->dupack_num) {
|
|
|
|
if (ta->flags & TCP_A_DUPLICATE_ACK ) {
|
2007-10-30 22:22:14 +00:00
|
|
|
flags_item=proto_tree_add_none_format(flags_tree,
|
|
|
|
hf_tcp_analysis_duplicate_ack,
|
|
|
|
tvb, 0, 0,
|
2007-04-01 16:04:04 +00:00
|
|
|
"This is a TCP duplicate ack"
|
|
|
|
);
|
|
|
|
PROTO_ITEM_SET_GENERATED(flags_item);
|
2010-01-15 07:32:04 +00:00
|
|
|
col_prepend_fence_fstr(pinfo->cinfo, COL_INFO,
|
2007-10-30 22:22:14 +00:00
|
|
|
"[TCP Dup ACK %u#%u] ",
|
|
|
|
ta->dupack_frame,
|
2007-04-01 16:04:04 +00:00
|
|
|
ta->dupack_num
|
|
|
|
);
|
2010-01-15 07:32:04 +00:00
|
|
|
|
|
|
|
}
|
2007-04-01 16:04:04 +00:00
|
|
|
flags_item=proto_tree_add_uint(tree, hf_tcp_analysis_duplicate_ack_num,
|
|
|
|
tvb, 0, 0, ta->dupack_num);
|
|
|
|
PROTO_ITEM_SET_GENERATED(flags_item);
|
|
|
|
flags_item=proto_tree_add_uint(tree, hf_tcp_analysis_duplicate_ack_frame,
|
|
|
|
tvb, 0, 0, ta->dupack_frame);
|
|
|
|
PROTO_ITEM_SET_GENERATED(flags_item);
|
2007-10-30 22:22:14 +00:00
|
|
|
expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_NOTE,
|
2007-04-01 16:04:04 +00:00
|
|
|
"Duplicate ACK (#%u)",
|
|
|
|
ta->dupack_num
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-10-30 22:22:14 +00:00
|
|
|
/* Prints results of the sequence number analysis concerning tcp zero window */
|
|
|
|
static void
|
|
|
|
tcp_sequence_number_analysis_print_zero_window(packet_info * pinfo,
|
|
|
|
tvbuff_t * tvb,
|
|
|
|
proto_tree * flags_tree,
|
2007-04-01 16:04:04 +00:00
|
|
|
struct tcp_acked *ta
|
|
|
|
)
|
|
|
|
{
|
|
|
|
proto_item * flags_item;
|
|
|
|
|
2008-11-02 00:48:41 +00:00
|
|
|
/* TCP Zero Window Probe */
|
2007-04-01 16:04:04 +00:00
|
|
|
if (ta->flags & TCP_A_ZERO_WINDOW_PROBE) {
|
2007-10-30 22:22:14 +00:00
|
|
|
flags_item=proto_tree_add_none_format(flags_tree,
|
|
|
|
hf_tcp_analysis_zero_window_probe,
|
|
|
|
tvb, 0, 0,
|
2007-04-01 16:04:04 +00:00
|
|
|
"This is a TCP zero-window-probe"
|
|
|
|
);
|
|
|
|
PROTO_ITEM_SET_GENERATED(flags_item);
|
2008-04-06 16:34:37 +00:00
|
|
|
expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_NOTE,
|
2007-04-01 16:04:04 +00:00
|
|
|
"Zero window probe");
|
2010-01-15 07:32:04 +00:00
|
|
|
col_prepend_fence_fstr(pinfo->cinfo, COL_INFO, "[TCP ZeroWindowProbe] ");
|
2007-04-01 16:04:04 +00:00
|
|
|
}
|
|
|
|
/* TCP Zero Window */
|
|
|
|
if (ta->flags&TCP_A_ZERO_WINDOW) {
|
2007-10-30 22:22:14 +00:00
|
|
|
flags_item=proto_tree_add_none_format(flags_tree,
|
|
|
|
hf_tcp_analysis_zero_window,
|
|
|
|
tvb, 0, 0,
|
2007-04-01 16:04:04 +00:00
|
|
|
"This is a ZeroWindow segment"
|
|
|
|
);
|
|
|
|
PROTO_ITEM_SET_GENERATED(flags_item);
|
2008-04-06 16:34:37 +00:00
|
|
|
expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_WARN,
|
2007-04-01 16:04:04 +00:00
|
|
|
"Zero window");
|
2010-01-15 07:32:04 +00:00
|
|
|
col_prepend_fence_fstr(pinfo->cinfo, COL_INFO, "[TCP ZeroWindow] ");
|
2007-04-01 16:04:04 +00:00
|
|
|
}
|
|
|
|
/* TCP Zero Window Probe Ack */
|
|
|
|
if (ta->flags & TCP_A_ZERO_WINDOW_PROBE_ACK) {
|
2007-10-30 22:22:14 +00:00
|
|
|
flags_item=proto_tree_add_none_format(flags_tree,
|
|
|
|
hf_tcp_analysis_zero_window_probe_ack,
|
|
|
|
tvb, 0, 0,
|
2007-04-01 16:04:04 +00:00
|
|
|
"This is an ACK to a TCP zero-window-probe"
|
|
|
|
);
|
|
|
|
PROTO_ITEM_SET_GENERATED(flags_item);
|
2008-04-06 16:34:37 +00:00
|
|
|
expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_NOTE,
|
2007-04-01 16:04:04 +00:00
|
|
|
"Zero window probe ACK");
|
2010-01-15 07:32:04 +00:00
|
|
|
col_prepend_fence_fstr(pinfo->cinfo, COL_INFO,
|
2007-04-01 16:04:04 +00:00
|
|
|
"[TCP ZeroWindowProbeAck] ");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-08-25 02:15:36 +00:00
|
|
|
/* Prints results of the sequence number analysis concerning how many bytes of data are in flight */
|
|
|
|
static void
|
|
|
|
tcp_sequence_number_analysis_print_bytes_in_flight(packet_info * pinfo _U_,
|
|
|
|
tvbuff_t * tvb _U_,
|
|
|
|
proto_tree * flags_tree _U_,
|
|
|
|
struct tcp_acked *ta
|
|
|
|
)
|
|
|
|
{
|
|
|
|
proto_item * flags_item;
|
|
|
|
|
|
|
|
if (tcp_track_bytes_in_flight) {
|
|
|
|
flags_item=proto_tree_add_uint(flags_tree,
|
|
|
|
hf_tcp_analysis_bytes_in_flight,
|
|
|
|
tvb, 0, 0, ta->bytes_in_flight);
|
|
|
|
|
|
|
|
PROTO_ITEM_SET_GENERATED(flags_item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-08-02 22:41:56 +00:00
|
|
|
static void
|
2006-03-02 09:33:49 +00:00
|
|
|
tcp_print_sequence_number_analysis(packet_info *pinfo, tvbuff_t *tvb, proto_tree *parent_tree, struct tcp_analysis *tcpd)
|
2002-08-02 22:41:56 +00:00
|
|
|
{
|
2007-10-30 22:22:14 +00:00
|
|
|
struct tcp_acked *ta = NULL;
|
2002-08-02 22:41:56 +00:00
|
|
|
proto_item *item;
|
|
|
|
proto_tree *tree;
|
2007-04-01 16:04:04 +00:00
|
|
|
proto_tree *flags_tree=NULL;
|
2007-10-30 22:22:14 +00:00
|
|
|
|
|
|
|
if (!tcpd) {
|
|
|
|
return;
|
|
|
|
}
|
2006-03-02 09:33:49 +00:00
|
|
|
if(!tcpd->ta){
|
|
|
|
tcp_analyze_get_acked_struct(pinfo->fd->num, FALSE, tcpd);
|
|
|
|
}
|
|
|
|
ta=tcpd->ta;
|
2002-08-02 22:41:56 +00:00
|
|
|
if(!ta){
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
item=proto_tree_add_text(parent_tree, tvb, 0, 0, "SEQ/ACK analysis");
|
2005-08-13 07:30:57 +00:00
|
|
|
PROTO_ITEM_SET_GENERATED(item);
|
2002-08-02 22:41:56 +00:00
|
|
|
tree=proto_item_add_subtree(item, ett_tcp_analysis);
|
|
|
|
|
2002-08-28 21:04:11 +00:00
|
|
|
/* encapsulate all proto_tree_add_xxx in ifs so we only print what
|
2002-08-02 22:41:56 +00:00
|
|
|
data we actually have */
|
|
|
|
if(ta->frame_acked){
|
2004-05-01 15:15:08 +00:00
|
|
|
item = proto_tree_add_uint(tree, hf_tcp_analysis_acks_frame,
|
2002-08-02 22:41:56 +00:00
|
|
|
tvb, 0, 0, ta->frame_acked);
|
2004-10-11 08:12:34 +00:00
|
|
|
PROTO_ITEM_SET_GENERATED(item);
|
|
|
|
|
|
|
|
/* only display RTT if we actually have something we are acking */
|
|
|
|
if( ta->ts.secs || ta->ts.nsecs ){
|
|
|
|
item = proto_tree_add_time(tree, hf_tcp_analysis_ack_rtt,
|
|
|
|
tvb, 0, 0, &ta->ts);
|
|
|
|
PROTO_ITEM_SET_GENERATED(item);
|
|
|
|
}
|
2002-08-02 22:41:56 +00:00
|
|
|
}
|
2002-08-21 23:57:38 +00:00
|
|
|
|
2008-08-25 02:15:36 +00:00
|
|
|
if(ta->bytes_in_flight) {
|
|
|
|
/* print results for amount of data in flight */
|
|
|
|
tcp_sequence_number_analysis_print_bytes_in_flight(pinfo, tvb, tree, ta);
|
|
|
|
}
|
|
|
|
|
2002-08-21 23:57:38 +00:00
|
|
|
if(ta->flags){
|
2008-11-18 16:38:08 +00:00
|
|
|
item = proto_tree_add_item(tree, hf_tcp_analysis_flags, tvb, 0, 0, FALSE);
|
2007-04-01 16:04:04 +00:00
|
|
|
PROTO_ITEM_SET_GENERATED(item);
|
|
|
|
flags_tree=proto_item_add_subtree(item, ett_tcp_analysis);
|
|
|
|
|
2007-08-31 15:06:27 +00:00
|
|
|
/* print results for reused tcp ports */
|
|
|
|
tcp_sequence_number_analysis_print_reused(pinfo, tvb, flags_tree, ta);
|
|
|
|
|
2007-04-01 16:04:04 +00:00
|
|
|
/* print results for retransmission and out-of-order segments */
|
|
|
|
tcp_sequence_number_analysis_print_retransmission(pinfo, tvb, flags_tree, ta);
|
|
|
|
|
|
|
|
/* print results for lost tcp segments */
|
|
|
|
tcp_sequence_number_analysis_print_lost(pinfo, tvb, flags_tree, ta);
|
|
|
|
|
|
|
|
/* print results for tcp window information */
|
|
|
|
tcp_sequence_number_analysis_print_window(pinfo, tvb, flags_tree, ta);
|
|
|
|
|
|
|
|
/* print results for tcp keep alive information */
|
|
|
|
tcp_sequence_number_analysis_print_keepalive(pinfo, tvb, flags_tree, ta);
|
|
|
|
|
|
|
|
/* print results for tcp duplicate acks */
|
|
|
|
tcp_sequence_number_analysis_print_duplicate(pinfo, tvb, flags_tree, ta, tree);
|
|
|
|
|
|
|
|
/* print results for tcp zero window */
|
|
|
|
tcp_sequence_number_analysis_print_zero_window(pinfo, tvb, flags_tree, ta);
|
2008-08-25 02:15:36 +00:00
|
|
|
|
2002-08-02 22:41:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2009-04-20 05:48:04 +00:00
|
|
|
static void
|
|
|
|
print_tcp_fragment_tree(fragment_data *ipfd_head, proto_tree *tree, proto_tree *tcp_tree, packet_info *pinfo, tvbuff_t *next_tvb)
|
|
|
|
{
|
|
|
|
proto_item *tcp_tree_item, *frag_tree_item;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The subdissector thought it was completely
|
|
|
|
* desegmented (although the stuff at the
|
|
|
|
* end may, in turn, require desegmentation),
|
|
|
|
* so we show a tree with all segments.
|
|
|
|
*/
|
|
|
|
show_fragment_tree(ipfd_head, &tcp_segment_items,
|
|
|
|
tree, pinfo, next_tvb, &frag_tree_item);
|
|
|
|
/*
|
|
|
|
* The toplevel fragment subtree is now
|
|
|
|
* behind all desegmented data; move it
|
|
|
|
* right behind the TCP tree.
|
|
|
|
*/
|
|
|
|
tcp_tree_item = proto_tree_get_parent(tcp_tree);
|
|
|
|
if(frag_tree_item && tcp_tree_item) {
|
|
|
|
proto_tree_move_item(tree, tcp_tree_item, frag_tree_item);
|
|
|
|
}
|
|
|
|
}
|
2002-08-02 22:41:56 +00:00
|
|
|
|
|
|
|
/* **************************************************************************
|
2002-08-28 21:04:11 +00:00
|
|
|
* End of tcp sequence number analysis
|
2002-08-02 22:41:56 +00:00
|
|
|
* **************************************************************************/
|
|
|
|
|
|
|
|
|
2001-06-14 08:09:59 +00:00
|
|
|
/* Minimum TCP header length. */
|
2008-08-20 05:56:31 +00:00
|
|
|
#define TCPH_MIN_LEN 20
|
2001-06-14 08:09:59 +00:00
|
|
|
|
1999-03-23 03:14:46 +00:00
|
|
|
/*
|
|
|
|
* TCP option
|
|
|
|
*/
|
2002-08-28 21:04:11 +00:00
|
|
|
|
2008-08-20 05:56:31 +00:00
|
|
|
#define TCPOPT_NOP 1 /* Padding */
|
|
|
|
#define TCPOPT_EOL 0 /* End of options */
|
|
|
|
#define TCPOPT_MSS 2 /* Segment size negotiating */
|
|
|
|
#define TCPOPT_WINDOW 3 /* Window scaling */
|
1999-03-23 03:14:46 +00:00
|
|
|
#define TCPOPT_SACK_PERM 4 /* SACK Permitted */
|
|
|
|
#define TCPOPT_SACK 5 /* SACK Block */
|
|
|
|
#define TCPOPT_ECHO 6
|
|
|
|
#define TCPOPT_ECHOREPLY 7
|
2008-08-20 05:56:31 +00:00
|
|
|
#define TCPOPT_TIMESTAMP 8 /* Better RTT estimations/PAWS */
|
1999-03-23 03:14:46 +00:00
|
|
|
#define TCPOPT_CC 11
|
|
|
|
#define TCPOPT_CCNEW 12
|
|
|
|
#define TCPOPT_CCECHO 13
|
2000-12-30 05:23:56 +00:00
|
|
|
#define TCPOPT_MD5 19 /* RFC2385 */
|
2008-12-17 00:08:38 +00:00
|
|
|
#define TCPOPT_SCPS 20 /* SCPS Capabilities */
|
2008-08-12 21:08:46 +00:00
|
|
|
#define TCPOPT_SNACK 21 /* SCPS SNACK */
|
2008-10-15 17:51:57 +00:00
|
|
|
#define TCPOPT_RECBOUND 22 /* SCPS Record Boundary */
|
|
|
|
#define TCPOPT_CORREXP 23 /* SCPS Corruption Experienced */
|
2007-06-04 23:27:12 +00:00
|
|
|
#define TCPOPT_QS 27 /* RFC4782 */
|
1999-03-23 03:14:46 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* TCP option lengths
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define TCPOLEN_MSS 4
|
|
|
|
#define TCPOLEN_WINDOW 3
|
|
|
|
#define TCPOLEN_SACK_PERM 2
|
|
|
|
#define TCPOLEN_SACK_MIN 2
|
|
|
|
#define TCPOLEN_ECHO 6
|
|
|
|
#define TCPOLEN_ECHOREPLY 6
|
|
|
|
#define TCPOLEN_TIMESTAMP 10
|
|
|
|
#define TCPOLEN_CC 6
|
|
|
|
#define TCPOLEN_CCNEW 6
|
|
|
|
#define TCPOLEN_CCECHO 6
|
2000-12-30 05:23:56 +00:00
|
|
|
#define TCPOLEN_MD5 18
|
2008-08-12 21:08:46 +00:00
|
|
|
#define TCPOLEN_SCPS 4
|
|
|
|
#define TCPOLEN_SNACK 6
|
2008-10-15 17:51:57 +00:00
|
|
|
#define TCPOLEN_RECBOUND 2
|
|
|
|
#define TCPOLEN_CORREXP 2
|
2007-06-04 23:27:12 +00:00
|
|
|
#define TCPOLEN_QS 8
|
1999-03-23 03:14:46 +00:00
|
|
|
|
2001-09-13 07:56:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* Desegmentation of TCP streams */
|
|
|
|
/* table to hold defragmented TCP streams */
|
|
|
|
static GHashTable *tcp_fragment_table = NULL;
|
|
|
|
static void
|
|
|
|
tcp_fragment_init(void)
|
|
|
|
{
|
|
|
|
fragment_table_init(&tcp_fragment_table);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* functions to trace tcp segments */
|
|
|
|
/* Enable desegmenting of TCP streams */
|
2005-09-27 05:39:58 +00:00
|
|
|
static gboolean tcp_desegment = TRUE;
|
2001-09-13 07:56:53 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
desegment_tcp(tvbuff_t *tvb, packet_info *pinfo, int offset,
|
|
|
|
guint32 seq, guint32 nxtseq,
|
|
|
|
guint32 sport, guint32 dport,
|
2006-01-26 22:50:16 +00:00
|
|
|
proto_tree *tree, proto_tree *tcp_tree,
|
|
|
|
struct tcp_analysis *tcpd)
|
2001-09-13 07:56:53 +00:00
|
|
|
{
|
2001-11-03 00:58:52 +00:00
|
|
|
struct tcpinfo *tcpinfo = pinfo->private_data;
|
2006-05-01 02:32:16 +00:00
|
|
|
fragment_data *ipfd_head;
|
2008-07-24 06:33:23 +00:00
|
|
|
int last_fragment_len;
|
2006-05-01 02:32:16 +00:00
|
|
|
gboolean must_desegment;
|
|
|
|
gboolean called_dissector;
|
|
|
|
int another_pdu_follows;
|
2001-09-13 07:56:53 +00:00
|
|
|
int deseg_offset;
|
2001-09-30 23:14:43 +00:00
|
|
|
guint32 deseg_seq;
|
2002-02-19 00:14:21 +00:00
|
|
|
gint nbytes;
|
2006-04-30 10:27:55 +00:00
|
|
|
proto_item *item;
|
2008-08-13 21:44:53 +00:00
|
|
|
struct tcp_multisegment_pdu *msp;
|
2009-08-24 09:29:05 +00:00
|
|
|
gboolean cleared_writable = col_get_writable(pinfo->cinfo);
|
2006-05-01 02:32:16 +00:00
|
|
|
|
|
|
|
again:
|
|
|
|
ipfd_head=NULL;
|
2008-07-24 06:33:23 +00:00
|
|
|
last_fragment_len=0;
|
2006-05-01 02:32:16 +00:00
|
|
|
must_desegment = FALSE;
|
|
|
|
called_dissector = FALSE;
|
|
|
|
another_pdu_follows = 0;
|
|
|
|
msp=NULL;
|
2001-09-13 07:56:53 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialize these to assume no desegmentation.
|
|
|
|
* If that's not the case, these will be set appropriately
|
|
|
|
* by the subdissector.
|
|
|
|
*/
|
|
|
|
pinfo->desegment_offset = 0;
|
|
|
|
pinfo->desegment_len = 0;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialize this to assume that this segment will just be
|
|
|
|
* added to the middle of a desegmented chunk of data, so
|
|
|
|
* that we should show it all as data.
|
|
|
|
* If that's not the case, it will be set appropriately.
|
|
|
|
*/
|
|
|
|
deseg_offset = offset;
|
|
|
|
|
2006-04-30 10:27:55 +00:00
|
|
|
/* find the most previous PDU starting before this sequence number */
|
2007-10-30 22:22:14 +00:00
|
|
|
if (tcpd) {
|
|
|
|
msp = se_tree_lookup32_le(tcpd->fwd->multisegment_pdus, seq-1);
|
|
|
|
}
|
2006-04-30 10:27:55 +00:00
|
|
|
if(msp && msp->seq<=seq && msp->nxtpdu>seq){
|
|
|
|
int len;
|
|
|
|
|
|
|
|
if(!pinfo->fd->flags.visited){
|
|
|
|
msp->last_frame=pinfo->fd->num;
|
|
|
|
msp->last_frame_time=pinfo->fd->abs_ts;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* OK, this PDU was found, which means the segment continues
|
|
|
|
a higher-level PDU and that we must desegment it.
|
2001-09-13 07:56:53 +00:00
|
|
|
*/
|
2006-11-07 13:19:31 +00:00
|
|
|
if(msp->flags&MSP_FLAGS_REASSEMBLE_ENTIRE_SEGMENT){
|
|
|
|
/* The dissector asked for the entire segment */
|
|
|
|
len=tvb_length_remaining(tvb, offset);
|
|
|
|
} else {
|
|
|
|
len=MIN(nxtseq, msp->nxtpdu) - seq;
|
|
|
|
}
|
2008-07-24 06:33:23 +00:00
|
|
|
last_fragment_len = len;
|
2006-11-07 13:19:31 +00:00
|
|
|
|
2006-04-30 10:27:55 +00:00
|
|
|
ipfd_head = fragment_add(tvb, offset, pinfo, msp->first_frame,
|
2001-09-13 07:56:53 +00:00
|
|
|
tcp_fragment_table,
|
2006-04-30 10:27:55 +00:00
|
|
|
seq - msp->seq,
|
|
|
|
len,
|
|
|
|
(LT_SEQ (nxtseq,msp->nxtpdu)) );
|
2006-12-20 11:57:31 +00:00
|
|
|
|
|
|
|
if(msp->flags&MSP_FLAGS_REASSEMBLE_ENTIRE_SEGMENT){
|
|
|
|
msp->flags&=(~MSP_FLAGS_REASSEMBLE_ENTIRE_SEGMENT);
|
|
|
|
|
|
|
|
/* If we consumed the entire segment there is no
|
|
|
|
* other pdu starting anywhere inside this segment.
|
|
|
|
* So update nxtpdu to point at least to the start
|
|
|
|
* of the next segment.
|
|
|
|
* (If the subdissector asks for even more data we
|
|
|
|
* will advance nxtpdu even furhter later down in
|
|
|
|
* the code.)
|
|
|
|
*/
|
|
|
|
msp->nxtpdu=nxtseq;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( (msp->nxtpdu<nxtseq)
|
|
|
|
&& (msp->nxtpdu>=seq)
|
|
|
|
&& (len>0) ){
|
|
|
|
another_pdu_follows=msp->nxtpdu-seq;
|
2001-09-13 07:56:53 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* This segment was not found in our table, so it doesn't
|
|
|
|
contain a continuation of a higher-level PDU.
|
|
|
|
Call the normal subdissector.
|
|
|
|
*/
|
2003-11-08 05:47:12 +00:00
|
|
|
process_tcp_payload(tvb, offset, pinfo, tree, tcp_tree,
|
2006-01-26 22:50:16 +00:00
|
|
|
sport, dport, 0, 0, FALSE, tcpd);
|
2001-09-13 07:56:53 +00:00
|
|
|
called_dissector = TRUE;
|
|
|
|
|
|
|
|
/* Did the subdissector ask us to desegment some more data
|
2002-08-28 21:04:11 +00:00
|
|
|
before it could handle the packet?
|
2001-09-13 07:56:53 +00:00
|
|
|
If so we have to create some structures in our table but
|
2002-08-28 21:04:11 +00:00
|
|
|
this is something we only do the first time we see this
|
2001-09-13 07:56:53 +00:00
|
|
|
packet.
|
|
|
|
*/
|
|
|
|
if(pinfo->desegment_len) {
|
|
|
|
if (!pinfo->fd->flags.visited)
|
|
|
|
must_desegment = TRUE;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set "deseg_offset" to the offset in "tvb"
|
|
|
|
* of the first byte of data that the
|
|
|
|
* subdissector didn't process.
|
|
|
|
*/
|
2001-09-30 23:14:43 +00:00
|
|
|
deseg_offset = offset + pinfo->desegment_offset;
|
2001-09-13 07:56:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Either no desegmentation is necessary, or this is
|
|
|
|
segment contains the beginning but not the end of
|
|
|
|
a higher-level PDU and thus isn't completely
|
|
|
|
desegmented.
|
|
|
|
*/
|
|
|
|
ipfd_head = NULL;
|
|
|
|
}
|
|
|
|
|
2006-04-30 10:27:55 +00:00
|
|
|
|
2001-09-13 07:56:53 +00:00
|
|
|
/* is it completely desegmented? */
|
|
|
|
if(ipfd_head){
|
|
|
|
/*
|
2002-02-03 23:28:38 +00:00
|
|
|
* Yes, we think it is.
|
2001-09-13 07:56:53 +00:00
|
|
|
* We only call subdissector for the last segment.
|
|
|
|
* Note that the last segment may include more than what
|
|
|
|
* we needed.
|
|
|
|
*/
|
2006-04-30 10:27:55 +00:00
|
|
|
if(ipfd_head->reassembled_in==pinfo->fd->num){
|
2002-02-03 23:28:38 +00:00
|
|
|
/*
|
|
|
|
* OK, this is the last segment.
|
|
|
|
* Let's call the subdissector with the desegmented
|
|
|
|
* data.
|
|
|
|
*/
|
2001-09-13 07:56:53 +00:00
|
|
|
tvbuff_t *next_tvb;
|
2002-02-03 23:28:38 +00:00
|
|
|
int old_len;
|
2001-09-13 07:56:53 +00:00
|
|
|
|
|
|
|
/* create a new TVB structure for desegmented data */
|
2009-05-14 20:04:28 +00:00
|
|
|
next_tvb = tvb_new_child_real_data(tvb, ipfd_head->data,
|
2002-02-18 01:08:44 +00:00
|
|
|
ipfd_head->datalen, ipfd_head->datalen);
|
2001-09-13 07:56:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* add desegmented data to the data source list */
|
2004-08-21 09:02:52 +00:00
|
|
|
add_new_data_source(pinfo, next_tvb, "Reassembled TCP");
|
2001-09-13 07:56:53 +00:00
|
|
|
|
Add support for reassembling RPC-over-TCP fragments, and do that in both
RPC and NDMP.
Show the RPC-over-TCP fragment header as a tree with bitfields below it.
Add a routine to show a reported bounds error as an "Unreassembled
Packet" or a "Malformed Packet" depending on whether "pinfo->fragmented"
is set, and have NBNS and RPC use that.
Add "ett_ndmp_file_stats" to the list of ett_ values to be initialized
(it wasn't in that list, and wasn't getting initialized).
When freeing up various hash tables and memory chunks in the RPC
dissector, zero out the pointers to them, just to make sure we don't try
to free them again.
Always destroy the TCP segment key and address memory chunks in
"tcp_desegment_init()", regardless of whether TCP desegmentation is
enabled - we don't *allocate* them if TCP desegmentation isn't enabled,
but we should free them even if it's not enabled. Also, when we free
them, set the pointers to them to null, so we don't double-free them.
Supply to subdissectors called from the TCP dissector the sequence
number of the first byte handed to the sub dissector.
svn path=/trunk/; revision=4753
2002-02-18 23:51:55 +00:00
|
|
|
/*
|
|
|
|
* Supply the sequence number of the first of the
|
|
|
|
* reassembled bytes.
|
|
|
|
*/
|
2006-04-30 10:27:55 +00:00
|
|
|
tcpinfo->seq = msp->seq;
|
Add support for reassembling RPC-over-TCP fragments, and do that in both
RPC and NDMP.
Show the RPC-over-TCP fragment header as a tree with bitfields below it.
Add a routine to show a reported bounds error as an "Unreassembled
Packet" or a "Malformed Packet" depending on whether "pinfo->fragmented"
is set, and have NBNS and RPC use that.
Add "ett_ndmp_file_stats" to the list of ett_ values to be initialized
(it wasn't in that list, and wasn't getting initialized).
When freeing up various hash tables and memory chunks in the RPC
dissector, zero out the pointers to them, just to make sure we don't try
to free them again.
Always destroy the TCP segment key and address memory chunks in
"tcp_desegment_init()", regardless of whether TCP desegmentation is
enabled - we don't *allocate* them if TCP desegmentation isn't enabled,
but we should free them even if it's not enabled. Also, when we free
them, set the pointers to them to null, so we don't double-free them.
Supply to subdissectors called from the TCP dissector the sequence
number of the first byte handed to the sub dissector.
svn path=/trunk/; revision=4753
2002-02-18 23:51:55 +00:00
|
|
|
|
2001-09-30 23:14:43 +00:00
|
|
|
/* indicate that this is reassembled data */
|
|
|
|
tcpinfo->is_reassembled = TRUE;
|
|
|
|
|
2001-09-13 07:56:53 +00:00
|
|
|
/* call subdissector */
|
2003-11-08 05:47:12 +00:00
|
|
|
process_tcp_payload(next_tvb, 0, pinfo, tree,
|
2006-01-26 22:50:16 +00:00
|
|
|
tcp_tree, sport, dport, 0, 0, FALSE, tcpd);
|
2001-09-13 07:56:53 +00:00
|
|
|
called_dissector = TRUE;
|
|
|
|
|
2002-02-03 23:28:38 +00:00
|
|
|
/*
|
|
|
|
* OK, did the subdissector think it was completely
|
|
|
|
* desegmented, or does it think we need even more
|
|
|
|
* data?
|
|
|
|
*/
|
2008-07-24 06:33:23 +00:00
|
|
|
old_len=(int)(tvb_reported_length(next_tvb)-last_fragment_len);
|
2002-02-03 23:28:38 +00:00
|
|
|
if(pinfo->desegment_len &&
|
|
|
|
pinfo->desegment_offset<=old_len){
|
2001-09-13 07:56:53 +00:00
|
|
|
/*
|
2002-02-03 23:28:38 +00:00
|
|
|
* "desegment_len" isn't 0, so it needs more
|
|
|
|
* data for something - and "desegment_offset"
|
|
|
|
* is before "old_len", so it needs more data
|
|
|
|
* to dissect the stuff we thought was
|
|
|
|
* completely desegmented (as opposed to the
|
|
|
|
* stuff at the beginning being completely
|
|
|
|
* desegmented, but the stuff at the end
|
|
|
|
* being a new higher-level PDU that also
|
|
|
|
* needs desegmentation).
|
2001-09-13 07:56:53 +00:00
|
|
|
*/
|
2006-04-30 10:27:55 +00:00
|
|
|
fragment_set_partial_reassembly(pinfo,msp->first_frame,tcp_fragment_table);
|
2006-12-20 11:57:31 +00:00
|
|
|
/* Update msp->nxtpdu to point to the new next
|
|
|
|
* pdu boundary.
|
|
|
|
*/
|
|
|
|
if(pinfo->desegment_len==DESEGMENT_ONE_MORE_SEGMENT){
|
|
|
|
/* We want reassembly of at least one
|
2007-10-30 22:22:14 +00:00
|
|
|
* more segment so set the nxtpdu
|
|
|
|
* boundary to one byte into the next
|
2006-12-20 11:57:31 +00:00
|
|
|
* segment.
|
2007-10-30 22:22:14 +00:00
|
|
|
* This means that the next segment
|
2006-12-20 11:57:31 +00:00
|
|
|
* will complete reassembly even if it
|
|
|
|
* is only one single byte in length.
|
|
|
|
*/
|
|
|
|
msp->nxtpdu=seq+tvb_reported_length_remaining(tvb, offset) + 1;
|
|
|
|
msp->flags|=MSP_FLAGS_REASSEMBLE_ENTIRE_SEGMENT;
|
|
|
|
} else {
|
2008-07-24 06:33:23 +00:00
|
|
|
msp->nxtpdu=seq + last_fragment_len + pinfo->desegment_len;
|
2006-12-20 11:57:31 +00:00
|
|
|
}
|
|
|
|
/* Since we need at least some more data
|
|
|
|
* there can be no pdu following in the
|
|
|
|
* tail of this segment.
|
|
|
|
*/
|
|
|
|
another_pdu_follows=0;
|
2008-07-24 06:33:23 +00:00
|
|
|
offset += last_fragment_len;
|
|
|
|
seq += last_fragment_len;
|
|
|
|
if (tvb_length_remaining(tvb, offset) > 0)
|
|
|
|
goto again;
|
2002-02-03 23:28:38 +00:00
|
|
|
} else {
|
2002-02-19 00:14:21 +00:00
|
|
|
/*
|
|
|
|
* Show the stuff in this TCP segment as
|
|
|
|
* just raw TCP segment data.
|
|
|
|
*/
|
2007-11-24 23:04:49 +00:00
|
|
|
nbytes = another_pdu_follows > 0
|
|
|
|
? another_pdu_follows
|
|
|
|
: tvb_reported_length_remaining(tvb, offset);
|
|
|
|
proto_tree_add_text(tcp_tree, tvb, offset, nbytes,
|
2002-02-19 00:14:21 +00:00
|
|
|
"TCP segment data (%u byte%s)", nbytes,
|
|
|
|
plurality(nbytes, "", "s"));
|
|
|
|
|
2009-04-20 05:48:04 +00:00
|
|
|
print_tcp_fragment_tree(ipfd_head, tree, tcp_tree, pinfo, next_tvb);
|
2002-02-03 23:28:38 +00:00
|
|
|
|
|
|
|
/* Did the subdissector ask us to desegment
|
|
|
|
some more data? This means that the data
|
|
|
|
at the beginning of this segment completed
|
|
|
|
a higher-level PDU, but the data at the
|
|
|
|
end of this segment started a higher-level
|
|
|
|
PDU but didn't complete it.
|
|
|
|
|
|
|
|
If so, we have to create some structures
|
|
|
|
in our table, but this is something we
|
|
|
|
only do the first time we see this packet.
|
|
|
|
*/
|
|
|
|
if(pinfo->desegment_len) {
|
|
|
|
if (!pinfo->fd->flags.visited)
|
|
|
|
must_desegment = TRUE;
|
|
|
|
|
|
|
|
/* The stuff we couldn't dissect
|
|
|
|
must have come from this segment,
|
|
|
|
so it's all in "tvb".
|
|
|
|
|
|
|
|
"pinfo->desegment_offset" is
|
|
|
|
relative to the beginning of
|
|
|
|
"next_tvb"; we want an offset
|
|
|
|
relative to the beginning of "tvb".
|
|
|
|
|
|
|
|
First, compute the offset relative
|
|
|
|
to the *end* of "next_tvb" - i.e.,
|
|
|
|
the number of bytes before the end
|
|
|
|
of "next_tvb" at which the
|
|
|
|
subdissector stopped. That's the
|
|
|
|
length of "next_tvb" minus the
|
|
|
|
offset, relative to the beginning
|
|
|
|
of "next_tvb, at which the
|
|
|
|
subdissector stopped.
|
|
|
|
*/
|
|
|
|
deseg_offset =
|
|
|
|
ipfd_head->datalen - pinfo->desegment_offset;
|
|
|
|
|
|
|
|
/* "tvb" and "next_tvb" end at the
|
|
|
|
same byte of data, so the offset
|
|
|
|
relative to the end of "next_tvb"
|
|
|
|
of the byte at which we stopped
|
|
|
|
is also the offset relative to
|
|
|
|
the end of "tvb" of the byte at
|
|
|
|
which we stopped.
|
|
|
|
|
|
|
|
Convert that back into an offset
|
|
|
|
relative to the beginninng of
|
|
|
|
"tvb", by taking the length of
|
|
|
|
"tvb" and subtracting the offset
|
|
|
|
relative to the end.
|
|
|
|
*/
|
|
|
|
deseg_offset=tvb_reported_length(tvb) - deseg_offset;
|
|
|
|
}
|
2001-09-13 07:56:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (must_desegment) {
|
2006-09-10 14:03:08 +00:00
|
|
|
/* If the dissector requested "reassemble until FIN"
|
|
|
|
* just set this flag for the flow and let reassembly
|
|
|
|
* proceed at normal. We will check/pick up these
|
|
|
|
* reassembled PDUs later down in dissect_tcp() when checking
|
|
|
|
* for the FIN flag.
|
|
|
|
*/
|
2007-11-08 00:58:38 +00:00
|
|
|
if(tcpd && pinfo->desegment_len==DESEGMENT_UNTIL_FIN) {
|
2006-09-10 14:03:08 +00:00
|
|
|
tcpd->fwd->flags|=TCP_FLOW_REASSEMBLE_UNTIL_FIN;
|
|
|
|
}
|
2001-09-30 23:14:43 +00:00
|
|
|
/*
|
|
|
|
* The sequence number at which the stuff to be desegmented
|
|
|
|
* starts is the sequence number of the byte at an offset
|
|
|
|
* of "deseg_offset" into "tvb".
|
|
|
|
*
|
|
|
|
* The sequence number of the byte at an offset of "offset"
|
|
|
|
* is "seq", i.e. the starting sequence number of this
|
|
|
|
* segment, so the sequence number of the byte at
|
|
|
|
* "deseg_offset" is "seq + (deseg_offset - offset)".
|
|
|
|
*/
|
|
|
|
deseg_seq = seq + (deseg_offset - offset);
|
|
|
|
|
2007-11-08 00:58:38 +00:00
|
|
|
if(tcpd && ((nxtseq - deseg_seq) <= 1024*1024)
|
2006-09-10 14:03:08 +00:00
|
|
|
&& (!pinfo->fd->flags.visited) ){
|
2006-11-07 13:19:31 +00:00
|
|
|
if(pinfo->desegment_len==DESEGMENT_ONE_MORE_SEGMENT){
|
|
|
|
/* The subdissector asked to reassemble using the
|
|
|
|
* entire next segment.
|
|
|
|
* Just ask reassembly for one more byte
|
|
|
|
* but set this msp flag so we can pick it up
|
|
|
|
* above.
|
|
|
|
*/
|
2007-10-30 22:22:14 +00:00
|
|
|
msp = pdu_store_sequencenumber_of_next_pdu(pinfo,
|
2007-04-06 07:01:01 +00:00
|
|
|
deseg_seq, nxtseq+1, tcpd->fwd->multisegment_pdus);
|
2006-11-07 13:19:31 +00:00
|
|
|
msp->flags|=MSP_FLAGS_REASSEMBLE_ENTIRE_SEGMENT;
|
|
|
|
} else {
|
2007-10-30 22:22:14 +00:00
|
|
|
msp = pdu_store_sequencenumber_of_next_pdu(pinfo,
|
2007-04-06 07:01:01 +00:00
|
|
|
deseg_seq, nxtseq+pinfo->desegment_len, tcpd->fwd->multisegment_pdus);
|
2006-11-07 13:19:31 +00:00
|
|
|
}
|
2006-09-10 14:03:08 +00:00
|
|
|
|
|
|
|
/* add this segment as the first one for this new pdu */
|
|
|
|
fragment_add(tvb, deseg_offset, pinfo, msp->first_frame,
|
|
|
|
tcp_fragment_table,
|
|
|
|
0,
|
|
|
|
nxtseq - deseg_seq,
|
|
|
|
LT_SEQ(nxtseq, msp->nxtpdu));
|
2006-04-30 10:27:55 +00:00
|
|
|
}
|
2001-09-13 07:56:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!called_dissector || pinfo->desegment_len != 0) {
|
2005-07-29 07:14:32 +00:00
|
|
|
if (ipfd_head != NULL && ipfd_head->reassembled_in != 0 &&
|
|
|
|
!(ipfd_head->flags & FD_PARTIAL_REASSEMBLY)) {
|
2003-08-28 03:35:23 +00:00
|
|
|
/*
|
|
|
|
* We know what frame this PDU is reassembled in;
|
|
|
|
* let the user know.
|
|
|
|
*/
|
2004-05-14 17:34:51 +00:00
|
|
|
item=proto_tree_add_uint(tcp_tree, hf_tcp_reassembled_in,
|
2003-08-28 03:35:23 +00:00
|
|
|
tvb, 0, 0, ipfd_head->reassembled_in);
|
2005-07-29 07:14:32 +00:00
|
|
|
PROTO_ITEM_SET_GENERATED(item);
|
2003-08-28 03:35:23 +00:00
|
|
|
}
|
|
|
|
|
2001-09-13 07:56:53 +00:00
|
|
|
/*
|
|
|
|
* Either we didn't call the subdissector at all (i.e.,
|
|
|
|
* this is a segment that contains the middle of a
|
|
|
|
* higher-level PDU, but contains neither the beginning
|
|
|
|
* nor the end), or the subdissector couldn't dissect it
|
|
|
|
* all, as some data was missing (i.e., it set
|
|
|
|
* "pinfo->desegment_len" to the amount of additional
|
|
|
|
* data it needs).
|
|
|
|
*/
|
|
|
|
if (pinfo->desegment_offset == 0) {
|
|
|
|
/*
|
|
|
|
* It couldn't, in fact, dissect any of it (the
|
|
|
|
* first byte it couldn't dissect is at an offset
|
|
|
|
* of "pinfo->desegment_offset" from the beginning
|
|
|
|
* of the payload, and that's 0).
|
|
|
|
* Just mark this as TCP.
|
|
|
|
*/
|
2009-08-09 07:59:51 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "TCP");
|
|
|
|
col_set_str(pinfo->cinfo, COL_INFO, "[TCP segment of a reassembled PDU]");
|
2001-09-13 07:56:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2002-02-19 00:14:21 +00:00
|
|
|
* Show what's left in the packet as just raw TCP segment
|
|
|
|
* data.
|
2002-01-17 09:28:22 +00:00
|
|
|
* XXX - remember what protocol the last subdissector
|
2002-02-19 00:14:21 +00:00
|
|
|
* was, and report it as a continuation of that, instead?
|
2001-09-13 07:56:53 +00:00
|
|
|
*/
|
2002-02-19 00:14:21 +00:00
|
|
|
nbytes = tvb_reported_length_remaining(tvb, deseg_offset);
|
|
|
|
proto_tree_add_text(tcp_tree, tvb, deseg_offset, -1,
|
|
|
|
"TCP segment data (%u byte%s)", nbytes,
|
|
|
|
plurality(nbytes, "", "s"));
|
2001-09-13 07:56:53 +00:00
|
|
|
}
|
2001-12-05 08:20:30 +00:00
|
|
|
pinfo->can_desegment=0;
|
|
|
|
pinfo->desegment_offset = 0;
|
|
|
|
pinfo->desegment_len = 0;
|
2006-04-30 10:27:55 +00:00
|
|
|
|
|
|
|
if(another_pdu_follows){
|
2006-05-01 02:32:16 +00:00
|
|
|
/* there was another pdu following this one. */
|
2006-04-30 10:27:55 +00:00
|
|
|
pinfo->can_desegment=2;
|
2007-10-30 22:22:14 +00:00
|
|
|
/* we also have to prevent the dissector from changing the
|
|
|
|
* PROTOCOL and INFO colums since what follows may be an
|
2006-04-30 10:27:55 +00:00
|
|
|
* incomplete PDU and we dont want it be changed back from
|
|
|
|
* <Protocol> to <TCP>
|
|
|
|
* XXX There is no good way to block the PROTOCOL column
|
|
|
|
* from being changed yet so we set the entire row unwritable.
|
2009-08-24 09:05:23 +00:00
|
|
|
* The flag cleared_writable stores the initial state.
|
2006-04-30 10:27:55 +00:00
|
|
|
*/
|
|
|
|
col_set_fence(pinfo->cinfo, COL_INFO);
|
2009-08-24 09:05:23 +00:00
|
|
|
cleared_writable |= col_get_writable(pinfo->cinfo);
|
2006-04-30 10:27:55 +00:00
|
|
|
col_set_writable(pinfo->cinfo, FALSE);
|
2006-05-01 02:32:16 +00:00
|
|
|
offset += another_pdu_follows;
|
|
|
|
seq += another_pdu_follows;
|
|
|
|
goto again;
|
2009-08-24 09:05:23 +00:00
|
|
|
} else {
|
|
|
|
/* remove any blocking set above otherwise the
|
|
|
|
* proto,colinfo tap will break
|
|
|
|
*/
|
|
|
|
if(cleared_writable){
|
|
|
|
col_set_writable(pinfo->cinfo, TRUE);
|
|
|
|
}
|
2006-04-30 10:27:55 +00:00
|
|
|
}
|
2001-09-13 07:56:53 +00:00
|
|
|
}
|
|
|
|
|
Make a "tcp_dissect_pdus()" with the standard loop for a TCP segment,
extracting PDUs from it and possibly doing reassembly. Make the COPS,
DNS, DSI, Gryphon, and SCCP dissectors use it.
Add "set_actual_length()", "tcp_dissect_pdus()",
"decode_boolean_bitfield()", "decode_numeric_bitfield()", and
"decode_enumerated_bitfield()" to the list of routines available to
dissectors on platforms where routines in the main program aren't
available to dynamically-loaded code.
Declare routines in "to_str.h" as "extern"; as I remember, that's
necessary to allow the "decode_XXX_bitfield()" routines declared therein
to be made available to plugins as per the above.
Note that new exported routines should be added to the end of the table
if that's the only change being made to the table.
Create a new "plugin_api_decls.h" header file, used to declare both the
"p_" variables and the "p_" structure members in the routine-exporting
mechanism; this reduces the number of places you have to change to
change the list of exported routines.
svn path=/trunk/; revision=5394
2002-05-05 00:16:38 +00:00
|
|
|
/*
|
|
|
|
* Loop for dissecting PDUs within a TCP stream; assumes that a PDU
|
|
|
|
* consists of a fixed-length chunk of data that contains enough information
|
|
|
|
* to determine the length of the PDU, followed by rest of the PDU.
|
|
|
|
*
|
|
|
|
* The first three arguments are the arguments passed to the dissector
|
|
|
|
* that calls this routine.
|
|
|
|
*
|
|
|
|
* "proto_desegment" is the dissector's flag controlling whether it should
|
|
|
|
* desegment PDUs that cross TCP segment boundaries.
|
|
|
|
*
|
|
|
|
* "fixed_len" is the length of the fixed-length part of the PDU.
|
|
|
|
*
|
|
|
|
* "get_pdu_len()" is a routine called to get the length of the PDU from
|
2006-11-21 14:18:46 +00:00
|
|
|
* the fixed-length part of the PDU; it's passed "pinfo", "tvb" and "offset".
|
Make a "tcp_dissect_pdus()" with the standard loop for a TCP segment,
extracting PDUs from it and possibly doing reassembly. Make the COPS,
DNS, DSI, Gryphon, and SCCP dissectors use it.
Add "set_actual_length()", "tcp_dissect_pdus()",
"decode_boolean_bitfield()", "decode_numeric_bitfield()", and
"decode_enumerated_bitfield()" to the list of routines available to
dissectors on platforms where routines in the main program aren't
available to dynamically-loaded code.
Declare routines in "to_str.h" as "extern"; as I remember, that's
necessary to allow the "decode_XXX_bitfield()" routines declared therein
to be made available to plugins as per the above.
Note that new exported routines should be added to the end of the table
if that's the only change being made to the table.
Create a new "plugin_api_decls.h" header file, used to declare both the
"p_" variables and the "p_" structure members in the routine-exporting
mechanism; this reduces the number of places you have to change to
change the list of exported routines.
svn path=/trunk/; revision=5394
2002-05-05 00:16:38 +00:00
|
|
|
*
|
|
|
|
* "dissect_pdu()" is the routine to dissect a PDU.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
tcp_dissect_pdus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
2002-05-05 00:57:59 +00:00
|
|
|
gboolean proto_desegment, guint fixed_len,
|
2006-10-31 09:29:07 +00:00
|
|
|
guint (*get_pdu_len)(packet_info *, tvbuff_t *, int),
|
2005-06-03 06:31:58 +00:00
|
|
|
dissector_t dissect_pdu)
|
Make a "tcp_dissect_pdus()" with the standard loop for a TCP segment,
extracting PDUs from it and possibly doing reassembly. Make the COPS,
DNS, DSI, Gryphon, and SCCP dissectors use it.
Add "set_actual_length()", "tcp_dissect_pdus()",
"decode_boolean_bitfield()", "decode_numeric_bitfield()", and
"decode_enumerated_bitfield()" to the list of routines available to
dissectors on platforms where routines in the main program aren't
available to dynamically-loaded code.
Declare routines in "to_str.h" as "extern"; as I remember, that's
necessary to allow the "decode_XXX_bitfield()" routines declared therein
to be made available to plugins as per the above.
Note that new exported routines should be added to the end of the table
if that's the only change being made to the table.
Create a new "plugin_api_decls.h" header file, used to declare both the
"p_" variables and the "p_" structure members in the routine-exporting
mechanism; this reduces the number of places you have to change to
change the list of exported routines.
svn path=/trunk/; revision=5394
2002-05-05 00:16:38 +00:00
|
|
|
{
|
|
|
|
volatile int offset = 0;
|
2003-02-21 00:22:45 +00:00
|
|
|
int offset_before;
|
2002-05-05 00:57:59 +00:00
|
|
|
guint length_remaining;
|
Make a "tcp_dissect_pdus()" with the standard loop for a TCP segment,
extracting PDUs from it and possibly doing reassembly. Make the COPS,
DNS, DSI, Gryphon, and SCCP dissectors use it.
Add "set_actual_length()", "tcp_dissect_pdus()",
"decode_boolean_bitfield()", "decode_numeric_bitfield()", and
"decode_enumerated_bitfield()" to the list of routines available to
dissectors on platforms where routines in the main program aren't
available to dynamically-loaded code.
Declare routines in "to_str.h" as "extern"; as I remember, that's
necessary to allow the "decode_XXX_bitfield()" routines declared therein
to be made available to plugins as per the above.
Note that new exported routines should be added to the end of the table
if that's the only change being made to the table.
Create a new "plugin_api_decls.h" header file, used to declare both the
"p_" variables and the "p_" structure members in the routine-exporting
mechanism; this reduces the number of places you have to change to
change the list of exported routines.
svn path=/trunk/; revision=5394
2002-05-05 00:16:38 +00:00
|
|
|
guint plen;
|
2002-05-05 00:57:59 +00:00
|
|
|
guint length;
|
Make a "tcp_dissect_pdus()" with the standard loop for a TCP segment,
extracting PDUs from it and possibly doing reassembly. Make the COPS,
DNS, DSI, Gryphon, and SCCP dissectors use it.
Add "set_actual_length()", "tcp_dissect_pdus()",
"decode_boolean_bitfield()", "decode_numeric_bitfield()", and
"decode_enumerated_bitfield()" to the list of routines available to
dissectors on platforms where routines in the main program aren't
available to dynamically-loaded code.
Declare routines in "to_str.h" as "extern"; as I remember, that's
necessary to allow the "decode_XXX_bitfield()" routines declared therein
to be made available to plugins as per the above.
Note that new exported routines should be added to the end of the table
if that's the only change being made to the table.
Create a new "plugin_api_decls.h" header file, used to declare both the
"p_" variables and the "p_" structure members in the routine-exporting
mechanism; this reduces the number of places you have to change to
change the list of exported routines.
svn path=/trunk/; revision=5394
2002-05-05 00:16:38 +00:00
|
|
|
tvbuff_t *next_tvb;
|
2006-10-22 00:21:40 +00:00
|
|
|
proto_item *item=NULL;
|
Make a "tcp_dissect_pdus()" with the standard loop for a TCP segment,
extracting PDUs from it and possibly doing reassembly. Make the COPS,
DNS, DSI, Gryphon, and SCCP dissectors use it.
Add "set_actual_length()", "tcp_dissect_pdus()",
"decode_boolean_bitfield()", "decode_numeric_bitfield()", and
"decode_enumerated_bitfield()" to the list of routines available to
dissectors on platforms where routines in the main program aren't
available to dynamically-loaded code.
Declare routines in "to_str.h" as "extern"; as I remember, that's
necessary to allow the "decode_XXX_bitfield()" routines declared therein
to be made available to plugins as per the above.
Note that new exported routines should be added to the end of the table
if that's the only change being made to the table.
Create a new "plugin_api_decls.h" header file, used to declare both the
"p_" variables and the "p_" structure members in the routine-exporting
mechanism; this reduces the number of places you have to change to
change the list of exported routines.
svn path=/trunk/; revision=5394
2002-05-05 00:16:38 +00:00
|
|
|
|
|
|
|
while (tvb_reported_length_remaining(tvb, offset) != 0) {
|
2002-05-05 00:57:59 +00:00
|
|
|
/*
|
|
|
|
* We use "tvb_ensure_length_remaining()" to make sure there actually
|
|
|
|
* *is* data remaining. The protocol we're handling could conceivably
|
|
|
|
* consists of a sequence of fixed-length PDUs, and therefore the
|
|
|
|
* "get_pdu_len" routine might not actually fetch anything from
|
|
|
|
* the tvbuff, and thus might not cause an exception to be thrown if
|
|
|
|
* we've run past the end of the tvbuff.
|
|
|
|
*
|
|
|
|
* This means we're guaranteed that "length_remaining" is positive.
|
|
|
|
*/
|
|
|
|
length_remaining = tvb_ensure_length_remaining(tvb, offset);
|
Make a "tcp_dissect_pdus()" with the standard loop for a TCP segment,
extracting PDUs from it and possibly doing reassembly. Make the COPS,
DNS, DSI, Gryphon, and SCCP dissectors use it.
Add "set_actual_length()", "tcp_dissect_pdus()",
"decode_boolean_bitfield()", "decode_numeric_bitfield()", and
"decode_enumerated_bitfield()" to the list of routines available to
dissectors on platforms where routines in the main program aren't
available to dynamically-loaded code.
Declare routines in "to_str.h" as "extern"; as I remember, that's
necessary to allow the "decode_XXX_bitfield()" routines declared therein
to be made available to plugins as per the above.
Note that new exported routines should be added to the end of the table
if that's the only change being made to the table.
Create a new "plugin_api_decls.h" header file, used to declare both the
"p_" variables and the "p_" structure members in the routine-exporting
mechanism; this reduces the number of places you have to change to
change the list of exported routines.
svn path=/trunk/; revision=5394
2002-05-05 00:16:38 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Can we do reassembly?
|
|
|
|
*/
|
|
|
|
if (proto_desegment && pinfo->can_desegment) {
|
|
|
|
/*
|
|
|
|
* Yes - is the fixed-length part of the PDU split across segment
|
|
|
|
* boundaries?
|
|
|
|
*/
|
|
|
|
if (length_remaining < fixed_len) {
|
|
|
|
/*
|
|
|
|
* Yes. Tell the TCP dissector where the data for this message
|
|
|
|
* starts in the data it handed us, and how many more bytes we
|
|
|
|
* need, and return.
|
|
|
|
*/
|
|
|
|
pinfo->desegment_offset = offset;
|
2008-07-30 12:23:18 +00:00
|
|
|
pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT;
|
Make a "tcp_dissect_pdus()" with the standard loop for a TCP segment,
extracting PDUs from it and possibly doing reassembly. Make the COPS,
DNS, DSI, Gryphon, and SCCP dissectors use it.
Add "set_actual_length()", "tcp_dissect_pdus()",
"decode_boolean_bitfield()", "decode_numeric_bitfield()", and
"decode_enumerated_bitfield()" to the list of routines available to
dissectors on platforms where routines in the main program aren't
available to dynamically-loaded code.
Declare routines in "to_str.h" as "extern"; as I remember, that's
necessary to allow the "decode_XXX_bitfield()" routines declared therein
to be made available to plugins as per the above.
Note that new exported routines should be added to the end of the table
if that's the only change being made to the table.
Create a new "plugin_api_decls.h" header file, used to declare both the
"p_" variables and the "p_" structure members in the routine-exporting
mechanism; this reduces the number of places you have to change to
change the list of exported routines.
svn path=/trunk/; revision=5394
2002-05-05 00:16:38 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Get the length of the PDU.
|
|
|
|
*/
|
2006-10-31 09:29:07 +00:00
|
|
|
plen = (*get_pdu_len)(pinfo, tvb, offset);
|
2002-11-27 04:55:23 +00:00
|
|
|
if (plen < fixed_len) {
|
|
|
|
/*
|
2007-12-27 21:06:47 +00:00
|
|
|
* Either:
|
2002-11-27 04:55:23 +00:00
|
|
|
*
|
2007-12-27 21:06:47 +00:00
|
|
|
* 1) the length value extracted from the fixed-length portion
|
|
|
|
* doesn't include the fixed-length portion's length, and
|
|
|
|
* was so large that, when the fixed-length portion's
|
|
|
|
* length was added to it, the total length overflowed;
|
|
|
|
*
|
|
|
|
* 2) the length value extracted from the fixed-length portion
|
|
|
|
* includes the fixed-length portion's length, and the value
|
|
|
|
* was less than the fixed-length portion's length, i.e. it
|
|
|
|
* was bogus.
|
|
|
|
*
|
|
|
|
* Report this as a bounds error.
|
2002-11-27 04:55:23 +00:00
|
|
|
*/
|
|
|
|
show_reported_bounds_error(tvb, pinfo, tree);
|
|
|
|
return;
|
|
|
|
}
|
2006-10-22 00:21:40 +00:00
|
|
|
/*
|
2007-10-30 22:22:14 +00:00
|
|
|
* Display the PDU length as a field
|
|
|
|
*/
|
2008-07-30 12:23:18 +00:00
|
|
|
item=proto_tree_add_uint(pinfo->tcp_tree, hf_tcp_pdu_size, tvb, offset, plen, plen);
|
2006-10-22 00:21:40 +00:00
|
|
|
PROTO_ITEM_SET_GENERATED(item);
|
2007-10-30 22:22:14 +00:00
|
|
|
|
2006-10-22 00:21:40 +00:00
|
|
|
|
Make a "tcp_dissect_pdus()" with the standard loop for a TCP segment,
extracting PDUs from it and possibly doing reassembly. Make the COPS,
DNS, DSI, Gryphon, and SCCP dissectors use it.
Add "set_actual_length()", "tcp_dissect_pdus()",
"decode_boolean_bitfield()", "decode_numeric_bitfield()", and
"decode_enumerated_bitfield()" to the list of routines available to
dissectors on platforms where routines in the main program aren't
available to dynamically-loaded code.
Declare routines in "to_str.h" as "extern"; as I remember, that's
necessary to allow the "decode_XXX_bitfield()" routines declared therein
to be made available to plugins as per the above.
Note that new exported routines should be added to the end of the table
if that's the only change being made to the table.
Create a new "plugin_api_decls.h" header file, used to declare both the
"p_" variables and the "p_" structure members in the routine-exporting
mechanism; this reduces the number of places you have to change to
change the list of exported routines.
svn path=/trunk/; revision=5394
2002-05-05 00:16:38 +00:00
|
|
|
|
2004-03-19 06:14:03 +00:00
|
|
|
/* give a hint to TCP where the next PDU starts
|
|
|
|
* so that it can attempt to find it in case it starts
|
|
|
|
* somewhere in the middle of a segment.
|
|
|
|
*/
|
|
|
|
if(!pinfo->fd->flags.visited && tcp_analyze_seq){
|
2004-04-30 06:24:35 +00:00
|
|
|
guint remaining_bytes;
|
2004-03-19 06:14:03 +00:00
|
|
|
remaining_bytes=tvb_reported_length_remaining(tvb, offset);
|
|
|
|
if(plen>remaining_bytes){
|
|
|
|
pinfo->want_pdu_tracking=2;
|
|
|
|
pinfo->bytes_until_next_pdu=plen-remaining_bytes;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Make a "tcp_dissect_pdus()" with the standard loop for a TCP segment,
extracting PDUs from it and possibly doing reassembly. Make the COPS,
DNS, DSI, Gryphon, and SCCP dissectors use it.
Add "set_actual_length()", "tcp_dissect_pdus()",
"decode_boolean_bitfield()", "decode_numeric_bitfield()", and
"decode_enumerated_bitfield()" to the list of routines available to
dissectors on platforms where routines in the main program aren't
available to dynamically-loaded code.
Declare routines in "to_str.h" as "extern"; as I remember, that's
necessary to allow the "decode_XXX_bitfield()" routines declared therein
to be made available to plugins as per the above.
Note that new exported routines should be added to the end of the table
if that's the only change being made to the table.
Create a new "plugin_api_decls.h" header file, used to declare both the
"p_" variables and the "p_" structure members in the routine-exporting
mechanism; this reduces the number of places you have to change to
change the list of exported routines.
svn path=/trunk/; revision=5394
2002-05-05 00:16:38 +00:00
|
|
|
/*
|
|
|
|
* Can we do reassembly?
|
|
|
|
*/
|
|
|
|
if (proto_desegment && pinfo->can_desegment) {
|
|
|
|
/*
|
|
|
|
* Yes - is the PDU split across segment boundaries?
|
|
|
|
*/
|
2002-05-05 00:57:59 +00:00
|
|
|
if (length_remaining < plen) {
|
Make a "tcp_dissect_pdus()" with the standard loop for a TCP segment,
extracting PDUs from it and possibly doing reassembly. Make the COPS,
DNS, DSI, Gryphon, and SCCP dissectors use it.
Add "set_actual_length()", "tcp_dissect_pdus()",
"decode_boolean_bitfield()", "decode_numeric_bitfield()", and
"decode_enumerated_bitfield()" to the list of routines available to
dissectors on platforms where routines in the main program aren't
available to dynamically-loaded code.
Declare routines in "to_str.h" as "extern"; as I remember, that's
necessary to allow the "decode_XXX_bitfield()" routines declared therein
to be made available to plugins as per the above.
Note that new exported routines should be added to the end of the table
if that's the only change being made to the table.
Create a new "plugin_api_decls.h" header file, used to declare both the
"p_" variables and the "p_" structure members in the routine-exporting
mechanism; this reduces the number of places you have to change to
change the list of exported routines.
svn path=/trunk/; revision=5394
2002-05-05 00:16:38 +00:00
|
|
|
/*
|
|
|
|
* Yes. Tell the TCP dissector where the data for this message
|
|
|
|
* starts in the data it handed us, and how many more bytes we
|
|
|
|
* need, and return.
|
|
|
|
*/
|
|
|
|
pinfo->desegment_offset = offset;
|
|
|
|
pinfo->desegment_len = plen - length_remaining;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Construct a tvbuff containing the amount of the payload we have
|
|
|
|
* available. Make its reported length the amount of data in the PDU.
|
|
|
|
*
|
|
|
|
* XXX - if reassembly isn't enabled. the subdissector will throw a
|
|
|
|
* BoundsError exception, rather than a ReportedBoundsError exception.
|
|
|
|
* We really want a tvbuff where the length is "length", the reported
|
|
|
|
* length is "plen", and the "if the snapshot length were infinite"
|
|
|
|
* length is the minimum of the reported length of the tvbuff handed
|
|
|
|
* to us and "plen", with a new type of exception thrown if the offset
|
|
|
|
* is within the reported length but beyond that third length, with
|
|
|
|
* that exception getting the "Unreassembled Packet" error.
|
|
|
|
*/
|
|
|
|
length = length_remaining;
|
2002-05-05 00:57:59 +00:00
|
|
|
if (length > plen)
|
2008-08-20 05:56:31 +00:00
|
|
|
length = plen;
|
Make a "tcp_dissect_pdus()" with the standard loop for a TCP segment,
extracting PDUs from it and possibly doing reassembly. Make the COPS,
DNS, DSI, Gryphon, and SCCP dissectors use it.
Add "set_actual_length()", "tcp_dissect_pdus()",
"decode_boolean_bitfield()", "decode_numeric_bitfield()", and
"decode_enumerated_bitfield()" to the list of routines available to
dissectors on platforms where routines in the main program aren't
available to dynamically-loaded code.
Declare routines in "to_str.h" as "extern"; as I remember, that's
necessary to allow the "decode_XXX_bitfield()" routines declared therein
to be made available to plugins as per the above.
Note that new exported routines should be added to the end of the table
if that's the only change being made to the table.
Create a new "plugin_api_decls.h" header file, used to declare both the
"p_" variables and the "p_" structure members in the routine-exporting
mechanism; this reduces the number of places you have to change to
change the list of exported routines.
svn path=/trunk/; revision=5394
2002-05-05 00:16:38 +00:00
|
|
|
next_tvb = tvb_new_subset(tvb, offset, length, plen);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Dissect the PDU.
|
|
|
|
*
|
|
|
|
* Catch the ReportedBoundsError exception; if this particular message
|
|
|
|
* happens to get a ReportedBoundsError exception, that doesn't mean
|
|
|
|
* that we should stop dissecting PDUs within this frame or chunk of
|
|
|
|
* reassembled data.
|
|
|
|
*
|
|
|
|
* If it gets a BoundsError, we can stop, as there's nothing more to
|
|
|
|
* see, so we just re-throw it.
|
|
|
|
*/
|
|
|
|
TRY {
|
|
|
|
(*dissect_pdu)(next_tvb, pinfo, tree);
|
|
|
|
}
|
|
|
|
CATCH(BoundsError) {
|
|
|
|
RETHROW;
|
|
|
|
}
|
|
|
|
CATCH(ReportedBoundsError) {
|
2006-08-20 05:18:10 +00:00
|
|
|
show_reported_bounds_error(tvb, pinfo, tree);
|
Make a "tcp_dissect_pdus()" with the standard loop for a TCP segment,
extracting PDUs from it and possibly doing reassembly. Make the COPS,
DNS, DSI, Gryphon, and SCCP dissectors use it.
Add "set_actual_length()", "tcp_dissect_pdus()",
"decode_boolean_bitfield()", "decode_numeric_bitfield()", and
"decode_enumerated_bitfield()" to the list of routines available to
dissectors on platforms where routines in the main program aren't
available to dynamically-loaded code.
Declare routines in "to_str.h" as "extern"; as I remember, that's
necessary to allow the "decode_XXX_bitfield()" routines declared therein
to be made available to plugins as per the above.
Note that new exported routines should be added to the end of the table
if that's the only change being made to the table.
Create a new "plugin_api_decls.h" header file, used to declare both the
"p_" variables and the "p_" structure members in the routine-exporting
mechanism; this reduces the number of places you have to change to
change the list of exported routines.
svn path=/trunk/; revision=5394
2002-05-05 00:16:38 +00:00
|
|
|
}
|
|
|
|
ENDTRY;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Step to the next PDU.
|
2003-02-21 00:22:45 +00:00
|
|
|
* Make sure we don't overflow.
|
Make a "tcp_dissect_pdus()" with the standard loop for a TCP segment,
extracting PDUs from it and possibly doing reassembly. Make the COPS,
DNS, DSI, Gryphon, and SCCP dissectors use it.
Add "set_actual_length()", "tcp_dissect_pdus()",
"decode_boolean_bitfield()", "decode_numeric_bitfield()", and
"decode_enumerated_bitfield()" to the list of routines available to
dissectors on platforms where routines in the main program aren't
available to dynamically-loaded code.
Declare routines in "to_str.h" as "extern"; as I remember, that's
necessary to allow the "decode_XXX_bitfield()" routines declared therein
to be made available to plugins as per the above.
Note that new exported routines should be added to the end of the table
if that's the only change being made to the table.
Create a new "plugin_api_decls.h" header file, used to declare both the
"p_" variables and the "p_" structure members in the routine-exporting
mechanism; this reduces the number of places you have to change to
change the list of exported routines.
svn path=/trunk/; revision=5394
2002-05-05 00:16:38 +00:00
|
|
|
*/
|
2003-02-21 00:22:45 +00:00
|
|
|
offset_before = offset;
|
Make a "tcp_dissect_pdus()" with the standard loop for a TCP segment,
extracting PDUs from it and possibly doing reassembly. Make the COPS,
DNS, DSI, Gryphon, and SCCP dissectors use it.
Add "set_actual_length()", "tcp_dissect_pdus()",
"decode_boolean_bitfield()", "decode_numeric_bitfield()", and
"decode_enumerated_bitfield()" to the list of routines available to
dissectors on platforms where routines in the main program aren't
available to dynamically-loaded code.
Declare routines in "to_str.h" as "extern"; as I remember, that's
necessary to allow the "decode_XXX_bitfield()" routines declared therein
to be made available to plugins as per the above.
Note that new exported routines should be added to the end of the table
if that's the only change being made to the table.
Create a new "plugin_api_decls.h" header file, used to declare both the
"p_" variables and the "p_" structure members in the routine-exporting
mechanism; this reduces the number of places you have to change to
change the list of exported routines.
svn path=/trunk/; revision=5394
2002-05-05 00:16:38 +00:00
|
|
|
offset += plen;
|
2003-02-21 00:22:45 +00:00
|
|
|
if (offset <= offset_before)
|
|
|
|
break;
|
Make a "tcp_dissect_pdus()" with the standard loop for a TCP segment,
extracting PDUs from it and possibly doing reassembly. Make the COPS,
DNS, DSI, Gryphon, and SCCP dissectors use it.
Add "set_actual_length()", "tcp_dissect_pdus()",
"decode_boolean_bitfield()", "decode_numeric_bitfield()", and
"decode_enumerated_bitfield()" to the list of routines available to
dissectors on platforms where routines in the main program aren't
available to dynamically-loaded code.
Declare routines in "to_str.h" as "extern"; as I remember, that's
necessary to allow the "decode_XXX_bitfield()" routines declared therein
to be made available to plugins as per the above.
Note that new exported routines should be added to the end of the table
if that's the only change being made to the table.
Create a new "plugin_api_decls.h" header file, used to declare both the
"p_" variables and the "p_" structure members in the routine-exporting
mechanism; this reduces the number of places you have to change to
change the list of exported routines.
svn path=/trunk/; revision=5394
2002-05-05 00:16:38 +00:00
|
|
|
}
|
|
|
|
}
|
2001-09-13 07:56:53 +00:00
|
|
|
|
1998-12-21 03:43:29 +00:00
|
|
|
static void
|
2001-12-10 00:26:21 +00:00
|
|
|
tcp_info_append_uint(packet_info *pinfo, const char *abbrev, guint32 val)
|
Add a "col_clear()" routine, to clear a column; it appears (and it
doesn't just seem to be a profiling artifact) that, at least on FreeBSD
3.4, it's significantly more efficient to clear out a column by stuffing
a '\0' into the first byte of the column data than to do so by copying a
null string (I guess when copying one byte, the fixed overhead of the
procedure call and of "strcpy()" is significant).
Have the TCP dissector set the Protocol column, and clear the Info
column, before doing anything that might cause an exception to be
thrown, so that if we *do* get an exception thrown, the frame at least
shows up as TCP.
Instead of, in the TCP dissector, constructing a string and then
stuffing it into the Info column, just append to the Info column, which
avoids one string copy.
Pass a "frame_data" pointer to dissectors for TCP and IP (and PPP)
options, so they can use it to append to the Info column.
svn path=/trunk/; revision=2744
2000-12-04 06:37:46 +00:00
|
|
|
{
|
2010-01-15 07:32:04 +00:00
|
|
|
col_append_fstr(pinfo->cinfo, COL_INFO, " %s=%u", abbrev, val);
|
1998-12-21 03:58:00 +00:00
|
|
|
}
|
1998-12-21 03:43:29 +00:00
|
|
|
|
2008-08-12 21:08:46 +00:00
|
|
|
/* Supports the reporting the contents of a parsed SCPS capabilities vector */
|
|
|
|
static void
|
|
|
|
tcp_info_append_str(packet_info *pinfo, const char *abbrev, const char *val)
|
|
|
|
{
|
2010-01-15 07:32:04 +00:00
|
|
|
col_append_fstr(pinfo->cinfo, COL_INFO, " %s[%s]", abbrev, val);
|
2008-08-12 21:08:46 +00:00
|
|
|
}
|
|
|
|
|
1998-10-13 05:40:04 +00:00
|
|
|
static void
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
dissect_tcpopt_maxseg(const ip_tcp_opt *optp, tvbuff_t *tvb,
|
2001-12-10 00:26:21 +00:00
|
|
|
int offset, guint optlen, packet_info *pinfo, proto_tree *opt_tree)
|
1998-10-13 05:40:04 +00:00
|
|
|
{
|
2008-05-13 01:23:37 +00:00
|
|
|
proto_item *hidden_item;
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
guint16 mss;
|
|
|
|
|
|
|
|
mss = tvb_get_ntohs(tvb, offset + 2);
|
2008-05-13 01:23:37 +00:00
|
|
|
hidden_item = proto_tree_add_boolean(opt_tree, hf_tcp_option_mss, tvb, offset,
|
2003-03-01 07:07:07 +00:00
|
|
|
optlen, TRUE);
|
2008-05-13 01:23:37 +00:00
|
|
|
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
2003-03-03 02:59:23 +00:00
|
|
|
proto_tree_add_uint_format(opt_tree, hf_tcp_option_mss_val, tvb, offset,
|
|
|
|
optlen, mss, "%s: %u bytes", optp->name, mss);
|
2001-12-10 00:26:21 +00:00
|
|
|
tcp_info_append_uint(pinfo, "MSS", mss);
|
1998-10-13 05:40:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
dissect_tcpopt_wscale(const ip_tcp_opt *optp, tvbuff_t *tvb,
|
2001-12-10 00:26:21 +00:00
|
|
|
int offset, guint optlen, packet_info *pinfo, proto_tree *opt_tree)
|
1998-10-13 05:40:04 +00:00
|
|
|
{
|
2008-05-13 01:23:37 +00:00
|
|
|
proto_item *hidden_item;
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
guint8 ws;
|
2006-01-26 22:50:16 +00:00
|
|
|
struct tcp_analysis *tcpd=NULL;
|
|
|
|
|
2008-09-30 12:24:27 +00:00
|
|
|
tcpd=get_tcp_conversation_data(NULL,pinfo);
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
|
|
|
|
ws = tvb_get_guint8(tvb, offset + 2);
|
2008-05-13 01:23:37 +00:00
|
|
|
hidden_item = proto_tree_add_boolean(opt_tree, hf_tcp_option_wscale, tvb,
|
2003-03-01 07:07:07 +00:00
|
|
|
offset, optlen, TRUE);
|
2008-05-13 01:23:37 +00:00
|
|
|
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
2003-03-03 02:59:23 +00:00
|
|
|
proto_tree_add_uint_format(opt_tree, hf_tcp_option_wscale_val, tvb,
|
2006-01-30 23:29:09 +00:00
|
|
|
offset, optlen, ws, "%s: %u (multiply by %u)",
|
2003-03-03 02:59:23 +00:00
|
|
|
optp->name, ws, 1 << ws);
|
2001-12-10 00:26:21 +00:00
|
|
|
tcp_info_append_uint(pinfo, "WS", ws);
|
2003-09-18 19:19:51 +00:00
|
|
|
if(!pinfo->fd->flags.visited && tcp_analyze_seq && tcp_relative_seq){
|
2006-01-26 22:50:16 +00:00
|
|
|
pdu_store_window_scale_option(ws, tcpd);
|
2003-09-12 05:52:38 +00:00
|
|
|
}
|
1998-10-13 05:40:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
dissect_tcpopt_sack(const ip_tcp_opt *optp, tvbuff_t *tvb,
|
2001-12-10 00:26:21 +00:00
|
|
|
int offset, guint optlen, packet_info *pinfo, proto_tree *opt_tree)
|
1998-10-13 05:40:04 +00:00
|
|
|
{
|
1999-03-23 03:14:46 +00:00
|
|
|
proto_tree *field_tree = NULL;
|
2005-01-20 13:19:11 +00:00
|
|
|
proto_item *tf=NULL;
|
2008-05-13 01:23:37 +00:00
|
|
|
proto_item *hidden_item;
|
2005-01-20 12:29:11 +00:00
|
|
|
guint32 leftedge, rightedge;
|
|
|
|
struct tcp_analysis *tcpd=NULL;
|
|
|
|
guint32 base_ack=0;
|
|
|
|
|
2005-02-14 19:34:59 +00:00
|
|
|
if(tcp_analyze_seq && tcp_relative_seq){
|
2005-01-20 12:29:11 +00:00
|
|
|
/* find(or create if needed) the conversation for this tcp session */
|
2008-09-30 12:24:27 +00:00
|
|
|
tcpd=get_tcp_conversation_data(NULL,pinfo);
|
2005-01-20 12:29:11 +00:00
|
|
|
|
2007-11-08 00:58:38 +00:00
|
|
|
if (tcpd) {
|
|
|
|
base_ack=tcpd->rev->base_seq;
|
|
|
|
}
|
2005-01-20 12:29:11 +00:00
|
|
|
}
|
1998-10-13 05:40:04 +00:00
|
|
|
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
tf = proto_tree_add_text(opt_tree, tvb, offset, optlen, "%s:", optp->name);
|
1998-10-13 05:40:04 +00:00
|
|
|
offset += 2; /* skip past type and length */
|
|
|
|
optlen -= 2; /* subtract size of type and length */
|
|
|
|
while (optlen > 0) {
|
|
|
|
if (field_tree == NULL) {
|
|
|
|
/* Haven't yet made a subtree out of this option. Do so. */
|
1999-11-16 11:44:20 +00:00
|
|
|
field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
|
2008-05-13 01:23:37 +00:00
|
|
|
hidden_item = proto_tree_add_boolean(field_tree, hf_tcp_option_sack, tvb,
|
2003-03-04 04:36:44 +00:00
|
|
|
offset, optlen, TRUE);
|
2008-05-13 01:23:37 +00:00
|
|
|
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
1998-10-13 05:40:04 +00:00
|
|
|
}
|
|
|
|
if (optlen < 4) {
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
proto_tree_add_text(field_tree, tvb, offset, optlen,
|
1998-10-13 05:40:04 +00:00
|
|
|
"(suboption would go past end of option)");
|
|
|
|
break;
|
|
|
|
}
|
2005-01-20 13:19:11 +00:00
|
|
|
leftedge = tvb_get_ntohl(tvb, offset)-base_ack;
|
2006-01-30 23:29:09 +00:00
|
|
|
proto_tree_add_uint_format(field_tree, hf_tcp_option_sack_sle, tvb,
|
|
|
|
offset, 4, leftedge,
|
2005-01-24 00:18:13 +00:00
|
|
|
"left edge = %u%s", leftedge,
|
|
|
|
tcp_relative_seq ? " (relative)" : "");
|
2005-01-20 12:29:11 +00:00
|
|
|
|
1998-10-13 05:40:04 +00:00
|
|
|
optlen -= 4;
|
|
|
|
if (optlen < 4) {
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
proto_tree_add_text(field_tree, tvb, offset, optlen,
|
1998-10-13 05:40:04 +00:00
|
|
|
"(suboption would go past end of option)");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* XXX - check whether it goes past end of packet */
|
2005-01-20 13:19:11 +00:00
|
|
|
rightedge = tvb_get_ntohl(tvb, offset + 4)-base_ack;
|
1998-10-13 05:40:04 +00:00
|
|
|
optlen -= 4;
|
2006-01-30 23:29:09 +00:00
|
|
|
proto_tree_add_uint_format(field_tree, hf_tcp_option_sack_sre, tvb,
|
|
|
|
offset+4, 4, rightedge,
|
2005-01-24 00:18:13 +00:00
|
|
|
"right edge = %u%s", rightedge,
|
|
|
|
tcp_relative_seq ? " (relative)" : "");
|
2005-01-20 13:19:11 +00:00
|
|
|
tcp_info_append_uint(pinfo, "SLE", leftedge);
|
|
|
|
tcp_info_append_uint(pinfo, "SRE", rightedge);
|
|
|
|
proto_item_append_text(field_tree, " %u-%u", leftedge, rightedge);
|
1998-10-13 05:40:04 +00:00
|
|
|
offset += 8;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
dissect_tcpopt_echo(const ip_tcp_opt *optp, tvbuff_t *tvb,
|
2001-12-10 00:26:21 +00:00
|
|
|
int offset, guint optlen, packet_info *pinfo, proto_tree *opt_tree)
|
1998-10-13 05:40:04 +00:00
|
|
|
{
|
2008-05-13 01:23:37 +00:00
|
|
|
proto_item *hidden_item;
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
guint32 echo;
|
|
|
|
|
|
|
|
echo = tvb_get_ntohl(tvb, offset + 2);
|
2008-05-13 01:23:37 +00:00
|
|
|
hidden_item = proto_tree_add_boolean(opt_tree, hf_tcp_option_echo, tvb, offset,
|
2003-03-01 07:07:07 +00:00
|
|
|
optlen, TRUE);
|
2008-05-13 01:23:37 +00:00
|
|
|
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
proto_tree_add_text(opt_tree, tvb, offset, optlen,
|
|
|
|
"%s: %u", optp->name, echo);
|
2001-12-10 00:26:21 +00:00
|
|
|
tcp_info_append_uint(pinfo, "ECHO", echo);
|
1998-10-13 05:40:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
dissect_tcpopt_timestamp(const ip_tcp_opt *optp, tvbuff_t *tvb,
|
2001-12-10 00:26:21 +00:00
|
|
|
int offset, guint optlen, packet_info *pinfo, proto_tree *opt_tree)
|
1998-10-13 05:40:04 +00:00
|
|
|
{
|
2008-05-13 01:23:37 +00:00
|
|
|
proto_item *hidden_item;
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
guint32 tsv, tser;
|
|
|
|
|
|
|
|
tsv = tvb_get_ntohl(tvb, offset + 2);
|
|
|
|
tser = tvb_get_ntohl(tvb, offset + 6);
|
2008-05-13 01:23:37 +00:00
|
|
|
hidden_item = proto_tree_add_boolean(opt_tree, hf_tcp_option_time_stamp, tvb,
|
2003-03-01 07:15:04 +00:00
|
|
|
offset, optlen, TRUE);
|
2008-05-13 01:23:37 +00:00
|
|
|
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
proto_tree_add_text(opt_tree, tvb, offset, optlen,
|
2006-10-17 06:01:54 +00:00
|
|
|
"%s: TSval %u, TSecr %u", optp->name, tsv, tser);
|
2001-12-10 00:26:21 +00:00
|
|
|
tcp_info_append_uint(pinfo, "TSV", tsv);
|
|
|
|
tcp_info_append_uint(pinfo, "TSER", tser);
|
1998-10-13 05:40:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
dissect_tcpopt_cc(const ip_tcp_opt *optp, tvbuff_t *tvb,
|
2001-12-10 00:26:21 +00:00
|
|
|
int offset, guint optlen, packet_info *pinfo, proto_tree *opt_tree)
|
1998-10-13 05:40:04 +00:00
|
|
|
{
|
2008-05-13 01:23:37 +00:00
|
|
|
proto_item *hidden_item;
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
guint32 cc;
|
|
|
|
|
|
|
|
cc = tvb_get_ntohl(tvb, offset + 2);
|
2008-05-13 01:23:37 +00:00
|
|
|
hidden_item = proto_tree_add_boolean(opt_tree, hf_tcp_option_cc, tvb, offset,
|
2003-03-01 07:15:04 +00:00
|
|
|
optlen, TRUE);
|
2008-05-13 01:23:37 +00:00
|
|
|
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
proto_tree_add_text(opt_tree, tvb, offset, optlen,
|
|
|
|
"%s: %u", optp->name, cc);
|
2001-12-10 00:26:21 +00:00
|
|
|
tcp_info_append_uint(pinfo, "CC", cc);
|
1998-10-13 05:40:04 +00:00
|
|
|
}
|
|
|
|
|
2007-06-04 23:27:12 +00:00
|
|
|
static void
|
|
|
|
dissect_tcpopt_qs(const ip_tcp_opt *optp, tvbuff_t *tvb,
|
|
|
|
int offset, guint optlen, packet_info *pinfo, proto_tree *opt_tree)
|
|
|
|
{
|
|
|
|
/* Quick-Start TCP option, as defined by RFC4782 */
|
|
|
|
static const value_string qs_rates[] = {
|
|
|
|
{ 0, "0 bit/s"},
|
|
|
|
{ 1, "80 kbit/s"},
|
|
|
|
{ 2, "160 kbit/s"},
|
|
|
|
{ 3, "320 kbit/s"},
|
|
|
|
{ 4, "640 kbit/s"},
|
|
|
|
{ 5, "1.28 Mbit/s"},
|
|
|
|
{ 6, "2.56 Mbit/s"},
|
2007-10-30 22:22:14 +00:00
|
|
|
{ 7, "5.12 Mbit/s"},
|
2007-06-04 23:27:12 +00:00
|
|
|
{ 8, "10.24 Mbit/s"},
|
|
|
|
{ 9, "20.48 Mbit/s"},
|
|
|
|
{10, "40.96 Mbit/s"},
|
|
|
|
{11, "81.92 Mbit/s"},
|
|
|
|
{12, "163.84 Mbit/s"},
|
|
|
|
{13, "327.68 Mbit/s"},
|
|
|
|
{14, "655.36 Mbit/s"},
|
|
|
|
{15, "1.31072 Gbit/s"},
|
|
|
|
{0, NULL}
|
|
|
|
};
|
2008-05-13 01:23:37 +00:00
|
|
|
proto_item *hidden_item;
|
2007-06-04 23:27:12 +00:00
|
|
|
|
|
|
|
guint8 rate = tvb_get_guint8(tvb, offset + 2) & 0x0f;
|
|
|
|
|
2008-05-13 01:23:37 +00:00
|
|
|
hidden_item = proto_tree_add_boolean(opt_tree, hf_tcp_option_qs, tvb, offset,
|
2007-06-04 23:27:12 +00:00
|
|
|
optlen, TRUE);
|
2008-05-13 01:23:37 +00:00
|
|
|
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
2007-06-04 23:27:12 +00:00
|
|
|
proto_tree_add_text(opt_tree, tvb, offset, optlen,
|
2007-10-30 22:22:14 +00:00
|
|
|
"%s: Rate response, %s, TTL diff %u ", optp->name,
|
|
|
|
val_to_str(rate, qs_rates, "Unknown"),
|
2007-06-04 23:27:12 +00:00
|
|
|
tvb_get_guint8(tvb, offset + 3));
|
2010-01-15 07:32:04 +00:00
|
|
|
col_append_fstr(pinfo->cinfo, COL_INFO, " QSresp=%s", val_to_str(rate, qs_rates, "Unknown"));
|
2007-06-04 23:27:12 +00:00
|
|
|
}
|
|
|
|
|
2008-08-12 21:08:46 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
dissect_tcpopt_scps(const ip_tcp_opt *optp, tvbuff_t *tvb,
|
2008-12-09 17:50:02 +00:00
|
|
|
int offset, guint optlen, packet_info *pinfo,
|
2008-08-12 21:08:46 +00:00
|
|
|
proto_tree *opt_tree)
|
|
|
|
{
|
2009-10-25 11:43:30 +00:00
|
|
|
struct tcp_analysis *tcpd;
|
2008-08-12 21:08:46 +00:00
|
|
|
proto_tree *field_tree = NULL;
|
|
|
|
tcp_flow_t *flow;
|
|
|
|
int direction;
|
2008-08-20 05:42:35 +00:00
|
|
|
proto_item *tf = NULL, *hidden_item;
|
2008-08-12 21:08:46 +00:00
|
|
|
gchar flags[64] = "<None>";
|
2008-08-20 05:56:31 +00:00
|
|
|
gchar *fstr[] = {"BETS", "SNACK1", "SNACK2", "COMP", "NLTS", "RESV1", "RESV2", "RESV3"};
|
2008-08-13 15:23:15 +00:00
|
|
|
gint i, bpos;
|
2008-08-12 21:08:46 +00:00
|
|
|
guint8 capvector;
|
|
|
|
guint8 connid;
|
|
|
|
|
2008-09-30 12:24:27 +00:00
|
|
|
tcpd = get_tcp_conversation_data(NULL,pinfo);
|
2008-08-12 21:08:46 +00:00
|
|
|
|
|
|
|
/* check direction and get ua lists */
|
|
|
|
direction=CMP_ADDRESS(&pinfo->src, &pinfo->dst);
|
|
|
|
|
|
|
|
/* if the addresses are equal, match the ports instead */
|
|
|
|
if(direction==0) {
|
2008-08-20 05:56:31 +00:00
|
|
|
direction= (pinfo->srcport > pinfo->destport) ? 1 : -1;
|
2008-08-12 21:08:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(direction>=0)
|
|
|
|
flow =&(tcpd->flow1);
|
|
|
|
else
|
|
|
|
flow =&(tcpd->flow2);
|
|
|
|
|
2008-12-09 17:50:02 +00:00
|
|
|
/* If the option length == 4, this is a real SCPS capability option
|
2008-08-12 21:08:46 +00:00
|
|
|
* See "CCSDS 714.0-B-2 (CCSDS Recommended Standard for SCPS Transport Protocol
|
|
|
|
* (SCPS-TP)" Section 3.2.3 for definition.
|
|
|
|
*/
|
|
|
|
if (optlen == 4) {
|
|
|
|
capvector = tvb_get_guint8(tvb, offset + 2);
|
2008-08-13 15:23:15 +00:00
|
|
|
flags[0] = '\0';
|
2008-08-12 21:08:46 +00:00
|
|
|
|
|
|
|
/* Decode the capabilities vector for display */
|
|
|
|
for (i = 0; i < 5; i++) {
|
|
|
|
bpos = 128 >> i;
|
|
|
|
if (capvector & bpos) {
|
2008-08-20 05:56:31 +00:00
|
|
|
if (flags[0]) {
|
|
|
|
g_strlcat(flags, ", ", 64);
|
|
|
|
}
|
|
|
|
g_strlcat(flags, fstr[i], 64);
|
2008-08-12 21:08:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If lossless header compression is offered, there will be a
|
|
|
|
* single octet connectionId following the capabilities vector
|
|
|
|
*/
|
|
|
|
if (capvector & 0x10)
|
|
|
|
connid = tvb_get_guint8(tvb, offset + 3);
|
|
|
|
else
|
|
|
|
connid = 0;
|
|
|
|
|
|
|
|
tf = proto_tree_add_uint_format(opt_tree, hf_tcp_option_scps_vector, tvb,
|
|
|
|
offset, optlen, capvector,
|
|
|
|
"%s: 0x%02x (%s)",
|
|
|
|
optp->name, capvector, flags);
|
2008-08-20 05:42:35 +00:00
|
|
|
hidden_item = proto_tree_add_boolean(opt_tree, hf_tcp_option_scps,
|
|
|
|
tvb, offset, optlen, TRUE);
|
|
|
|
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
2008-08-12 21:08:46 +00:00
|
|
|
|
|
|
|
field_tree = proto_item_add_subtree(tf, ett_tcp_option_scps);
|
|
|
|
|
|
|
|
proto_tree_add_boolean(field_tree, hf_tcp_scpsoption_flags_bets, tvb,
|
|
|
|
offset + 13, 1, capvector);
|
|
|
|
proto_tree_add_boolean(field_tree, hf_tcp_scpsoption_flags_snack1, tvb,
|
|
|
|
offset + 13, 1, capvector);
|
|
|
|
proto_tree_add_boolean(field_tree, hf_tcp_scpsoption_flags_snack2, tvb,
|
|
|
|
offset + 13, 1, capvector);
|
|
|
|
proto_tree_add_boolean(field_tree, hf_tcp_scpsoption_flags_compress, tvb,
|
|
|
|
offset + 13, 1, capvector);
|
|
|
|
proto_tree_add_boolean(field_tree, hf_tcp_scpsoption_flags_nlts, tvb,
|
|
|
|
offset + 13, 1, capvector);
|
|
|
|
proto_tree_add_boolean(field_tree, hf_tcp_scpsoption_flags_resv1, tvb,
|
|
|
|
offset + 13, 1, capvector);
|
|
|
|
proto_tree_add_boolean(field_tree, hf_tcp_scpsoption_flags_resv2, tvb,
|
|
|
|
offset + 13, 1, capvector);
|
|
|
|
proto_tree_add_boolean(field_tree, hf_tcp_scpsoption_flags_resv3, tvb,
|
|
|
|
offset + 13, 1, capvector);
|
|
|
|
|
|
|
|
tcp_info_append_str(pinfo, "SCPS", flags);
|
|
|
|
|
|
|
|
flow->scps_capable = 1;
|
|
|
|
|
|
|
|
if (connid)
|
|
|
|
tcp_info_append_uint(pinfo, "Connection ID", connid);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* The option length != 4, so this is an infamous "extended capabilities
|
|
|
|
* option. See "CCSDS 714.0-B-2 (CCSDS Recommended Standard for SCPS
|
|
|
|
* Transport Protocol (SCPS-TP)" Section 3.2.5 for definition.
|
|
|
|
*
|
|
|
|
* As the format of this option is only partially defined (it is
|
|
|
|
* a community (or more likely vendor) defined format beyond that, so
|
|
|
|
* at least for now, we only parse the standardized portion of the option.
|
|
|
|
*/
|
|
|
|
guint8 local_offset = 2;
|
|
|
|
guint8 binding_space;
|
|
|
|
guint8 extended_cap_length;
|
|
|
|
|
|
|
|
if (flow->scps_capable != 1) {
|
|
|
|
/* There was no SCPS capabilities option preceeding this */
|
|
|
|
tf = proto_tree_add_uint_format(opt_tree, hf_tcp_option_scps_vector,
|
|
|
|
tvb, offset, optlen, 0, "%s: (%d %s)",
|
|
|
|
"Illegal SCPS Extended Capabilities",
|
|
|
|
(optlen),
|
|
|
|
"bytes");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
tf = proto_tree_add_uint_format(opt_tree, hf_tcp_option_scps_vector,
|
|
|
|
tvb, offset, optlen, 0, "%s: (%d %s)",
|
|
|
|
"SCPS Extended Capabilities",
|
|
|
|
(optlen),
|
|
|
|
"bytes");
|
|
|
|
field_tree=proto_item_add_subtree(tf, ett_tcp_option_scps_extended);
|
|
|
|
/* There may be multiple binding spaces included in a single option,
|
|
|
|
* so we will semi-parse each of the stacked binding spaces - skipping
|
|
|
|
* over the octets following the binding space identifier and length.
|
|
|
|
*/
|
|
|
|
|
|
|
|
while (optlen > local_offset) {
|
|
|
|
|
2010-01-22 17:41:47 +00:00
|
|
|
/* 1st octet is Extended Capability Binding Space */
|
|
|
|
binding_space = tvb_get_guint8(tvb, (offset + local_offset));
|
2008-08-12 21:08:46 +00:00
|
|
|
|
2010-01-22 17:41:47 +00:00
|
|
|
/* 2nd octet (upper 4-bits) has binding space length in 16-bit words.
|
|
|
|
* As defined by the specification, this length is exclusive of the
|
|
|
|
* octets containing the extended capability type and length
|
|
|
|
*/
|
2008-08-12 21:08:46 +00:00
|
|
|
|
2010-01-22 17:41:47 +00:00
|
|
|
extended_cap_length =
|
|
|
|
(tvb_get_guint8(tvb, (offset + local_offset + 1)) >> 4);
|
2008-08-12 21:08:46 +00:00
|
|
|
|
2010-01-22 17:41:47 +00:00
|
|
|
/* Convert the extended capabilities length into bytes for display */
|
|
|
|
extended_cap_length = (extended_cap_length << 1);
|
2008-08-12 21:08:46 +00:00
|
|
|
|
2010-01-22 17:41:47 +00:00
|
|
|
proto_tree_add_text(field_tree, tvb, offset + local_offset, 2,
|
|
|
|
"\tBinding Space %u",
|
|
|
|
binding_space);
|
|
|
|
hidden_item = proto_tree_add_uint(field_tree, hf_tcp_option_scps_binding,
|
|
|
|
tvb, (offset + local_offset), 1,
|
|
|
|
binding_space);
|
2008-08-12 21:08:46 +00:00
|
|
|
|
2010-01-22 17:41:47 +00:00
|
|
|
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
2008-08-12 21:08:46 +00:00
|
|
|
|
2010-01-22 17:41:47 +00:00
|
|
|
/* Step past the binding space and length octets */
|
|
|
|
local_offset += 2;
|
2008-08-12 21:08:46 +00:00
|
|
|
|
2010-01-22 17:41:47 +00:00
|
|
|
proto_tree_add_text(field_tree, tvb, offset + local_offset,
|
|
|
|
extended_cap_length,
|
|
|
|
"\tBinding Space Data (%u bytes)",
|
|
|
|
extended_cap_length);
|
2008-08-12 21:08:46 +00:00
|
|
|
|
2010-01-22 17:41:47 +00:00
|
|
|
tcp_info_append_uint(pinfo, "EXCAP", binding_space);
|
2008-08-12 21:08:46 +00:00
|
|
|
|
2010-01-22 17:41:47 +00:00
|
|
|
/* Step past the Extended capability data
|
|
|
|
* Treat the extended capability data area as opaque;
|
|
|
|
* If one desires to parse the extended capability data
|
|
|
|
* (say, in a vendor aware build of wireshark), it would
|
|
|
|
* be trigged here.
|
|
|
|
*/
|
|
|
|
local_offset += extended_cap_length;
|
2008-08-12 21:08:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-09 17:50:02 +00:00
|
|
|
/* This is called for SYN+ACK packets and the purpose is to verify that
|
2008-08-12 21:08:46 +00:00
|
|
|
* the SCPS capabilities option has been successfully negotiated for the flow.
|
2008-12-09 17:50:02 +00:00
|
|
|
* If the SCPS capabilities option was offered by only one party, the
|
2008-08-12 21:08:46 +00:00
|
|
|
* proactively set scps_capable attribute of the flow (set upon seeing
|
|
|
|
* the first instance of the SCPS option) is revoked.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
verify_scps(packet_info *pinfo, proto_item *tf_syn, struct tcp_analysis *tcpd)
|
|
|
|
{
|
|
|
|
tf_syn = 0x0;
|
|
|
|
|
|
|
|
if(tcpd) {
|
|
|
|
if ((!(tcpd->flow1.scps_capable)) || (!(tcpd->flow2.scps_capable))) {
|
|
|
|
tcpd->flow1.scps_capable = 0;
|
|
|
|
tcpd->flow2.scps_capable = 0;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
expert_add_info_format(pinfo, tf_syn, PI_SEQUENCE, PI_NOTE,
|
|
|
|
"Connection establish request (SYN-ACK): SCPS Capabilities Negotiated");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* See "CCSDS 714.0-B-2 (CCSDS Recommended Standard for SCPS
|
|
|
|
* Transport Protocol (SCPS-TP)" Section 3.5 for definition of the SNACK option
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
dissect_tcpopt_snack(const ip_tcp_opt *optp, tvbuff_t *tvb,
|
2008-12-09 17:50:02 +00:00
|
|
|
int offset, guint optlen, packet_info *pinfo,
|
2008-08-12 21:08:46 +00:00
|
|
|
proto_tree *opt_tree)
|
|
|
|
{
|
|
|
|
struct tcp_analysis *tcpd=NULL;
|
|
|
|
guint16 relative_hole_offset;
|
|
|
|
guint16 relative_hole_size;
|
|
|
|
guint16 base_mss = 0;
|
|
|
|
guint32 ack;
|
|
|
|
guint32 hole_start;
|
|
|
|
guint32 hole_end;
|
2008-08-13 21:44:53 +00:00
|
|
|
char null_modifier[] = "\0";
|
|
|
|
char relative_modifier[] = "(relative)";
|
|
|
|
char *modifier = null_modifier;
|
2008-08-12 21:08:46 +00:00
|
|
|
proto_item *hidden_item;
|
|
|
|
|
2008-09-30 12:24:27 +00:00
|
|
|
tcpd = get_tcp_conversation_data(NULL,pinfo);
|
2008-08-12 21:08:46 +00:00
|
|
|
|
|
|
|
/* The SNACK option reports missing data with a granualarity of segments. */
|
|
|
|
relative_hole_offset = tvb_get_ntohs(tvb, offset + 2);
|
|
|
|
relative_hole_size = tvb_get_ntohs(tvb, offset + 4);
|
|
|
|
|
2008-12-09 17:50:02 +00:00
|
|
|
hidden_item = proto_tree_add_boolean(opt_tree, hf_tcp_option_snack, tvb,
|
2008-08-12 21:08:46 +00:00
|
|
|
offset, optlen, TRUE);
|
|
|
|
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
2008-12-09 17:50:02 +00:00
|
|
|
|
2008-08-12 21:08:46 +00:00
|
|
|
hidden_item = proto_tree_add_uint(opt_tree, hf_tcp_option_snack_offset,
|
|
|
|
tvb, offset, optlen, relative_hole_offset);
|
|
|
|
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
|
|
|
|
|
|
|
hidden_item = proto_tree_add_uint(opt_tree, hf_tcp_option_snack_size,
|
|
|
|
tvb, offset, optlen, relative_hole_size);
|
|
|
|
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
|
|
|
proto_tree_add_text(opt_tree, tvb, offset, optlen,
|
|
|
|
"%s: Offset %u, Size %u", optp->name,
|
|
|
|
relative_hole_offset, relative_hole_size);
|
|
|
|
|
|
|
|
ack = tvb_get_ntohl(tvb, 8);
|
|
|
|
|
2008-08-20 05:56:31 +00:00
|
|
|
if (tcp_relative_seq) {
|
2008-08-12 21:08:46 +00:00
|
|
|
ack -= tcpd->rev->base_seq;
|
2008-08-13 21:44:53 +00:00
|
|
|
modifier = relative_modifier;
|
2008-08-12 21:08:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* To aid analysis, we can use a simple but generally effective heuristic
|
|
|
|
* to report the most likely boundaries of the missing data. If the
|
|
|
|
* flow is scps_capable, we track the maximum sized segment that was
|
|
|
|
* acknowledged by the receiver and use that as the reporting granularity.
|
|
|
|
* This may be different from the negotiated MTU due to PMTUD or flows
|
|
|
|
* that do not send max-sized segments.
|
|
|
|
*/
|
|
|
|
base_mss = tcpd->fwd->maxsizeacked;
|
|
|
|
|
|
|
|
if (base_mss) {
|
|
|
|
/* Scale the reported offset and hole size by the largest segment acked */
|
|
|
|
hole_start = ack + (base_mss * relative_hole_offset);
|
|
|
|
hole_end = hole_start + (base_mss * relative_hole_size);
|
|
|
|
|
|
|
|
hidden_item = proto_tree_add_uint(opt_tree, hf_tcp_option_snack_le,
|
|
|
|
tvb, offset, optlen, hole_start);
|
|
|
|
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
|
|
|
|
|
|
|
hidden_item = proto_tree_add_uint(opt_tree, hf_tcp_option_snack_re,
|
|
|
|
tvb, offset, optlen, hole_end);
|
|
|
|
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
|
|
|
proto_tree_add_text(opt_tree, tvb, offset, optlen,
|
|
|
|
"\tMissing Sequence %u - %u %s",
|
|
|
|
hole_start, hole_end, modifier);
|
|
|
|
|
|
|
|
tcp_info_append_uint(pinfo, "SNLE", hole_start);
|
|
|
|
tcp_info_append_uint(pinfo, "SNRE", hole_end);
|
|
|
|
|
|
|
|
expert_add_info_format(pinfo, NULL, PI_SEQUENCE, PI_NOTE,
|
|
|
|
"SNACK Sequence %u - %u %s",
|
|
|
|
hole_start, hole_end, modifier);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-08-28 08:31:28 +00:00
|
|
|
static const ip_tcp_opt tcpopts[] = {
|
1998-10-13 05:40:04 +00:00
|
|
|
{
|
|
|
|
TCPOPT_EOL,
|
|
|
|
"EOL",
|
1999-11-16 11:44:20 +00:00
|
|
|
NULL,
|
1998-10-13 05:40:04 +00:00
|
|
|
NO_LENGTH,
|
|
|
|
0,
|
|
|
|
NULL,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
TCPOPT_NOP,
|
|
|
|
"NOP",
|
1999-11-16 11:44:20 +00:00
|
|
|
NULL,
|
1998-10-13 05:40:04 +00:00
|
|
|
NO_LENGTH,
|
|
|
|
0,
|
|
|
|
NULL,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
TCPOPT_MSS,
|
|
|
|
"Maximum segment size",
|
1999-11-16 11:44:20 +00:00
|
|
|
NULL,
|
1998-10-13 05:40:04 +00:00
|
|
|
FIXED_LENGTH,
|
|
|
|
TCPOLEN_MSS,
|
|
|
|
dissect_tcpopt_maxseg
|
|
|
|
},
|
|
|
|
{
|
|
|
|
TCPOPT_WINDOW,
|
|
|
|
"Window scale",
|
1999-11-16 11:44:20 +00:00
|
|
|
NULL,
|
1998-10-13 05:40:04 +00:00
|
|
|
FIXED_LENGTH,
|
|
|
|
TCPOLEN_WINDOW,
|
|
|
|
dissect_tcpopt_wscale
|
|
|
|
},
|
|
|
|
{
|
|
|
|
TCPOPT_SACK_PERM,
|
|
|
|
"SACK permitted",
|
1999-11-16 11:44:20 +00:00
|
|
|
NULL,
|
1998-10-13 05:40:04 +00:00
|
|
|
FIXED_LENGTH,
|
|
|
|
TCPOLEN_SACK_PERM,
|
|
|
|
NULL,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
TCPOPT_SACK,
|
|
|
|
"SACK",
|
1999-11-16 11:44:20 +00:00
|
|
|
&ett_tcp_option_sack,
|
1998-10-13 05:40:04 +00:00
|
|
|
VARIABLE_LENGTH,
|
|
|
|
TCPOLEN_SACK_MIN,
|
|
|
|
dissect_tcpopt_sack
|
|
|
|
},
|
|
|
|
{
|
|
|
|
TCPOPT_ECHO,
|
|
|
|
"Echo",
|
1999-11-16 11:44:20 +00:00
|
|
|
NULL,
|
1998-10-13 05:40:04 +00:00
|
|
|
FIXED_LENGTH,
|
|
|
|
TCPOLEN_ECHO,
|
|
|
|
dissect_tcpopt_echo
|
|
|
|
},
|
|
|
|
{
|
|
|
|
TCPOPT_ECHOREPLY,
|
|
|
|
"Echo reply",
|
1999-11-16 11:44:20 +00:00
|
|
|
NULL,
|
1998-10-13 05:40:04 +00:00
|
|
|
FIXED_LENGTH,
|
|
|
|
TCPOLEN_ECHOREPLY,
|
|
|
|
dissect_tcpopt_echo
|
|
|
|
},
|
|
|
|
{
|
|
|
|
TCPOPT_TIMESTAMP,
|
2006-10-17 06:01:54 +00:00
|
|
|
"Timestamps",
|
1999-11-16 11:44:20 +00:00
|
|
|
NULL,
|
1998-10-13 05:40:04 +00:00
|
|
|
FIXED_LENGTH,
|
|
|
|
TCPOLEN_TIMESTAMP,
|
|
|
|
dissect_tcpopt_timestamp
|
|
|
|
},
|
|
|
|
{
|
|
|
|
TCPOPT_CC,
|
|
|
|
"CC",
|
1999-11-16 11:44:20 +00:00
|
|
|
NULL,
|
1998-10-13 05:40:04 +00:00
|
|
|
FIXED_LENGTH,
|
|
|
|
TCPOLEN_CC,
|
|
|
|
dissect_tcpopt_cc
|
|
|
|
},
|
|
|
|
{
|
|
|
|
TCPOPT_CCNEW,
|
|
|
|
"CC.NEW",
|
1999-11-16 11:44:20 +00:00
|
|
|
NULL,
|
1998-10-13 05:40:04 +00:00
|
|
|
FIXED_LENGTH,
|
2001-09-27 10:10:08 +00:00
|
|
|
TCPOLEN_CCNEW,
|
1998-10-13 05:40:04 +00:00
|
|
|
dissect_tcpopt_cc
|
|
|
|
},
|
|
|
|
{
|
|
|
|
TCPOPT_CCECHO,
|
|
|
|
"CC.ECHO",
|
1999-11-16 11:44:20 +00:00
|
|
|
NULL,
|
1998-10-13 05:40:04 +00:00
|
|
|
FIXED_LENGTH,
|
|
|
|
TCPOLEN_CCECHO,
|
|
|
|
dissect_tcpopt_cc
|
2000-12-30 05:23:56 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
TCPOPT_MD5,
|
|
|
|
"TCP MD5 signature",
|
|
|
|
NULL,
|
|
|
|
FIXED_LENGTH,
|
|
|
|
TCPOLEN_MD5,
|
|
|
|
NULL
|
2007-06-04 23:27:12 +00:00
|
|
|
},
|
2008-08-12 21:08:46 +00:00
|
|
|
{
|
|
|
|
TCPOPT_SCPS,
|
2008-12-17 00:08:38 +00:00
|
|
|
"SCPS capabilities",
|
2008-08-12 21:08:46 +00:00
|
|
|
&ett_tcp_option_scps,
|
|
|
|
VARIABLE_LENGTH,
|
|
|
|
TCPOLEN_SCPS,
|
|
|
|
dissect_tcpopt_scps
|
|
|
|
},
|
|
|
|
{
|
|
|
|
TCPOPT_SNACK,
|
2008-08-20 05:40:25 +00:00
|
|
|
"Selective Negative Acknowledgement",
|
2008-08-12 21:08:46 +00:00
|
|
|
NULL,
|
|
|
|
FIXED_LENGTH,
|
|
|
|
TCPOLEN_SNACK,
|
|
|
|
dissect_tcpopt_snack
|
|
|
|
},
|
2008-10-15 17:51:57 +00:00
|
|
|
{
|
|
|
|
TCPOPT_RECBOUND,
|
|
|
|
"SCPS record boundary",
|
|
|
|
NULL,
|
|
|
|
FIXED_LENGTH,
|
|
|
|
TCPOLEN_RECBOUND,
|
|
|
|
NULL
|
|
|
|
},
|
|
|
|
{
|
|
|
|
TCPOPT_CORREXP,
|
|
|
|
"SCPS corruption experienced",
|
|
|
|
NULL,
|
|
|
|
FIXED_LENGTH,
|
|
|
|
TCPOLEN_CORREXP,
|
|
|
|
NULL
|
|
|
|
},
|
2007-06-04 23:27:12 +00:00
|
|
|
{
|
|
|
|
TCPOPT_QS,
|
|
|
|
"Quick-Start",
|
|
|
|
NULL,
|
|
|
|
FIXED_LENGTH,
|
|
|
|
TCPOLEN_QS,
|
|
|
|
dissect_tcpopt_qs
|
1998-10-13 05:40:04 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
#define N_TCP_OPTS (sizeof tcpopts / sizeof tcpopts[0])
|
|
|
|
|
2003-11-08 05:47:12 +00:00
|
|
|
/* Determine if there is a sub-dissector and call it; return TRUE
|
|
|
|
if there was a sub-dissector, FALSE otherwise.
|
|
|
|
|
|
|
|
This has been separated into a stand alone routine to other protocol
|
|
|
|
dissectors can call to it, e.g., SOCKS. */
|
2000-04-12 22:53:16 +00:00
|
|
|
|
2003-07-24 21:11:20 +00:00
|
|
|
static gboolean try_heuristic_first = FALSE;
|
|
|
|
|
2006-03-02 09:33:49 +00:00
|
|
|
|
|
|
|
/* this function can be called with tcpd==NULL as from the msproxy dissector */
|
2003-11-08 05:47:12 +00:00
|
|
|
gboolean
|
|
|
|
decode_tcp_ports(tvbuff_t *tvb, int offset, packet_info *pinfo,
|
2006-03-02 09:33:49 +00:00
|
|
|
proto_tree *tree, int src_port, int dst_port,
|
|
|
|
struct tcp_analysis *tcpd)
|
Allow either old-style (pre-tvbuff) or new-style (tvbuffified)
dissectors to be registered as dissectors for particular ports,
registered as heuristic dissectors, and registered as dissectors for
conversations, and have routines to be used both by old-style and
new-style dissectors to call registered dissectors.
Have the code that calls those dissectors translate the arguments as
necessary. (For conversation dissectors, replace
"find_conversation_dissector()", which just returns a pointer to the
dissector, with "old_try_conversation_dissector()" and
"try_conversation_dissector()", which actually call the dissector, so
that there's a single place at which we can do that translation. Also
make "dissector_lookup()" static and, instead of calling it and, if it
returns a non-null pointer, calling that dissector, just use
"old_dissector_try_port()" or "dissector_try_port()", for the same
reason.)
This allows some dissectors that took old-style arguments and
immediately translated them to new-style arguments to just take
new-style arguments; make them do so. It also allows some new-style
dissectors not to have to translate arguments before calling routines to
look up and call dissectors; make them not do so.
Get rid of checks for too-short frames in new-style dissectors - the
tvbuff code does those checks for you.
Give the routines to register old-style dissectors, and to call
dissectors from old-style dissectors, names beginning with "old_", with
the routines for new-style dissectors not having the "old_". Update the
dissectors that use those routines appropriately.
Rename "dissect_data()" to "old_dissect_data()", and
"dissect_data_tvb()" to "dissect_data()".
svn path=/trunk/; revision=2218
2000-08-07 03:21:25 +00:00
|
|
|
{
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
tvbuff_t *next_tvb;
|
2002-06-08 21:54:52 +00:00
|
|
|
int low_port, high_port;
|
2006-05-01 02:32:16 +00:00
|
|
|
int save_desegment_offset;
|
|
|
|
guint32 save_desegment_len;
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
|
2006-03-02 09:33:49 +00:00
|
|
|
/* dont call subdissectors for keepalive or zerowindowprobes
|
2006-05-01 02:32:16 +00:00
|
|
|
* even though they do contain payload "data"
|
2006-03-02 09:33:49 +00:00
|
|
|
* keeaplives just contain garbage and zwp contain too little data (1 byte)
|
|
|
|
* so why bother.
|
|
|
|
*/
|
|
|
|
if(tcpd && tcpd->ta){
|
|
|
|
if(tcpd->ta->flags&(TCP_A_ZERO_WINDOW_PROBE|TCP_A_KEEP_ALIVE)){
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-16 12:36:22 +00:00
|
|
|
next_tvb = tvb_new_subset_remaining(tvb, offset);
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
|
2000-04-17 02:39:55 +00:00
|
|
|
/* determine if this packet is part of a conversation and call dissector */
|
|
|
|
/* for the conversation if available */
|
|
|
|
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
if (try_conversation_dissector(&pinfo->src, &pinfo->dst, PT_TCP,
|
2004-02-24 09:40:38 +00:00
|
|
|
src_port, dst_port, next_tvb, pinfo, tree)){
|
|
|
|
pinfo->want_pdu_tracking -= !!(pinfo->want_pdu_tracking);
|
2003-11-08 05:47:12 +00:00
|
|
|
return TRUE;
|
2004-02-24 09:40:38 +00:00
|
|
|
}
|
2000-04-12 22:53:16 +00:00
|
|
|
|
2003-07-24 21:11:20 +00:00
|
|
|
if (try_heuristic_first) {
|
|
|
|
/* do lookup with the heuristic subdissector table */
|
2006-05-01 02:32:16 +00:00
|
|
|
save_desegment_offset = pinfo->desegment_offset;
|
|
|
|
save_desegment_len = pinfo->desegment_len;
|
2004-02-24 09:40:38 +00:00
|
|
|
if (dissector_try_heuristic(heur_subdissector_list, next_tvb, pinfo, tree)){
|
|
|
|
pinfo->want_pdu_tracking -= !!(pinfo->want_pdu_tracking);
|
2003-11-08 05:47:12 +00:00
|
|
|
return TRUE;
|
2004-02-24 09:40:38 +00:00
|
|
|
}
|
2006-05-01 02:32:16 +00:00
|
|
|
/*
|
|
|
|
* They rejected the packet; make sure they didn't also request
|
|
|
|
* desegmentation (we could just override the request, but
|
|
|
|
* rejecting a packet *and* requesting desegmentation is a sign
|
|
|
|
* of the dissector's code needing clearer thought, so we fail
|
|
|
|
* so that the problem is made more obvious).
|
|
|
|
*/
|
|
|
|
DISSECTOR_ASSERT(save_desegment_offset == pinfo->desegment_offset &&
|
|
|
|
save_desegment_len == pinfo->desegment_len);
|
2003-07-24 21:11:20 +00:00
|
|
|
}
|
|
|
|
|
2002-06-08 21:54:52 +00:00
|
|
|
/* Do lookups with the subdissector table.
|
|
|
|
We try the port number with the lower value first, followed by the
|
|
|
|
port number with the higher value. This means that, for packets
|
|
|
|
where a dissector is registered for *both* port numbers:
|
|
|
|
|
|
|
|
1) we pick the same dissector for traffic going in both directions;
|
|
|
|
|
|
|
|
2) we prefer the port number that's more likely to be the right
|
|
|
|
one (as that prefers well-known ports to reserved ports);
|
|
|
|
|
|
|
|
although there is, of course, no guarantee that any such strategy
|
|
|
|
will always pick the right port number.
|
|
|
|
|
|
|
|
XXX - we ignore port numbers of 0, as some dissectors use a port
|
|
|
|
number of 0 to disable the port. */
|
|
|
|
if (src_port > dst_port) {
|
|
|
|
low_port = dst_port;
|
|
|
|
high_port = src_port;
|
|
|
|
} else {
|
|
|
|
low_port = src_port;
|
|
|
|
high_port = dst_port;
|
|
|
|
}
|
|
|
|
if (low_port != 0 &&
|
2004-02-24 09:40:38 +00:00
|
|
|
dissector_try_port(subdissector_table, low_port, next_tvb, pinfo, tree)){
|
|
|
|
pinfo->want_pdu_tracking -= !!(pinfo->want_pdu_tracking);
|
2003-11-08 05:47:12 +00:00
|
|
|
return TRUE;
|
2004-02-24 09:40:38 +00:00
|
|
|
}
|
2002-06-08 21:54:52 +00:00
|
|
|
if (high_port != 0 &&
|
2004-02-24 09:40:38 +00:00
|
|
|
dissector_try_port(subdissector_table, high_port, next_tvb, pinfo, tree)){
|
|
|
|
pinfo->want_pdu_tracking -= !!(pinfo->want_pdu_tracking);
|
2003-11-08 05:47:12 +00:00
|
|
|
return TRUE;
|
2004-02-24 09:40:38 +00:00
|
|
|
}
|
2000-04-12 22:53:16 +00:00
|
|
|
|
2003-07-24 21:11:20 +00:00
|
|
|
if (!try_heuristic_first) {
|
|
|
|
/* do lookup with the heuristic subdissector table */
|
2006-05-01 02:32:16 +00:00
|
|
|
save_desegment_offset = pinfo->desegment_offset;
|
|
|
|
save_desegment_len = pinfo->desegment_len;
|
2004-02-24 09:40:38 +00:00
|
|
|
if (dissector_try_heuristic(heur_subdissector_list, next_tvb, pinfo, tree)){
|
|
|
|
pinfo->want_pdu_tracking -= !!(pinfo->want_pdu_tracking);
|
2003-11-08 05:47:12 +00:00
|
|
|
return TRUE;
|
2004-02-24 09:40:38 +00:00
|
|
|
}
|
2006-05-01 02:32:16 +00:00
|
|
|
/*
|
|
|
|
* They rejected the packet; make sure they didn't also request
|
|
|
|
* desegmentation (we could just override the request, but
|
|
|
|
* rejecting a packet *and* requesting desegmentation is a sign
|
|
|
|
* of the dissector's code needing clearer thought, so we fail
|
|
|
|
* so that the problem is made more obvious).
|
|
|
|
*/
|
|
|
|
DISSECTOR_ASSERT(save_desegment_offset == pinfo->desegment_offset &&
|
|
|
|
save_desegment_len == pinfo->desegment_len);
|
2003-07-24 21:11:20 +00:00
|
|
|
}
|
2000-04-12 22:53:16 +00:00
|
|
|
|
Add routines to:
register lists of "heuristic" dissectors, which are handed a
frame that may or may contain a payload for the protocol they
dissect, and that return FALSE if it's not or dissect the packet
and return TRUE if it is;
add a dissector to such a list;
go through such a list, calling each dissector until either a
dissector returns TRUE, in which case the routine returns TRUE,
or it runs out of entries in the list, in which case the routine
returns FALSE.
Have lists of heuristic dissectors for TCP and for COTP when used with
the Inactive Subset of CLNP, and add the GIOP and Yahoo Messenger
dissectors to the first list and the Sinec H1 dissector to the second
list.
Make the dissector name argument to "dissector_add()" and
"dissector_delete()" a "const char *" rarther than just a "char *".
Add "heur_dissector_add()", the routine to add a heuristic dissector to
a list of heuristic dissectors, to the set of routines we can export to
plugins through a table on platforms where dynamically-loaded code can't
call stuff in the main program, and initialize the element in the table
in question for "dissector_add()" (which we'd forgotten to do).
svn path=/trunk/; revision=1909
2000-05-05 09:32:36 +00:00
|
|
|
/* Oh, well, we don't know this; dissect it as data. */
|
2001-11-26 04:52:51 +00:00
|
|
|
call_dissector(data_handle,next_tvb, pinfo, tree);
|
2004-02-24 09:40:38 +00:00
|
|
|
|
|
|
|
pinfo->want_pdu_tracking -= !!(pinfo->want_pdu_tracking);
|
2003-11-08 05:47:12 +00:00
|
|
|
return FALSE;
|
2000-04-12 22:53:16 +00:00
|
|
|
}
|
|
|
|
|
2003-11-08 00:02:56 +00:00
|
|
|
static void
|
2003-11-08 05:47:12 +00:00
|
|
|
process_tcp_payload(tvbuff_t *tvb, volatile int offset, packet_info *pinfo,
|
2003-11-08 00:02:56 +00:00
|
|
|
proto_tree *tree, proto_tree *tcp_tree, int src_port, int dst_port,
|
2006-01-26 22:50:16 +00:00
|
|
|
guint32 seq, guint32 nxtseq, gboolean is_tcp_segment,
|
|
|
|
struct tcp_analysis *tcpd)
|
2003-11-06 08:51:21 +00:00
|
|
|
{
|
2004-02-24 09:40:38 +00:00
|
|
|
pinfo->want_pdu_tracking=0;
|
|
|
|
|
2003-11-06 08:51:21 +00:00
|
|
|
TRY {
|
2003-11-08 05:47:12 +00:00
|
|
|
if(is_tcp_segment){
|
|
|
|
/*qqq see if it is an unaligned PDU */
|
2007-11-08 00:58:38 +00:00
|
|
|
if(tcpd && tcp_analyze_seq && (!tcp_desegment)){
|
2004-03-19 06:14:03 +00:00
|
|
|
if(seq || nxtseq){
|
2004-04-23 04:58:54 +00:00
|
|
|
offset=scan_for_next_pdu(tvb, tcp_tree, pinfo, offset,
|
2007-04-06 07:01:01 +00:00
|
|
|
seq, nxtseq, tcpd->fwd->multisegment_pdus);
|
2004-03-19 06:14:03 +00:00
|
|
|
}
|
2003-11-08 05:47:12 +00:00
|
|
|
}
|
|
|
|
}
|
2004-03-19 06:14:03 +00:00
|
|
|
/* if offset is -1 this means that this segment is known
|
|
|
|
* to be fully inside a previously detected pdu
|
|
|
|
* so we dont even need to try to dissect it either.
|
|
|
|
*/
|
|
|
|
if( (offset!=-1) &&
|
|
|
|
decode_tcp_ports(tvb, offset, pinfo, tree, src_port,
|
2006-03-02 09:33:49 +00:00
|
|
|
dst_port, tcpd) ){
|
2003-11-08 05:47:12 +00:00
|
|
|
/*
|
|
|
|
* We succeeded in handing off to a subdissector.
|
|
|
|
*
|
|
|
|
* Is this a TCP segment or a reassembled chunk of
|
|
|
|
* TCP payload?
|
|
|
|
*/
|
|
|
|
if(is_tcp_segment){
|
|
|
|
/* if !visited, check want_pdu_tracking and
|
|
|
|
store it in table */
|
2007-11-08 00:58:38 +00:00
|
|
|
if(tcpd && (!pinfo->fd->flags.visited) &&
|
2003-11-08 05:47:12 +00:00
|
|
|
tcp_analyze_seq && pinfo->want_pdu_tracking){
|
2004-03-19 06:14:03 +00:00
|
|
|
if(seq || nxtseq){
|
|
|
|
pdu_store_sequencenumber_of_next_pdu(
|
|
|
|
pinfo,
|
2008-08-20 05:56:31 +00:00
|
|
|
seq,
|
2006-01-26 22:50:16 +00:00
|
|
|
nxtseq+pinfo->bytes_until_next_pdu,
|
2007-04-06 07:01:01 +00:00
|
|
|
tcpd->fwd->multisegment_pdus);
|
2004-03-19 06:14:03 +00:00
|
|
|
}
|
2003-11-08 05:47:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2003-11-06 08:51:21 +00:00
|
|
|
}
|
|
|
|
CATCH_ALL {
|
|
|
|
/* We got an exception. At this point the dissection is
|
|
|
|
* completely aborted and execution will be transfered back
|
|
|
|
* to (probably) the frame dissector.
|
|
|
|
* Here we have to place whatever we want the dissector
|
|
|
|
* to do before aborting the tcp dissection.
|
|
|
|
*/
|
2003-11-06 09:18:46 +00:00
|
|
|
/*
|
2003-11-08 05:47:12 +00:00
|
|
|
* Is this a TCP segment or a reassembled chunk of TCP
|
|
|
|
* payload?
|
2003-11-06 09:18:46 +00:00
|
|
|
*/
|
2003-11-08 05:47:12 +00:00
|
|
|
if(is_tcp_segment){
|
2003-11-08 00:02:56 +00:00
|
|
|
/*
|
2003-11-08 05:47:12 +00:00
|
|
|
* It's from a TCP segment.
|
2003-11-08 00:02:56 +00:00
|
|
|
*
|
2003-11-08 05:47:12 +00:00
|
|
|
* if !visited, check want_pdu_tracking and store it
|
2006-01-30 23:29:09 +00:00
|
|
|
* in table
|
2003-11-08 00:02:56 +00:00
|
|
|
*/
|
2007-11-08 00:58:38 +00:00
|
|
|
if(tcpd && (!pinfo->fd->flags.visited) && tcp_analyze_seq && pinfo->want_pdu_tracking){
|
2004-03-19 06:14:03 +00:00
|
|
|
if(seq || nxtseq){
|
|
|
|
pdu_store_sequencenumber_of_next_pdu(pinfo,
|
2008-08-20 05:56:31 +00:00
|
|
|
seq,
|
2006-01-26 22:50:16 +00:00
|
|
|
nxtseq+pinfo->bytes_until_next_pdu,
|
2007-04-06 07:01:01 +00:00
|
|
|
tcpd->fwd->multisegment_pdus);
|
2004-03-19 06:14:03 +00:00
|
|
|
}
|
2003-11-08 00:02:56 +00:00
|
|
|
}
|
2003-11-06 09:18:46 +00:00
|
|
|
}
|
2003-11-06 08:51:21 +00:00
|
|
|
RETHROW;
|
|
|
|
}
|
|
|
|
ENDTRY;
|
|
|
|
}
|
|
|
|
|
2003-12-30 00:03:48 +00:00
|
|
|
void
|
|
|
|
dissect_tcp_payload(tvbuff_t *tvb, packet_info *pinfo, int offset, guint32 seq,
|
|
|
|
guint32 nxtseq, guint32 sport, guint32 dport,
|
2006-01-26 22:50:16 +00:00
|
|
|
proto_tree *tree, proto_tree *tcp_tree,
|
|
|
|
struct tcp_analysis *tcpd)
|
2003-12-30 00:03:48 +00:00
|
|
|
{
|
|
|
|
gboolean save_fragmented;
|
|
|
|
|
|
|
|
/* Can we desegment this segment? */
|
|
|
|
if (pinfo->can_desegment) {
|
|
|
|
/* Yes. */
|
|
|
|
desegment_tcp(tvb, pinfo, offset, seq, nxtseq, sport, dport, tree,
|
2006-01-26 22:50:16 +00:00
|
|
|
tcp_tree, tcpd);
|
2003-12-30 00:03:48 +00:00
|
|
|
} else {
|
|
|
|
/* No - just call the subdissector.
|
|
|
|
Mark this as fragmented, so if somebody throws an exception,
|
|
|
|
we don't report it as a malformed frame. */
|
|
|
|
save_fragmented = pinfo->fragmented;
|
|
|
|
pinfo->fragmented = TRUE;
|
|
|
|
process_tcp_payload(tvb, offset, pinfo, tree, tcp_tree, sport, dport,
|
2006-01-26 22:50:16 +00:00
|
|
|
seq, nxtseq, TRUE, tcpd);
|
2003-12-30 00:03:48 +00:00
|
|
|
pinfo->fragmented = save_fragmented;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-04-20 07:05:58 +00:00
|
|
|
static void
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
|
{
|
Have a flag in the "packet_info" structure, which indicates whether the
stuff currently being dissected is part of a packet included in an error
packet (e.g., an ICMP Unreachable packet). Have the TCP dissector not
bother doing reassembly if the TCP segment is part of an error packet,
rather than an actual TCP transmission; other dissectors might want to
treat those packets specially as well.
Add to the "tcpinfo" structure a flag indicating whether the URG flag
was set, rather than having the zero or non-zero value of the urgent
pointer indicate that. (Yes, at least as I read RFC 793, a zero urgent
pointer value isn't useful, as it means "the stuff before this segment
is urgent", but it's certainly possible to put onto the wire a TCP
segment with URG set and a zero urgent pointer.)
Don't dissect the TCP header by grabbing the entire header with
"tvb_memcpy()" and then pulling stuff out of it - extract stuff with
individual tvbuff calls, and put stuff into the protocol tree and the
Info column as we extract it, so that we can dissect a partial header.
This lets us, for example, get the source and destination ports from the
TCP header of the part of a TCP segment included in a minimum-length
ICMPv4 error packet.
svn path=/trunk/; revision=3986
2001-10-01 08:29:37 +00:00
|
|
|
guint8 th_off_x2; /* combines th_off and th_x2 */
|
|
|
|
guint16 th_sum;
|
|
|
|
guint16 th_urp;
|
2003-11-08 00:02:56 +00:00
|
|
|
proto_tree *tcp_tree = NULL, *field_tree = NULL;
|
2008-05-15 13:22:06 +00:00
|
|
|
proto_item *ti = NULL, *tf, *hidden_item;
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
int offset = 0;
|
2009-03-27 23:05:37 +00:00
|
|
|
emem_strbuf_t *flags_strbuf = ep_strbuf_new_label("<None>");
|
2008-08-20 05:56:31 +00:00
|
|
|
const gchar *fstr[] = {"FIN", "SYN", "RST", "PSH", "ACK", "URG", "ECN", "CWR"};
|
2006-01-16 07:59:44 +00:00
|
|
|
gint i;
|
1998-09-16 02:39:15 +00:00
|
|
|
guint bpos;
|
1998-10-13 05:40:04 +00:00
|
|
|
guint optlen;
|
2003-05-21 05:43:27 +00:00
|
|
|
guint32 nxtseq = 0;
|
2000-12-13 02:24:23 +00:00
|
|
|
guint reported_len;
|
|
|
|
vec_t cksum_vec[4];
|
|
|
|
guint32 phdr[2];
|
|
|
|
guint16 computed_cksum;
|
2004-08-26 10:03:40 +00:00
|
|
|
guint16 real_window;
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
guint length_remaining;
|
2002-01-18 22:35:19 +00:00
|
|
|
gboolean desegment_ok;
|
Have a flag in the "packet_info" structure, which indicates whether the
stuff currently being dissected is part of a packet included in an error
packet (e.g., an ICMP Unreachable packet). Have the TCP dissector not
bother doing reassembly if the TCP segment is part of an error packet,
rather than an actual TCP transmission; other dissectors might want to
treat those packets specially as well.
Add to the "tcpinfo" structure a flag indicating whether the URG flag
was set, rather than having the zero or non-zero value of the urgent
pointer indicate that. (Yes, at least as I read RFC 793, a zero urgent
pointer value isn't useful, as it means "the stuff before this segment
is urgent", but it's certainly possible to put onto the wire a TCP
segment with URG set and a zero urgent pointer.)
Don't dissect the TCP header by grabbing the entire header with
"tvb_memcpy()" and then pulling stuff out of it - extract stuff with
individual tvbuff calls, and put stuff into the protocol tree and the
Info column as we extract it, so that we can dissect a partial header.
This lets us, for example, get the source and destination ports from the
TCP header of the part of a TCP segment included in a minimum-length
ICMPv4 error packet.
svn path=/trunk/; revision=3986
2001-10-01 08:29:37 +00:00
|
|
|
struct tcpinfo tcpinfo;
|
2006-08-21 13:05:18 +00:00
|
|
|
struct tcpheader *tcph;
|
2005-09-11 16:55:34 +00:00
|
|
|
proto_item *tf_syn = NULL, *tf_fin = NULL, *tf_rst = NULL;
|
2008-09-30 12:24:27 +00:00
|
|
|
conversation_t *conv=NULL;
|
2006-01-26 22:50:16 +00:00
|
|
|
struct tcp_analysis *tcpd=NULL;
|
2007-09-25 20:37:13 +00:00
|
|
|
struct tcp_per_packet_data_t *tcppd=NULL;
|
2006-10-29 13:53:07 +00:00
|
|
|
proto_item *item;
|
|
|
|
proto_tree *checksum_tree;
|
2002-12-17 11:49:32 +00:00
|
|
|
|
2006-08-21 13:05:18 +00:00
|
|
|
tcph=ep_alloc(sizeof(struct tcpheader));
|
2003-08-23 09:09:35 +00:00
|
|
|
SET_ADDRESS(&tcph->ip_src, pinfo->src.type, pinfo->src.len, pinfo->src.data);
|
|
|
|
SET_ADDRESS(&tcph->ip_dst, pinfo->dst.type, pinfo->dst.len, pinfo->dst.data);
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
|
2009-08-09 06:26:46 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "TCP");
|
Add a "col_clear()" routine, to clear a column; it appears (and it
doesn't just seem to be a profiling artifact) that, at least on FreeBSD
3.4, it's significantly more efficient to clear out a column by stuffing
a '\0' into the first byte of the column data than to do so by copying a
null string (I guess when copying one byte, the fixed overhead of the
procedure call and of "strcpy()" is significant).
Have the TCP dissector set the Protocol column, and clear the Info
column, before doing anything that might cause an exception to be
thrown, so that if we *do* get an exception thrown, the frame at least
shows up as TCP.
Instead of, in the TCP dissector, constructing a string and then
stuffing it into the Info column, just append to the Info column, which
avoids one string copy.
Pass a "frame_data" pointer to dissectors for TCP and IP (and PPP)
options, so they can use it to append to the Info column.
svn path=/trunk/; revision=2744
2000-12-04 06:37:46 +00:00
|
|
|
|
|
|
|
/* Clear out the Info column. */
|
2009-08-09 07:36:13 +00:00
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
Add a "col_clear()" routine, to clear a column; it appears (and it
doesn't just seem to be a profiling artifact) that, at least on FreeBSD
3.4, it's significantly more efficient to clear out a column by stuffing
a '\0' into the first byte of the column data than to do so by copying a
null string (I guess when copying one byte, the fixed overhead of the
procedure call and of "strcpy()" is significant).
Have the TCP dissector set the Protocol column, and clear the Info
column, before doing anything that might cause an exception to be
thrown, so that if we *do* get an exception thrown, the frame at least
shows up as TCP.
Instead of, in the TCP dissector, constructing a string and then
stuffing it into the Info column, just append to the Info column, which
avoids one string copy.
Pass a "frame_data" pointer to dissectors for TCP and IP (and PPP)
options, so they can use it to append to the Info column.
svn path=/trunk/; revision=2744
2000-12-04 06:37:46 +00:00
|
|
|
|
2002-12-17 11:49:32 +00:00
|
|
|
tcph->th_sport = tvb_get_ntohs(tvb, offset);
|
|
|
|
tcph->th_dport = tvb_get_ntohs(tvb, offset + 2);
|
2010-01-15 07:32:04 +00:00
|
|
|
col_append_fstr(pinfo->cinfo, COL_INFO, "%s > %s",
|
|
|
|
get_tcp_port(tcph->th_sport), get_tcp_port(tcph->th_dport));
|
2002-08-03 22:28:16 +00:00
|
|
|
if (tree) {
|
|
|
|
if (tcp_summary_in_tree) {
|
|
|
|
ti = proto_tree_add_protocol_format(tree, proto_tcp, tvb, 0, -1,
|
|
|
|
"Transmission Control Protocol, Src Port: %s (%u), Dst Port: %s (%u)",
|
2002-12-17 11:49:32 +00:00
|
|
|
get_tcp_port(tcph->th_sport), tcph->th_sport,
|
|
|
|
get_tcp_port(tcph->th_dport), tcph->th_dport);
|
2002-08-03 22:28:16 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
ti = proto_tree_add_item(tree, proto_tcp, tvb, 0, -1, FALSE);
|
|
|
|
}
|
|
|
|
tcp_tree = proto_item_add_subtree(ti, ett_tcp);
|
2006-10-22 00:21:40 +00:00
|
|
|
pinfo->tcp_tree=tcp_tree;
|
|
|
|
|
2002-12-17 11:49:32 +00:00
|
|
|
proto_tree_add_uint_format(tcp_tree, hf_tcp_srcport, tvb, offset, 2, tcph->th_sport,
|
|
|
|
"Source port: %s (%u)", get_tcp_port(tcph->th_sport), tcph->th_sport);
|
|
|
|
proto_tree_add_uint_format(tcp_tree, hf_tcp_dstport, tvb, offset + 2, 2, tcph->th_dport,
|
|
|
|
"Destination port: %s (%u)", get_tcp_port(tcph->th_dport), tcph->th_dport);
|
2008-05-15 13:22:06 +00:00
|
|
|
hidden_item = proto_tree_add_uint(tcp_tree, hf_tcp_port, tvb, offset, 2, tcph->th_sport);
|
|
|
|
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
|
|
|
hidden_item = proto_tree_add_uint(tcp_tree, hf_tcp_port, tvb, offset + 2, 2, tcph->th_dport);
|
|
|
|
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
2006-12-16 15:17:43 +00:00
|
|
|
|
|
|
|
/* If we're dissecting the headers of a TCP packet in an ICMP packet
|
|
|
|
* then go ahead and put the sequence numbers in the tree now (because
|
|
|
|
* they won't be put in later because the ICMP packet only contains up
|
|
|
|
* to the sequence number).
|
|
|
|
* We should only need to do this for IPv4 since IPv6 will hopefully
|
|
|
|
* carry enough TCP payload for this dissector to put the sequence
|
|
|
|
* numbers in via the regular code path.
|
|
|
|
*/
|
|
|
|
if (pinfo->layer_names != NULL && pinfo->layer_names->str != NULL) {
|
2007-10-30 22:22:14 +00:00
|
|
|
/* use strstr because g_strrstr is only present in glib2.0 and
|
2006-12-16 15:17:43 +00:00
|
|
|
* g_str_has_suffix in glib2.2
|
|
|
|
*/
|
|
|
|
if (strstr(pinfo->layer_names->str, "icmp:ip") != NULL)
|
2008-08-20 05:56:31 +00:00
|
|
|
proto_tree_add_item(tcp_tree, hf_tcp_seq, tvb, offset + 4, 4, FALSE);
|
2006-12-16 15:17:43 +00:00
|
|
|
}
|
2002-08-03 22:28:16 +00:00
|
|
|
}
|
|
|
|
|
2002-07-02 08:18:45 +00:00
|
|
|
/* Set the source and destination port numbers as soon as we get them,
|
|
|
|
so that they're available to the "Follow TCP Stream" code even if
|
|
|
|
we throw an exception dissecting the rest of the TCP header. */
|
|
|
|
pinfo->ptype = PT_TCP;
|
2002-12-17 11:49:32 +00:00
|
|
|
pinfo->srcport = tcph->th_sport;
|
|
|
|
pinfo->destport = tcph->th_dport;
|
2002-08-28 21:04:11 +00:00
|
|
|
|
2002-12-17 11:49:32 +00:00
|
|
|
tcph->th_seq = tvb_get_ntohl(tvb, offset + 4);
|
|
|
|
tcph->th_ack = tvb_get_ntohl(tvb, offset + 8);
|
2002-08-02 22:41:56 +00:00
|
|
|
th_off_x2 = tvb_get_guint8(tvb, offset + 12);
|
2002-12-17 11:49:32 +00:00
|
|
|
tcph->th_flags = tvb_get_guint8(tvb, offset + 13);
|
|
|
|
tcph->th_win = tvb_get_ntohs(tvb, offset + 14);
|
2004-08-26 10:03:40 +00:00
|
|
|
real_window = tcph->th_win;
|
2002-12-17 11:49:32 +00:00
|
|
|
tcph->th_hlen = hi_nibble(th_off_x2) * 4; /* TCP header length, in bytes */
|
2002-08-02 22:41:56 +00:00
|
|
|
|
2006-01-31 10:27:30 +00:00
|
|
|
/* find(or create if needed) the conversation for this tcp session */
|
2008-09-30 12:24:27 +00:00
|
|
|
conv=get_tcp_conversation(pinfo);
|
|
|
|
tcpd=get_tcp_conversation_data(conv,pinfo);
|
|
|
|
|
2008-11-18 16:38:08 +00:00
|
|
|
item = proto_tree_add_uint(tcp_tree, hf_tcp_stream, tvb, offset, 0, conv->index);
|
2008-09-30 12:24:27 +00:00
|
|
|
PROTO_ITEM_SET_GENERATED(item);
|
2006-01-31 10:27:30 +00:00
|
|
|
|
2007-10-28 23:38:43 +00:00
|
|
|
/* If this is a SYN packet, then check if it's seq-nr is different
|
|
|
|
* from the base_seq of the retrieved conversation. If this is the
|
|
|
|
* case, create a new conversation with the same addresses and ports
|
|
|
|
* and set the TA_PORTS_REUSED flag. If the seq-nr is the same as
|
|
|
|
* the base_seq, then do nothing so it will be marked as a retrans-
|
|
|
|
* mission later.
|
|
|
|
*/
|
2007-11-08 00:58:38 +00:00
|
|
|
if(tcpd && ((tcph->th_flags&(TH_SYN|TH_ACK))==TH_SYN) &&
|
2007-10-28 23:38:43 +00:00
|
|
|
(tcpd->fwd->base_seq!=0) &&
|
|
|
|
(tcph->th_seq!=tcpd->fwd->base_seq) ) {
|
2008-09-30 12:24:27 +00:00
|
|
|
if (!(pinfo->fd->flags.visited)) {
|
|
|
|
conv=conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
|
|
|
|
tcpd=get_tcp_conversation_data(conv,pinfo);
|
|
|
|
}
|
2007-10-28 23:38:43 +00:00
|
|
|
if(!tcpd->ta)
|
|
|
|
tcp_analyze_get_acked_struct(pinfo->fd->num, TRUE, tcpd);
|
|
|
|
tcpd->ta->flags|=TCP_A_REUSED_PORTS;
|
|
|
|
}
|
2007-10-30 22:22:14 +00:00
|
|
|
|
2007-10-28 23:38:43 +00:00
|
|
|
|
2007-10-03 14:02:08 +00:00
|
|
|
/* Do we need to calculate timestamps relative to the tcp-stream? */
|
|
|
|
if (tcp_calculate_ts) {
|
2008-08-20 05:56:31 +00:00
|
|
|
tcppd = p_get_proto_data(pinfo->fd, proto_tcp);
|
2007-10-03 14:02:08 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Calculate the timestamps relative to this conversation (but only on the
|
|
|
|
* first run when frames are accessed sequentially)
|
|
|
|
*/
|
|
|
|
if (!(pinfo->fd->flags.visited))
|
|
|
|
tcp_calculate_timestamps(pinfo, tcpd, tcppd);
|
2007-09-25 20:37:13 +00:00
|
|
|
}
|
|
|
|
|
2003-05-21 05:43:27 +00:00
|
|
|
/*
|
|
|
|
* If we've been handed an IP fragment, we don't know how big the TCP
|
|
|
|
* segment is, so don't do anything that requires that we know that.
|
2003-05-21 05:57:24 +00:00
|
|
|
*
|
|
|
|
* The same applies if we're part of an error packet. (XXX - if the
|
|
|
|
* ICMP and ICMPv6 dissectors could set a "this is how big the IP
|
|
|
|
* header says it is" length in the tvbuff, we could use that; such
|
|
|
|
* a length might also be useful for handling packets where the IP
|
|
|
|
* length is bigger than the actual data available in the frame; the
|
|
|
|
* dissectors should trust that length, and then throw a
|
|
|
|
* ReportedBoundsError exception when they go past the end of the frame.)
|
2003-05-21 06:28:03 +00:00
|
|
|
*
|
|
|
|
* We also can't determine the segment length if the reported length
|
|
|
|
* of the TCP packet is less than the TCP header length.
|
2003-05-21 05:43:27 +00:00
|
|
|
*/
|
2002-08-02 22:41:56 +00:00
|
|
|
reported_len = tvb_reported_length(tvb);
|
|
|
|
|
2003-05-21 05:57:24 +00:00
|
|
|
if (!pinfo->fragmented && !pinfo->in_error_pkt) {
|
2003-05-21 06:28:03 +00:00
|
|
|
if (reported_len < tcph->th_hlen) {
|
2006-08-31 23:00:44 +00:00
|
|
|
proto_item *pi;
|
|
|
|
pi = proto_tree_add_text(tcp_tree, tvb, offset, 0,
|
2003-05-21 06:28:03 +00:00
|
|
|
"Short segment. Segment/fragment does not contain a full TCP header"
|
|
|
|
" (might be NMAP or someone else deliberately sending unusual packets)");
|
2006-08-31 23:00:44 +00:00
|
|
|
PROTO_ITEM_SET_GENERATED(pi);
|
|
|
|
expert_add_info_format(pinfo, pi, PI_MALFORMED, PI_WARN, "Short segment");
|
2003-05-21 06:28:03 +00:00
|
|
|
tcph->th_have_seglen = FALSE;
|
|
|
|
} else {
|
|
|
|
/* Compute the length of data in this segment. */
|
|
|
|
tcph->th_seglen = reported_len - tcph->th_hlen;
|
|
|
|
tcph->th_have_seglen = TRUE;
|
2003-05-20 10:14:20 +00:00
|
|
|
|
2003-05-21 06:28:03 +00:00
|
|
|
if (tree) { /* Add the seglen as an invisible field */
|
2002-08-02 22:41:56 +00:00
|
|
|
|
2008-11-18 16:38:08 +00:00
|
|
|
hidden_item = proto_tree_add_uint(ti, hf_tcp_len, tvb, offset+12, 1, tcph->th_seglen);
|
2008-05-21 06:10:27 +00:00
|
|
|
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
2002-08-02 22:41:56 +00:00
|
|
|
|
2003-05-21 06:28:03 +00:00
|
|
|
}
|
2002-08-02 22:41:56 +00:00
|
|
|
|
2007-10-30 22:22:14 +00:00
|
|
|
|
2003-05-21 06:28:03 +00:00
|
|
|
/* handle TCP seq# analysis parse all new segments we see */
|
|
|
|
if(tcp_analyze_seq){
|
|
|
|
if(!(pinfo->fd->flags.visited)){
|
2006-01-26 22:50:16 +00:00
|
|
|
tcp_analyze_sequence_number(pinfo, tcph->th_seq, tcph->th_ack, tcph->th_seglen, tcph->th_flags, tcph->th_win, tcpd);
|
2003-05-21 06:28:03 +00:00
|
|
|
}
|
|
|
|
if(tcp_relative_seq){
|
2006-01-26 22:50:16 +00:00
|
|
|
tcp_get_relative_seq_ack(&(tcph->th_seq), &(tcph->th_ack), &(tcph->th_win), tcpd);
|
2009-09-13 23:10:11 +00:00
|
|
|
if ((tcph->th_flags&TH_SYN)) { /* SYNs are never scaled */
|
|
|
|
tcph->th_win = real_window;
|
|
|
|
}
|
2003-05-21 06:28:03 +00:00
|
|
|
}
|
|
|
|
}
|
2002-08-02 22:41:56 +00:00
|
|
|
|
2003-05-21 06:28:03 +00:00
|
|
|
/* Compute the sequence number of next octet after this segment. */
|
|
|
|
nxtseq = tcph->th_seq + tcph->th_seglen;
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
tcph->th_have_seglen = FALSE;
|
2002-08-02 22:41:56 +00:00
|
|
|
|
2002-08-28 21:04:11 +00:00
|
|
|
if (check_col(pinfo->cinfo, COL_INFO) || tree) {
|
2009-03-27 23:05:37 +00:00
|
|
|
gboolean first_flag = TRUE;
|
2000-09-14 21:58:48 +00:00
|
|
|
for (i = 0; i < 8; i++) {
|
1998-12-21 03:43:29 +00:00
|
|
|
bpos = 1 << i;
|
2002-12-17 11:49:32 +00:00
|
|
|
if (tcph->th_flags & bpos) {
|
2009-03-27 23:05:37 +00:00
|
|
|
if (first_flag) {
|
|
|
|
ep_strbuf_truncate(flags_strbuf, 0);
|
|
|
|
}
|
|
|
|
ep_strbuf_append_printf(flags_strbuf, "%s%s", first_flag ? "" : ", ", fstr[i]);
|
|
|
|
first_flag = FALSE;
|
1998-09-16 02:39:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1998-12-21 03:43:29 +00:00
|
|
|
|
2010-01-15 07:32:04 +00:00
|
|
|
col_append_fstr(pinfo->cinfo, COL_INFO, " [%s] Seq=%u", flags_strbuf->str, tcph->th_seq);
|
|
|
|
if (tcph->th_flags&TH_ACK) {
|
|
|
|
col_append_fstr(pinfo->cinfo, COL_INFO, " Ack=%u", tcph->th_ack);
|
Have a flag in the "packet_info" structure, which indicates whether the
stuff currently being dissected is part of a packet included in an error
packet (e.g., an ICMP Unreachable packet). Have the TCP dissector not
bother doing reassembly if the TCP segment is part of an error packet,
rather than an actual TCP transmission; other dissectors might want to
treat those packets specially as well.
Add to the "tcpinfo" structure a flag indicating whether the URG flag
was set, rather than having the zero or non-zero value of the urgent
pointer indicate that. (Yes, at least as I read RFC 793, a zero urgent
pointer value isn't useful, as it means "the stuff before this segment
is urgent", but it's certainly possible to put onto the wire a TCP
segment with URG set and a zero urgent pointer.)
Don't dissect the TCP header by grabbing the entire header with
"tvb_memcpy()" and then pulling stuff out of it - extract stuff with
individual tvbuff calls, and put stuff into the protocol tree and the
Info column as we extract it, so that we can dissect a partial header.
This lets us, for example, get the source and destination ports from the
TCP header of the part of a TCP segment included in a minimum-length
ICMPv4 error packet.
svn path=/trunk/; revision=3986
2001-10-01 08:29:37 +00:00
|
|
|
}
|
2010-01-15 07:32:04 +00:00
|
|
|
col_append_fstr(pinfo->cinfo, COL_INFO, " Win=%u", tcph->th_win);
|
2000-12-13 02:24:23 +00:00
|
|
|
|
Have a flag in the "packet_info" structure, which indicates whether the
stuff currently being dissected is part of a packet included in an error
packet (e.g., an ICMP Unreachable packet). Have the TCP dissector not
bother doing reassembly if the TCP segment is part of an error packet,
rather than an actual TCP transmission; other dissectors might want to
treat those packets specially as well.
Add to the "tcpinfo" structure a flag indicating whether the URG flag
was set, rather than having the zero or non-zero value of the urgent
pointer indicate that. (Yes, at least as I read RFC 793, a zero urgent
pointer value isn't useful, as it means "the stuff before this segment
is urgent", but it's certainly possible to put onto the wire a TCP
segment with URG set and a zero urgent pointer.)
Don't dissect the TCP header by grabbing the entire header with
"tvb_memcpy()" and then pulling stuff out of it - extract stuff with
individual tvbuff calls, and put stuff into the protocol tree and the
Info column as we extract it, so that we can dissect a partial header.
This lets us, for example, get the source and destination ports from the
TCP header of the part of a TCP segment included in a minimum-length
ICMPv4 error packet.
svn path=/trunk/; revision=3986
2001-10-01 08:29:37 +00:00
|
|
|
if (tree) {
|
2003-05-20 10:14:20 +00:00
|
|
|
if (tcp_summary_in_tree) {
|
2002-12-17 11:49:32 +00:00
|
|
|
proto_item_append_text(ti, ", Seq: %u", tcph->th_seq);
|
2003-05-20 10:14:20 +00:00
|
|
|
}
|
2004-04-08 05:09:28 +00:00
|
|
|
if(tcp_relative_seq){
|
|
|
|
proto_tree_add_uint_format(tcp_tree, hf_tcp_seq, tvb, offset + 4, 4, tcph->th_seq, "Sequence number: %u (relative sequence number)", tcph->th_seq);
|
|
|
|
} else {
|
|
|
|
proto_tree_add_uint(tcp_tree, hf_tcp_seq, tvb, offset + 4, 4, tcph->th_seq);
|
|
|
|
}
|
Have a flag in the "packet_info" structure, which indicates whether the
stuff currently being dissected is part of a packet included in an error
packet (e.g., an ICMP Unreachable packet). Have the TCP dissector not
bother doing reassembly if the TCP segment is part of an error packet,
rather than an actual TCP transmission; other dissectors might want to
treat those packets specially as well.
Add to the "tcpinfo" structure a flag indicating whether the URG flag
was set, rather than having the zero or non-zero value of the urgent
pointer indicate that. (Yes, at least as I read RFC 793, a zero urgent
pointer value isn't useful, as it means "the stuff before this segment
is urgent", but it's certainly possible to put onto the wire a TCP
segment with URG set and a zero urgent pointer.)
Don't dissect the TCP header by grabbing the entire header with
"tvb_memcpy()" and then pulling stuff out of it - extract stuff with
individual tvbuff calls, and put stuff into the protocol tree and the
Info column as we extract it, so that we can dissect a partial header.
This lets us, for example, get the source and destination ports from the
TCP header of the part of a TCP segment included in a minimum-length
ICMPv4 error packet.
svn path=/trunk/; revision=3986
2001-10-01 08:29:37 +00:00
|
|
|
}
|
2000-09-21 00:55:02 +00:00
|
|
|
|
2002-12-17 11:49:32 +00:00
|
|
|
if (tcph->th_hlen < TCPH_MIN_LEN) {
|
Have a flag in the "packet_info" structure, which indicates whether the
stuff currently being dissected is part of a packet included in an error
packet (e.g., an ICMP Unreachable packet). Have the TCP dissector not
bother doing reassembly if the TCP segment is part of an error packet,
rather than an actual TCP transmission; other dissectors might want to
treat those packets specially as well.
Add to the "tcpinfo" structure a flag indicating whether the URG flag
was set, rather than having the zero or non-zero value of the urgent
pointer indicate that. (Yes, at least as I read RFC 793, a zero urgent
pointer value isn't useful, as it means "the stuff before this segment
is urgent", but it's certainly possible to put onto the wire a TCP
segment with URG set and a zero urgent pointer.)
Don't dissect the TCP header by grabbing the entire header with
"tvb_memcpy()" and then pulling stuff out of it - extract stuff with
individual tvbuff calls, and put stuff into the protocol tree and the
Info column as we extract it, so that we can dissect a partial header.
This lets us, for example, get the source and destination ports from the
TCP header of the part of a TCP segment included in a minimum-length
ICMPv4 error packet.
svn path=/trunk/; revision=3986
2001-10-01 08:29:37 +00:00
|
|
|
/* Give up at this point; we put the source and destination port in
|
|
|
|
the tree, before fetching the header length, so that they'll
|
|
|
|
show up if this is in the failing packet in an ICMP error packet,
|
|
|
|
but it's now time to give up if the header length is bogus. */
|
2010-01-15 07:32:04 +00:00
|
|
|
col_append_fstr(pinfo->cinfo, COL_INFO, ", bogus TCP header length (%u, must be at least %u)",
|
|
|
|
tcph->th_hlen, TCPH_MIN_LEN);
|
2001-06-14 08:09:59 +00:00
|
|
|
if (tree) {
|
2002-12-17 11:49:32 +00:00
|
|
|
proto_tree_add_uint_format(tcp_tree, hf_tcp_hdr_len, tvb, offset + 12, 1, tcph->th_hlen,
|
|
|
|
"Header length: %u bytes (bogus, must be at least %u)", tcph->th_hlen,
|
2001-06-14 08:09:59 +00:00
|
|
|
TCPH_MIN_LEN);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1998-09-16 02:39:15 +00:00
|
|
|
if (tree) {
|
2003-05-21 05:43:27 +00:00
|
|
|
if (tcp_summary_in_tree) {
|
2005-12-22 23:23:25 +00:00
|
|
|
if(tcph->th_flags&TH_ACK){
|
|
|
|
proto_item_append_text(ti, ", Ack: %u", tcph->th_ack);
|
|
|
|
}
|
2003-05-21 06:28:03 +00:00
|
|
|
if (tcph->th_have_seglen)
|
2003-05-21 05:43:27 +00:00
|
|
|
proto_item_append_text(ti, ", Len: %u", tcph->th_seglen);
|
|
|
|
}
|
2002-12-17 11:49:32 +00:00
|
|
|
proto_item_set_len(ti, tcph->th_hlen);
|
2003-05-21 06:28:03 +00:00
|
|
|
if (tcph->th_have_seglen) {
|
2003-05-21 05:43:27 +00:00
|
|
|
if (nxtseq != tcph->th_seq) {
|
2004-04-08 05:09:28 +00:00
|
|
|
if(tcp_relative_seq){
|
2004-05-14 09:00:06 +00:00
|
|
|
tf=proto_tree_add_uint_format(tcp_tree, hf_tcp_nxtseq, tvb, offset, 0, nxtseq, "Next sequence number: %u (relative sequence number)", nxtseq);
|
2004-04-08 05:09:28 +00:00
|
|
|
} else {
|
2004-05-14 09:00:06 +00:00
|
|
|
tf=proto_tree_add_uint(tcp_tree, hf_tcp_nxtseq, tvb, offset, 0, nxtseq);
|
2004-04-08 05:09:28 +00:00
|
|
|
}
|
2004-05-14 09:00:06 +00:00
|
|
|
PROTO_ITEM_SET_GENERATED(tf);
|
2003-05-21 05:43:27 +00:00
|
|
|
}
|
2003-05-20 10:14:20 +00:00
|
|
|
}
|
2004-04-15 00:18:38 +00:00
|
|
|
if (tcph->th_flags & TH_ACK) {
|
2004-04-08 05:09:28 +00:00
|
|
|
if(tcp_relative_seq){
|
|
|
|
proto_tree_add_uint_format(tcp_tree, hf_tcp_ack, tvb, offset + 8, 4, tcph->th_ack, "Acknowledgement number: %u (relative ack number)", tcph->th_ack);
|
|
|
|
} else {
|
|
|
|
proto_tree_add_uint(tcp_tree, hf_tcp_ack, tvb, offset + 8, 4, tcph->th_ack);
|
|
|
|
}
|
2007-07-07 22:27:22 +00:00
|
|
|
} else {
|
|
|
|
/* Verify that the ACK field is zero */
|
|
|
|
if(tvb_get_ntohl(tvb, offset+8) != 0){
|
2008-08-20 05:40:25 +00:00
|
|
|
proto_tree_add_text(tcp_tree, tvb, offset+8, 4,"Acknowledgement number: Broken TCP. The acknowledge field is nonzero while the ACK flag is not set");
|
2007-07-07 22:27:22 +00:00
|
|
|
}
|
2004-04-15 00:18:38 +00:00
|
|
|
}
|
2002-12-17 11:49:32 +00:00
|
|
|
proto_tree_add_uint_format(tcp_tree, hf_tcp_hdr_len, tvb, offset + 12, 1, tcph->th_hlen,
|
|
|
|
"Header length: %u bytes", tcph->th_hlen);
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
tf = proto_tree_add_uint_format(tcp_tree, hf_tcp_flags, tvb, offset + 13, 1,
|
2009-03-27 23:05:37 +00:00
|
|
|
tcph->th_flags, "Flags: 0x%02x (%s)", tcph->th_flags, flags_strbuf->str);
|
1999-11-16 11:44:20 +00:00
|
|
|
field_tree = proto_item_add_subtree(tf, ett_tcp_flags);
|
2002-12-17 11:49:32 +00:00
|
|
|
proto_tree_add_boolean(field_tree, hf_tcp_flags_cwr, tvb, offset + 13, 1, tcph->th_flags);
|
|
|
|
proto_tree_add_boolean(field_tree, hf_tcp_flags_ecn, tvb, offset + 13, 1, tcph->th_flags);
|
|
|
|
proto_tree_add_boolean(field_tree, hf_tcp_flags_urg, tvb, offset + 13, 1, tcph->th_flags);
|
|
|
|
proto_tree_add_boolean(field_tree, hf_tcp_flags_ack, tvb, offset + 13, 1, tcph->th_flags);
|
|
|
|
proto_tree_add_boolean(field_tree, hf_tcp_flags_push, tvb, offset + 13, 1, tcph->th_flags);
|
2005-09-11 16:55:34 +00:00
|
|
|
tf_rst = proto_tree_add_boolean(field_tree, hf_tcp_flags_reset, tvb, offset + 13, 1, tcph->th_flags);
|
|
|
|
tf_syn = proto_tree_add_boolean(field_tree, hf_tcp_flags_syn, tvb, offset + 13, 1, tcph->th_flags);
|
|
|
|
tf_fin = proto_tree_add_boolean(field_tree, hf_tcp_flags_fin, tvb, offset + 13, 1, tcph->th_flags);
|
2009-11-16 21:26:55 +00:00
|
|
|
if (tcph->th_flags & TH_ACK) {
|
|
|
|
if(tcp_relative_seq && tcph->th_win!=real_window) {
|
|
|
|
proto_tree_add_uint_format(tcp_tree, hf_tcp_window_size, tvb, offset + 14, 2, tcph->th_win, "Window size: %u (scaled)", tcph->th_win);
|
|
|
|
} else {
|
|
|
|
proto_tree_add_uint(tcp_tree, hf_tcp_window_size, tvb, offset + 14, 2, real_window);
|
|
|
|
}
|
2004-08-26 10:03:40 +00:00
|
|
|
}
|
2001-09-13 07:56:53 +00:00
|
|
|
}
|
|
|
|
|
2005-09-11 22:19:41 +00:00
|
|
|
if(tcph->th_flags & TH_SYN) {
|
|
|
|
if(tcph->th_flags & TH_ACK)
|
2006-09-07 20:35:26 +00:00
|
|
|
expert_add_info_format(pinfo, tf_syn, PI_SEQUENCE, PI_CHAT, "Connection establish acknowledge (SYN+ACK): server port %s",
|
|
|
|
get_tcp_port(tcph->th_sport));
|
2005-09-11 22:19:41 +00:00
|
|
|
else
|
2006-09-07 20:35:26 +00:00
|
|
|
expert_add_info_format(pinfo, tf_syn, PI_SEQUENCE, PI_CHAT, "Connection establish request (SYN): server port %s",
|
|
|
|
get_tcp_port(tcph->th_dport));
|
2005-09-11 22:19:41 +00:00
|
|
|
}
|
|
|
|
if(tcph->th_flags & TH_FIN)
|
2006-09-07 20:35:26 +00:00
|
|
|
/* XXX - find a way to know the server port and output only that one */
|
|
|
|
expert_add_info_format(pinfo, tf_fin, PI_SEQUENCE, PI_CHAT, "Connection finish (FIN)");
|
2005-09-11 22:19:41 +00:00
|
|
|
if(tcph->th_flags & TH_RST)
|
2006-09-07 20:35:26 +00:00
|
|
|
/* XXX - find a way to know the server port and output only that one */
|
|
|
|
expert_add_info_format(pinfo, tf_rst, PI_SEQUENCE, PI_CHAT, "Connection reset (RST)");
|
2005-09-11 16:55:34 +00:00
|
|
|
|
2003-12-30 00:03:48 +00:00
|
|
|
/* Supply the sequence number of the first byte and of the first byte
|
|
|
|
after the segment. */
|
2002-12-17 11:49:32 +00:00
|
|
|
tcpinfo.seq = tcph->th_seq;
|
2003-12-30 00:03:48 +00:00
|
|
|
tcpinfo.nxtseq = nxtseq;
|
2007-12-17 20:43:38 +00:00
|
|
|
tcpinfo.lastackseq = tcph->th_ack;
|
Add support for reassembling RPC-over-TCP fragments, and do that in both
RPC and NDMP.
Show the RPC-over-TCP fragment header as a tree with bitfields below it.
Add a routine to show a reported bounds error as an "Unreassembled
Packet" or a "Malformed Packet" depending on whether "pinfo->fragmented"
is set, and have NBNS and RPC use that.
Add "ett_ndmp_file_stats" to the list of ett_ values to be initialized
(it wasn't in that list, and wasn't getting initialized).
When freeing up various hash tables and memory chunks in the RPC
dissector, zero out the pointers to them, just to make sure we don't try
to free them again.
Always destroy the TCP segment key and address memory chunks in
"tcp_desegment_init()", regardless of whether TCP desegmentation is
enabled - we don't *allocate* them if TCP desegmentation isn't enabled,
but we should free them even if it's not enabled. Also, when we free
them, set the pointers to them to null, so we don't double-free them.
Supply to subdissectors called from the TCP dissector the sequence
number of the first byte handed to the sub dissector.
svn path=/trunk/; revision=4753
2002-02-18 23:51:55 +00:00
|
|
|
|
Have a flag in the "packet_info" structure, which indicates whether the
stuff currently being dissected is part of a packet included in an error
packet (e.g., an ICMP Unreachable packet). Have the TCP dissector not
bother doing reassembly if the TCP segment is part of an error packet,
rather than an actual TCP transmission; other dissectors might want to
treat those packets specially as well.
Add to the "tcpinfo" structure a flag indicating whether the URG flag
was set, rather than having the zero or non-zero value of the urgent
pointer indicate that. (Yes, at least as I read RFC 793, a zero urgent
pointer value isn't useful, as it means "the stuff before this segment
is urgent", but it's certainly possible to put onto the wire a TCP
segment with URG set and a zero urgent pointer.)
Don't dissect the TCP header by grabbing the entire header with
"tvb_memcpy()" and then pulling stuff out of it - extract stuff with
individual tvbuff calls, and put stuff into the protocol tree and the
Info column as we extract it, so that we can dissect a partial header.
This lets us, for example, get the source and destination ports from the
TCP header of the part of a TCP segment included in a minimum-length
ICMPv4 error packet.
svn path=/trunk/; revision=3986
2001-10-01 08:29:37 +00:00
|
|
|
/* Assume we'll pass un-reassembled data to subdissectors. */
|
|
|
|
tcpinfo.is_reassembled = FALSE;
|
|
|
|
|
2001-11-03 00:58:52 +00:00
|
|
|
pinfo->private_data = &tcpinfo;
|
Have a flag in the "packet_info" structure, which indicates whether the
stuff currently being dissected is part of a packet included in an error
packet (e.g., an ICMP Unreachable packet). Have the TCP dissector not
bother doing reassembly if the TCP segment is part of an error packet,
rather than an actual TCP transmission; other dissectors might want to
treat those packets specially as well.
Add to the "tcpinfo" structure a flag indicating whether the URG flag
was set, rather than having the zero or non-zero value of the urgent
pointer indicate that. (Yes, at least as I read RFC 793, a zero urgent
pointer value isn't useful, as it means "the stuff before this segment
is urgent", but it's certainly possible to put onto the wire a TCP
segment with URG set and a zero urgent pointer.)
Don't dissect the TCP header by grabbing the entire header with
"tvb_memcpy()" and then pulling stuff out of it - extract stuff with
individual tvbuff calls, and put stuff into the protocol tree and the
Info column as we extract it, so that we can dissect a partial header.
This lets us, for example, get the source and destination ports from the
TCP header of the part of a TCP segment included in a minimum-length
ICMPv4 error packet.
svn path=/trunk/; revision=3986
2001-10-01 08:29:37 +00:00
|
|
|
|
2001-09-13 07:56:53 +00:00
|
|
|
/*
|
|
|
|
* Assume, initially, that we can't desegment.
|
|
|
|
*/
|
2001-11-29 09:05:25 +00:00
|
|
|
pinfo->can_desegment = 0;
|
Have a flag in the "packet_info" structure, which indicates whether the
stuff currently being dissected is part of a packet included in an error
packet (e.g., an ICMP Unreachable packet). Have the TCP dissector not
bother doing reassembly if the TCP segment is part of an error packet,
rather than an actual TCP transmission; other dissectors might want to
treat those packets specially as well.
Add to the "tcpinfo" structure a flag indicating whether the URG flag
was set, rather than having the zero or non-zero value of the urgent
pointer indicate that. (Yes, at least as I read RFC 793, a zero urgent
pointer value isn't useful, as it means "the stuff before this segment
is urgent", but it's certainly possible to put onto the wire a TCP
segment with URG set and a zero urgent pointer.)
Don't dissect the TCP header by grabbing the entire header with
"tvb_memcpy()" and then pulling stuff out of it - extract stuff with
individual tvbuff calls, and put stuff into the protocol tree and the
Info column as we extract it, so that we can dissect a partial header.
This lets us, for example, get the source and destination ports from the
TCP header of the part of a TCP segment included in a minimum-length
ICMPv4 error packet.
svn path=/trunk/; revision=3986
2001-10-01 08:29:37 +00:00
|
|
|
th_sum = tvb_get_ntohs(tvb, offset + 16);
|
2003-03-05 07:17:50 +00:00
|
|
|
if (!pinfo->fragmented && tvb_bytes_exist(tvb, 0, reported_len)) {
|
2002-01-18 22:35:19 +00:00
|
|
|
/* The packet isn't part of an un-reassembled fragmented datagram
|
|
|
|
and isn't truncated. This means we have all the data, and thus
|
|
|
|
can checksum it and, unless it's being returned in an error
|
|
|
|
packet, are willing to allow subdissectors to request reassembly
|
|
|
|
on it. */
|
2002-08-28 21:04:11 +00:00
|
|
|
|
2002-01-18 22:35:19 +00:00
|
|
|
if (tcp_check_checksum) {
|
|
|
|
/* We haven't turned checksum checking off; checksum it. */
|
|
|
|
|
|
|
|
/* Set up the fields of the pseudo-header. */
|
|
|
|
cksum_vec[0].ptr = pinfo->src.data;
|
|
|
|
cksum_vec[0].len = pinfo->src.len;
|
|
|
|
cksum_vec[1].ptr = pinfo->dst.data;
|
|
|
|
cksum_vec[1].len = pinfo->dst.len;
|
2008-08-20 05:56:31 +00:00
|
|
|
cksum_vec[2].ptr = (const guint8 *)phdr;
|
2002-01-18 22:35:19 +00:00
|
|
|
switch (pinfo->src.type) {
|
|
|
|
|
|
|
|
case AT_IPv4:
|
2002-08-02 23:36:07 +00:00
|
|
|
phdr[0] = g_htonl((IP_PROTO_TCP<<16) + reported_len);
|
2002-01-18 22:35:19 +00:00
|
|
|
cksum_vec[2].len = 4;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AT_IPv6:
|
2002-08-02 23:36:07 +00:00
|
|
|
phdr[0] = g_htonl(reported_len);
|
|
|
|
phdr[1] = g_htonl(IP_PROTO_TCP);
|
2000-12-13 02:24:23 +00:00
|
|
|
cksum_vec[2].len = 8;
|
|
|
|
break;
|
|
|
|
|
2002-01-18 22:35:19 +00:00
|
|
|
default:
|
2000-12-13 02:24:23 +00:00
|
|
|
/* TCP runs only atop IPv4 and IPv6.... */
|
2005-06-10 18:28:22 +00:00
|
|
|
DISSECTOR_ASSERT_NOT_REACHED();
|
2000-12-13 02:24:23 +00:00
|
|
|
break;
|
|
|
|
}
|
2003-03-05 07:17:50 +00:00
|
|
|
cksum_vec[3].ptr = tvb_get_ptr(tvb, offset, reported_len);
|
2002-01-18 22:35:19 +00:00
|
|
|
cksum_vec[3].len = reported_len;
|
2008-08-20 05:56:31 +00:00
|
|
|
computed_cksum = in_cksum(cksum_vec, 4);
|
2007-04-01 15:42:08 +00:00
|
|
|
if (computed_cksum == 0 && th_sum == 0xffff) {
|
|
|
|
item = proto_tree_add_uint_format(tcp_tree, hf_tcp_checksum, tvb,
|
|
|
|
offset + 16, 2, th_sum,
|
|
|
|
"Checksum: 0x%04x [should be 0x0000 (see RFC 1624)]", th_sum);
|
|
|
|
|
|
|
|
checksum_tree = proto_item_add_subtree(item, ett_tcp_checksum);
|
|
|
|
item = proto_tree_add_boolean(checksum_tree, hf_tcp_checksum_good, tvb,
|
|
|
|
offset + 16, 2, FALSE);
|
|
|
|
PROTO_ITEM_SET_GENERATED(item);
|
|
|
|
item = proto_tree_add_boolean(checksum_tree, hf_tcp_checksum_bad, tvb,
|
|
|
|
offset + 16, 2, FALSE);
|
|
|
|
PROTO_ITEM_SET_GENERATED(item);
|
|
|
|
expert_add_info_format(pinfo, item, PI_CHECKSUM, PI_WARN, "TCP Checksum 0xffff instead of 0x0000 (see RFC 1624)");
|
|
|
|
|
2009-09-24 20:21:23 +00:00
|
|
|
col_append_str(pinfo->cinfo, COL_INFO, " [TCP CHECKSUM 0xFFFF]");
|
2007-04-01 15:42:08 +00:00
|
|
|
|
|
|
|
/* Checksum is treated as valid on most systems, so we're willing to desegment it. */
|
|
|
|
desegment_ok = TRUE;
|
|
|
|
} else if (computed_cksum == 0) {
|
2006-10-29 13:53:07 +00:00
|
|
|
item = proto_tree_add_uint_format(tcp_tree, hf_tcp_checksum, tvb,
|
2005-07-08 22:11:13 +00:00
|
|
|
offset + 16, 2, th_sum, "Checksum: 0x%04x [correct]", th_sum);
|
2002-01-18 22:35:19 +00:00
|
|
|
|
2006-10-29 13:53:07 +00:00
|
|
|
checksum_tree = proto_item_add_subtree(item, ett_tcp_checksum);
|
|
|
|
item = proto_tree_add_boolean(checksum_tree, hf_tcp_checksum_good, tvb,
|
|
|
|
offset + 16, 2, TRUE);
|
|
|
|
PROTO_ITEM_SET_GENERATED(item);
|
|
|
|
item = proto_tree_add_boolean(checksum_tree, hf_tcp_checksum_bad, tvb,
|
|
|
|
offset + 16, 2, FALSE);
|
|
|
|
PROTO_ITEM_SET_GENERATED(item);
|
|
|
|
|
2002-01-18 22:35:19 +00:00
|
|
|
/* Checksum is valid, so we're willing to desegment it. */
|
|
|
|
desegment_ok = TRUE;
|
2006-03-13 20:50:50 +00:00
|
|
|
} else if (th_sum == 0) {
|
|
|
|
/* checksum is probably fine but checksum offload is used */
|
2006-10-29 13:53:07 +00:00
|
|
|
item = proto_tree_add_uint_format(tcp_tree, hf_tcp_checksum, tvb,
|
2006-03-13 20:50:50 +00:00
|
|
|
offset + 16, 2, th_sum, "Checksum: 0x%04x [Checksum Offloaded]", th_sum);
|
|
|
|
|
2006-10-29 13:53:07 +00:00
|
|
|
checksum_tree = proto_item_add_subtree(item, ett_tcp_checksum);
|
|
|
|
item = proto_tree_add_boolean(checksum_tree, hf_tcp_checksum_good, tvb,
|
|
|
|
offset + 16, 2, FALSE);
|
|
|
|
PROTO_ITEM_SET_GENERATED(item);
|
|
|
|
item = proto_tree_add_boolean(checksum_tree, hf_tcp_checksum_bad, tvb,
|
|
|
|
offset + 16, 2, FALSE);
|
|
|
|
PROTO_ITEM_SET_GENERATED(item);
|
|
|
|
|
2006-03-13 20:50:50 +00:00
|
|
|
/* Checksum is (probably) valid, so we're willing to desegment it. */
|
|
|
|
desegment_ok = TRUE;
|
2002-01-18 22:35:19 +00:00
|
|
|
} else {
|
2005-09-11 16:55:34 +00:00
|
|
|
item = proto_tree_add_uint_format(tcp_tree, hf_tcp_checksum, tvb,
|
Have a flag in the "packet_info" structure, which indicates whether the
stuff currently being dissected is part of a packet included in an error
packet (e.g., an ICMP Unreachable packet). Have the TCP dissector not
bother doing reassembly if the TCP segment is part of an error packet,
rather than an actual TCP transmission; other dissectors might want to
treat those packets specially as well.
Add to the "tcpinfo" structure a flag indicating whether the URG flag
was set, rather than having the zero or non-zero value of the urgent
pointer indicate that. (Yes, at least as I read RFC 793, a zero urgent
pointer value isn't useful, as it means "the stuff before this segment
is urgent", but it's certainly possible to put onto the wire a TCP
segment with URG set and a zero urgent pointer.)
Don't dissect the TCP header by grabbing the entire header with
"tvb_memcpy()" and then pulling stuff out of it - extract stuff with
individual tvbuff calls, and put stuff into the protocol tree and the
Info column as we extract it, so that we can dissect a partial header.
This lets us, for example, get the source and destination ports from the
TCP header of the part of a TCP segment included in a minimum-length
ICMPv4 error packet.
svn path=/trunk/; revision=3986
2001-10-01 08:29:37 +00:00
|
|
|
offset + 16, 2, th_sum,
|
2006-10-29 13:53:07 +00:00
|
|
|
"Checksum: 0x%04x [incorrect, should be 0x%04x (maybe caused by \"TCP checksum offload\"?)]", th_sum,
|
Have a flag in the "packet_info" structure, which indicates whether the
stuff currently being dissected is part of a packet included in an error
packet (e.g., an ICMP Unreachable packet). Have the TCP dissector not
bother doing reassembly if the TCP segment is part of an error packet,
rather than an actual TCP transmission; other dissectors might want to
treat those packets specially as well.
Add to the "tcpinfo" structure a flag indicating whether the URG flag
was set, rather than having the zero or non-zero value of the urgent
pointer indicate that. (Yes, at least as I read RFC 793, a zero urgent
pointer value isn't useful, as it means "the stuff before this segment
is urgent", but it's certainly possible to put onto the wire a TCP
segment with URG set and a zero urgent pointer.)
Don't dissect the TCP header by grabbing the entire header with
"tvb_memcpy()" and then pulling stuff out of it - extract stuff with
individual tvbuff calls, and put stuff into the protocol tree and the
Info column as we extract it, so that we can dissect a partial header.
This lets us, for example, get the source and destination ports from the
TCP header of the part of a TCP segment included in a minimum-length
ICMPv4 error packet.
svn path=/trunk/; revision=3986
2001-10-01 08:29:37 +00:00
|
|
|
in_cksum_shouldbe(th_sum, computed_cksum));
|
2006-10-29 13:53:07 +00:00
|
|
|
|
|
|
|
checksum_tree = proto_item_add_subtree(item, ett_tcp_checksum);
|
|
|
|
item = proto_tree_add_boolean(checksum_tree, hf_tcp_checksum_good, tvb,
|
|
|
|
offset + 16, 2, FALSE);
|
|
|
|
PROTO_ITEM_SET_GENERATED(item);
|
|
|
|
item = proto_tree_add_boolean(checksum_tree, hf_tcp_checksum_bad, tvb,
|
2005-07-08 22:11:13 +00:00
|
|
|
offset + 16, 2, TRUE);
|
|
|
|
PROTO_ITEM_SET_GENERATED(item);
|
2006-10-29 13:53:07 +00:00
|
|
|
expert_add_info_format(pinfo, item, PI_CHECKSUM, PI_ERROR, "Bad checksum");
|
2002-01-18 22:35:19 +00:00
|
|
|
|
2009-09-24 20:21:23 +00:00
|
|
|
col_append_str(pinfo->cinfo, COL_INFO, " [TCP CHECKSUM INCORRECT]");
|
2004-04-29 16:33:37 +00:00
|
|
|
|
2002-01-18 22:35:19 +00:00
|
|
|
/* Checksum is invalid, so we're not willing to desegment it. */
|
|
|
|
desegment_ok = FALSE;
|
2005-07-08 22:11:13 +00:00
|
|
|
pinfo->noreassembly_reason = " [incorrect TCP checksum]";
|
2002-01-18 22:35:19 +00:00
|
|
|
}
|
|
|
|
} else {
|
2006-10-29 13:53:07 +00:00
|
|
|
item = proto_tree_add_uint_format(tcp_tree, hf_tcp_checksum, tvb,
|
2005-09-11 16:55:34 +00:00
|
|
|
offset + 16, 2, th_sum, "Checksum: 0x%04x [validation disabled]", th_sum);
|
2002-01-18 22:35:19 +00:00
|
|
|
|
2006-10-29 13:53:07 +00:00
|
|
|
checksum_tree = proto_item_add_subtree(item, ett_tcp_checksum);
|
|
|
|
item = proto_tree_add_boolean(checksum_tree, hf_tcp_checksum_good, tvb,
|
|
|
|
offset + 16, 2, FALSE);
|
|
|
|
PROTO_ITEM_SET_GENERATED(item);
|
|
|
|
item = proto_tree_add_boolean(checksum_tree, hf_tcp_checksum_bad, tvb,
|
|
|
|
offset + 16, 2, FALSE);
|
|
|
|
PROTO_ITEM_SET_GENERATED(item);
|
|
|
|
|
2002-01-18 22:35:19 +00:00
|
|
|
/* We didn't check the checksum, and don't care if it's valid,
|
|
|
|
so we're willing to desegment it. */
|
|
|
|
desegment_ok = TRUE;
|
2000-12-13 02:24:23 +00:00
|
|
|
}
|
2001-09-13 07:56:53 +00:00
|
|
|
} else {
|
2002-01-18 22:35:19 +00:00
|
|
|
/* We don't have all the packet data, so we can't checksum it... */
|
2006-10-29 13:53:07 +00:00
|
|
|
item = proto_tree_add_uint_format(tcp_tree, hf_tcp_checksum, tvb,
|
2005-09-11 16:55:34 +00:00
|
|
|
offset + 16, 2, th_sum, "Checksum: 0x%04x [unchecked, not all data available]", th_sum);
|
2002-01-18 22:35:19 +00:00
|
|
|
|
2006-10-29 13:53:07 +00:00
|
|
|
checksum_tree = proto_item_add_subtree(item, ett_tcp_checksum);
|
|
|
|
item = proto_tree_add_boolean(checksum_tree, hf_tcp_checksum_good, tvb,
|
|
|
|
offset + 16, 2, FALSE);
|
|
|
|
PROTO_ITEM_SET_GENERATED(item);
|
|
|
|
item = proto_tree_add_boolean(checksum_tree, hf_tcp_checksum_bad, tvb,
|
|
|
|
offset + 16, 2, FALSE);
|
|
|
|
PROTO_ITEM_SET_GENERATED(item);
|
|
|
|
|
2002-01-18 22:35:19 +00:00
|
|
|
/* ...and aren't willing to desegment it. */
|
|
|
|
desegment_ok = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (desegment_ok) {
|
|
|
|
/* We're willing to desegment this. Is desegmentation enabled? */
|
|
|
|
if (tcp_desegment) {
|
|
|
|
/* Yes - is this segment being returned in an error packet? */
|
|
|
|
if (!pinfo->in_error_pkt) {
|
2008-08-20 05:56:31 +00:00
|
|
|
/* No - indicate that we will desegment.
|
|
|
|
We do NOT want to desegment segments returned in error
|
|
|
|
packets, as they're not part of a TCP connection. */
|
|
|
|
pinfo->can_desegment = 2;
|
2002-01-18 22:35:19 +00:00
|
|
|
}
|
|
|
|
}
|
1998-12-21 03:43:29 +00:00
|
|
|
}
|
2002-01-18 22:35:19 +00:00
|
|
|
|
2002-12-17 11:49:32 +00:00
|
|
|
if (tcph->th_flags & TH_URG) {
|
Have a flag in the "packet_info" structure, which indicates whether the
stuff currently being dissected is part of a packet included in an error
packet (e.g., an ICMP Unreachable packet). Have the TCP dissector not
bother doing reassembly if the TCP segment is part of an error packet,
rather than an actual TCP transmission; other dissectors might want to
treat those packets specially as well.
Add to the "tcpinfo" structure a flag indicating whether the URG flag
was set, rather than having the zero or non-zero value of the urgent
pointer indicate that. (Yes, at least as I read RFC 793, a zero urgent
pointer value isn't useful, as it means "the stuff before this segment
is urgent", but it's certainly possible to put onto the wire a TCP
segment with URG set and a zero urgent pointer.)
Don't dissect the TCP header by grabbing the entire header with
"tvb_memcpy()" and then pulling stuff out of it - extract stuff with
individual tvbuff calls, and put stuff into the protocol tree and the
Info column as we extract it, so that we can dissect a partial header.
This lets us, for example, get the source and destination ports from the
TCP header of the part of a TCP segment included in a minimum-length
ICMPv4 error packet.
svn path=/trunk/; revision=3986
2001-10-01 08:29:37 +00:00
|
|
|
th_urp = tvb_get_ntohs(tvb, offset + 18);
|
|
|
|
/* Export the urgent pointer, for the benefit of protocols such as
|
|
|
|
rlogin. */
|
|
|
|
tcpinfo.urgent = TRUE;
|
|
|
|
tcpinfo.urgent_pointer = th_urp;
|
2010-01-15 07:32:04 +00:00
|
|
|
col_append_fstr(pinfo->cinfo, COL_INFO, " Urg=%u", th_urp);
|
Have a flag in the "packet_info" structure, which indicates whether the
stuff currently being dissected is part of a packet included in an error
packet (e.g., an ICMP Unreachable packet). Have the TCP dissector not
bother doing reassembly if the TCP segment is part of an error packet,
rather than an actual TCP transmission; other dissectors might want to
treat those packets specially as well.
Add to the "tcpinfo" structure a flag indicating whether the URG flag
was set, rather than having the zero or non-zero value of the urgent
pointer indicate that. (Yes, at least as I read RFC 793, a zero urgent
pointer value isn't useful, as it means "the stuff before this segment
is urgent", but it's certainly possible to put onto the wire a TCP
segment with URG set and a zero urgent pointer.)
Don't dissect the TCP header by grabbing the entire header with
"tvb_memcpy()" and then pulling stuff out of it - extract stuff with
individual tvbuff calls, and put stuff into the protocol tree and the
Info column as we extract it, so that we can dissect a partial header.
This lets us, for example, get the source and destination ports from the
TCP header of the part of a TCP segment included in a minimum-length
ICMPv4 error packet.
svn path=/trunk/; revision=3986
2001-10-01 08:29:37 +00:00
|
|
|
if (tcp_tree != NULL)
|
|
|
|
proto_tree_add_uint(tcp_tree, hf_tcp_urgent_pointer, tvb, offset + 18, 2, th_urp);
|
|
|
|
} else
|
|
|
|
tcpinfo.urgent = FALSE;
|
|
|
|
|
2003-05-21 06:28:03 +00:00
|
|
|
if (tcph->th_have_seglen) {
|
2010-01-15 07:32:04 +00:00
|
|
|
col_append_fstr(pinfo->cinfo, COL_INFO, " Len=%u", tcph->th_seglen);
|
2003-05-21 05:43:27 +00:00
|
|
|
}
|
1998-09-16 02:39:15 +00:00
|
|
|
|
1998-12-21 03:43:29 +00:00
|
|
|
/* Decode TCP options, if any. */
|
2003-12-09 00:12:38 +00:00
|
|
|
if (tcph->th_hlen > TCPH_MIN_LEN) {
|
1998-12-21 03:43:29 +00:00
|
|
|
/* There's more than just the fixed-length header. Decode the
|
|
|
|
options. */
|
2002-12-17 11:49:32 +00:00
|
|
|
optlen = tcph->th_hlen - TCPH_MIN_LEN; /* length of options, in bytes */
|
2005-03-27 10:53:14 +00:00
|
|
|
tvb_ensure_bytes_exist(tvb, offset + 20, optlen);
|
2003-12-09 00:12:38 +00:00
|
|
|
if (tcp_tree != NULL) {
|
2008-12-19 17:39:52 +00:00
|
|
|
guint8 *p_options = ep_tvb_memdup(tvb, offset + 20, optlen);
|
2007-10-30 22:22:14 +00:00
|
|
|
tf = proto_tree_add_bytes_format(tcp_tree, hf_tcp_options, tvb, offset + 20,
|
2008-12-19 17:39:52 +00:00
|
|
|
optlen, p_options, "Options: (%u bytes)", optlen);
|
2003-12-09 00:12:38 +00:00
|
|
|
field_tree = proto_item_add_subtree(tf, ett_tcp_options);
|
|
|
|
} else
|
|
|
|
field_tree = NULL;
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
dissect_ip_tcp_options(tvb, offset + 20, optlen,
|
2001-12-10 00:26:21 +00:00
|
|
|
tcpopts, N_TCP_OPTS, TCPOPT_EOL, pinfo, field_tree);
|
1998-09-16 02:39:15 +00:00
|
|
|
}
|
1998-09-17 03:12:28 +00:00
|
|
|
|
2004-08-26 10:03:40 +00:00
|
|
|
if(!pinfo->fd->flags.visited){
|
2008-08-12 21:08:46 +00:00
|
|
|
if((tcph->th_flags & (TH_SYN|TH_ACK))==(TH_SYN|TH_ACK)) {
|
|
|
|
/* If there was window scaling in the SYN packet but none in the SYN+ACK
|
|
|
|
* then we should just forget about the windowscaling completely.
|
|
|
|
*/
|
|
|
|
if(tcp_analyze_seq && tcp_relative_seq){
|
2008-08-20 05:56:31 +00:00
|
|
|
verify_tcp_window_scaling(tcpd);
|
2008-08-12 21:08:46 +00:00
|
|
|
}
|
|
|
|
/* If the SYN or the SYN+ACK offered SCPS capabilities,
|
|
|
|
* validate the flow's bidirectional scps capabilities.
|
|
|
|
* The or protects against broken implementations offering
|
|
|
|
* SCPS capabilities on SYN+ACK even if it wasn't offered with the SYN
|
|
|
|
*/
|
2008-08-13 21:44:53 +00:00
|
|
|
if(tcpd && ((tcpd->rev->scps_capable) || (tcpd->fwd->scps_capable))) {
|
2008-08-20 05:56:31 +00:00
|
|
|
verify_scps(pinfo, tf_syn, tcpd);
|
2004-08-28 21:46:54 +00:00
|
|
|
}
|
2004-08-26 10:03:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-10-13 05:40:04 +00:00
|
|
|
/* Skip over header + options */
|
2002-12-17 11:49:32 +00:00
|
|
|
offset += tcph->th_hlen;
|
1998-09-17 03:12:28 +00:00
|
|
|
|
1999-02-12 09:03:42 +00:00
|
|
|
/* Check the packet length to see if there's more data
|
|
|
|
(it could be an ACK-only packet) */
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
length_remaining = tvb_length_remaining(tvb, offset);
|
2002-04-11 08:59:43 +00:00
|
|
|
|
2003-05-21 06:28:03 +00:00
|
|
|
if (tcph->th_have_seglen) {
|
2003-05-21 05:43:27 +00:00
|
|
|
if( data_out_file ) {
|
2009-12-13 01:10:55 +00:00
|
|
|
reassemble_tcp( conv->index, /* conversation index */
|
|
|
|
tcph->th_seq, /* sequence number */
|
2007-12-15 23:25:05 +00:00
|
|
|
tcph->th_ack, /* acknowledgement number */
|
|
|
|
tcph->th_seglen, /* data length */
|
2007-03-26 11:06:26 +00:00
|
|
|
(gchar*)tvb_get_ptr(tvb, offset, length_remaining), /* data */
|
2007-12-15 23:25:05 +00:00
|
|
|
length_remaining, /* captured data length */
|
|
|
|
( tcph->th_flags & TH_SYN ), /* is syn set? */
|
2003-05-21 05:43:27 +00:00
|
|
|
&pinfo->net_src,
|
|
|
|
&pinfo->net_dst,
|
|
|
|
pinfo->srcport,
|
|
|
|
pinfo->destport);
|
|
|
|
}
|
2002-04-11 08:59:43 +00:00
|
|
|
}
|
|
|
|
|
2005-08-13 07:30:57 +00:00
|
|
|
/* handle TCP seq# analysis, print any extra SEQ/ACK data for this segment*/
|
|
|
|
if(tcp_analyze_seq){
|
2006-03-02 09:33:49 +00:00
|
|
|
tcp_print_sequence_number_analysis(pinfo, tvb, tcp_tree, tcpd);
|
2005-08-13 07:30:57 +00:00
|
|
|
}
|
2007-10-30 22:22:14 +00:00
|
|
|
|
2007-09-25 20:37:13 +00:00
|
|
|
/* handle conversation timestamps */
|
|
|
|
if(tcp_calculate_ts){
|
|
|
|
tcp_print_timestamps(pinfo, tvb, tcp_tree, tcpd, tcppd);
|
|
|
|
}
|
|
|
|
|
2005-08-13 07:30:57 +00:00
|
|
|
tap_queue_packet(tcp_tap, pinfo, tcph);
|
|
|
|
|
2006-09-10 14:03:08 +00:00
|
|
|
|
2007-08-21 22:15:17 +00:00
|
|
|
/* A FIN packet might complete reassembly so we need to explicitly
|
2006-09-10 14:03:08 +00:00
|
|
|
* check for this here.
|
|
|
|
*/
|
2007-11-08 00:58:38 +00:00
|
|
|
if(tcpd && (tcph->th_flags & TH_FIN)
|
|
|
|
&& (tcpd->fwd->flags&TCP_FLOW_REASSEMBLE_UNTIL_FIN) ){
|
2006-09-10 14:03:08 +00:00
|
|
|
struct tcp_multisegment_pdu *msp;
|
|
|
|
|
|
|
|
/* find the most previous PDU starting before this sequence number */
|
|
|
|
msp=se_tree_lookup32_le(tcpd->fwd->multisegment_pdus, tcph->th_seq-1);
|
|
|
|
if(msp){
|
|
|
|
fragment_data *ipfd_head;
|
|
|
|
|
2007-08-21 22:15:17 +00:00
|
|
|
ipfd_head = fragment_add(tvb, offset, pinfo, msp->first_frame,
|
2006-09-10 14:03:08 +00:00
|
|
|
tcp_fragment_table,
|
|
|
|
tcph->th_seq - msp->seq,
|
2007-08-21 22:15:17 +00:00
|
|
|
tcph->th_seglen,
|
2006-09-10 14:03:08 +00:00
|
|
|
FALSE );
|
|
|
|
if(ipfd_head){
|
|
|
|
tvbuff_t *next_tvb;
|
|
|
|
|
2009-05-29 06:16:43 +00:00
|
|
|
/* create a new TVB structure for desegmented data
|
|
|
|
* datalen-1 to strip the dummy FIN byte off
|
|
|
|
*/
|
|
|
|
next_tvb = tvb_new_child_real_data(tvb, ipfd_head->data, ipfd_head->datalen, ipfd_head->datalen);
|
2006-09-10 14:03:08 +00:00
|
|
|
|
|
|
|
/* add desegmented data to the data source list */
|
|
|
|
add_new_data_source(pinfo, next_tvb, "Reassembled TCP");
|
|
|
|
|
|
|
|
/* call the payload dissector
|
2007-08-21 22:15:17 +00:00
|
|
|
* but make sure we don't offer desegmentation any more
|
2006-09-10 14:03:08 +00:00
|
|
|
*/
|
2008-08-20 05:56:31 +00:00
|
|
|
pinfo->can_desegment = 0;
|
2006-09-10 14:03:08 +00:00
|
|
|
|
|
|
|
process_tcp_payload(next_tvb, 0, pinfo, tree, tcp_tree, tcph->th_sport, tcph->th_dport, tcph->th_seq, nxtseq, FALSE, tcpd);
|
|
|
|
|
2009-04-20 05:48:04 +00:00
|
|
|
print_tcp_fragment_tree(ipfd_head, tree, tcp_tree, pinfo, next_tvb);
|
|
|
|
|
2006-09-10 14:03:08 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-05-14 23:33:17 +00:00
|
|
|
if (tcpd && (tcpd->fwd || tcpd->rev) && (tcpd->fwd->command || tcpd->rev->command)) {
|
|
|
|
ti = proto_tree_add_text(tcp_tree, tvb, offset, 0, "Process Information");
|
|
|
|
PROTO_ITEM_SET_GENERATED(ti);
|
|
|
|
field_tree = proto_item_add_subtree(ti, ett_tcp_process_info);
|
|
|
|
if (tcpd->fwd->command) {
|
|
|
|
proto_tree_add_uint_format_value(field_tree, hf_tcp_proc_dst_uid, tvb, 0, 0,
|
|
|
|
tcpd->fwd->process_uid, "%u", tcpd->fwd->process_uid);
|
|
|
|
proto_tree_add_uint_format_value(field_tree, hf_tcp_proc_dst_pid, tvb, 0, 0,
|
|
|
|
tcpd->fwd->process_pid, "%u", tcpd->fwd->process_pid);
|
|
|
|
proto_tree_add_string_format_value(field_tree, hf_tcp_proc_dst_uname, tvb, 0, 0,
|
|
|
|
tcpd->fwd->username, "%s", tcpd->fwd->username);
|
|
|
|
proto_tree_add_string_format_value(field_tree, hf_tcp_proc_dst_cmd, tvb, 0, 0,
|
|
|
|
tcpd->fwd->command, "%s", tcpd->fwd->command);
|
|
|
|
}
|
|
|
|
if (tcpd->rev->command) {
|
|
|
|
proto_tree_add_uint_format_value(field_tree, hf_tcp_proc_src_uid, tvb, 0, 0,
|
|
|
|
tcpd->rev->process_uid, "%u", tcpd->rev->process_uid);
|
|
|
|
proto_tree_add_uint_format_value(field_tree, hf_tcp_proc_src_pid, tvb, 0, 0,
|
|
|
|
tcpd->rev->process_pid, "%u", tcpd->rev->process_pid);
|
|
|
|
proto_tree_add_string_format_value(field_tree, hf_tcp_proc_src_uname, tvb, 0, 0,
|
|
|
|
tcpd->rev->username, "%s", tcpd->rev->username);
|
|
|
|
proto_tree_add_string_format_value(field_tree, hf_tcp_proc_src_cmd, tvb, 0, 0,
|
|
|
|
tcpd->rev->command, "%s", tcpd->rev->command);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-06-04 08:45:10 +00:00
|
|
|
/*
|
|
|
|
* XXX - what, if any, of this should we do if this is included in an
|
|
|
|
* error packet? It might be nice to see the details of the packet
|
|
|
|
* that caused the ICMP error, but it might not be nice to have the
|
|
|
|
* dissector update state based on it.
|
|
|
|
* Also, we probably don't want to run TCP taps on those packets.
|
|
|
|
*/
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
if (length_remaining != 0) {
|
2002-12-17 11:49:32 +00:00
|
|
|
if (tcph->th_flags & TH_RST) {
|
2000-07-30 08:20:52 +00:00
|
|
|
/*
|
|
|
|
* RFC1122 says:
|
|
|
|
*
|
|
|
|
* 4.2.2.12 RST Segment: RFC-793 Section 3.4
|
|
|
|
*
|
|
|
|
* A TCP SHOULD allow a received RST segment to include data.
|
|
|
|
*
|
|
|
|
* DISCUSSION
|
|
|
|
* It has been suggested that a RST segment could contain
|
|
|
|
* ASCII text that encoded and explained the cause of the
|
|
|
|
* RST. No standard has yet been established for such
|
|
|
|
* data.
|
|
|
|
*
|
|
|
|
* so for segments with RST we just display the data as text.
|
|
|
|
*/
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
proto_tree_add_text(tcp_tree, tvb, offset, length_remaining,
|
2000-07-30 08:20:52 +00:00
|
|
|
"Reset cause: %s",
|
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors.
Register the IP dissector and have dissectors that call it directly
(rather than through a port table) call it through a handle.
Add a routine "tvb_set_reported_length()" which a dissector can use if
it was handed a tvbuff that contains more data than is actually in its
part of the packet - for example, handing a padded Ethernet frame to IP;
the routine sets the reported length of the tvbuff (and also adjusts the
actual length, as appropriate). Then use it in IP.
Given that, "ethertype()" can determine how much of the Ethernet frame
was actually part of an IP datagram (and can do the same for other
protocols under Ethernet that use "tvb_set_reported_length()"; have it
return the actual length, and have "dissect_eth()" and "dissect_vlan()"
use that to mark trailer data in Ethernet II frames as well as in 802.3
frames.
svn path=/trunk/; revision=2658
2000-11-18 10:38:33 +00:00
|
|
|
tvb_format_text(tvb, offset, length_remaining));
|
2001-09-13 07:56:53 +00:00
|
|
|
} else {
|
2003-12-30 00:03:48 +00:00
|
|
|
dissect_tcp_payload(tvb, pinfo, offset, tcph->th_seq, nxtseq,
|
2006-01-26 22:50:16 +00:00
|
|
|
tcph->th_sport, tcph->th_dport, tree, tcp_tree, tcpd);
|
2001-09-13 07:56:53 +00:00
|
|
|
}
|
2000-07-30 08:20:52 +00:00
|
|
|
}
|
1998-09-16 02:39:15 +00:00
|
|
|
}
|
1999-07-17 04:19:15 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
proto_register_tcp(void)
|
|
|
|
{
|
|
|
|
static hf_register_info hf[] = {
|
|
|
|
|
|
|
|
{ &hf_tcp_srcport,
|
1999-10-12 06:21:15 +00:00
|
|
|
{ "Source Port", "tcp.srcport", FT_UINT16, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }},
|
1999-07-17 04:19:15 +00:00
|
|
|
|
|
|
|
{ &hf_tcp_dstport,
|
1999-10-12 06:21:15 +00:00
|
|
|
{ "Destination Port", "tcp.dstport", FT_UINT16, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }},
|
1999-07-17 04:19:15 +00:00
|
|
|
|
|
|
|
{ &hf_tcp_port,
|
1999-10-12 06:21:15 +00:00
|
|
|
{ "Source or Destination Port", "tcp.port", FT_UINT16, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }},
|
1999-07-17 04:19:15 +00:00
|
|
|
|
2008-09-30 12:24:27 +00:00
|
|
|
{ &hf_tcp_stream,
|
|
|
|
{ "Stream index", "tcp.stream", FT_UINT32, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }},
|
2008-09-30 12:24:27 +00:00
|
|
|
|
1999-07-17 04:19:15 +00:00
|
|
|
{ &hf_tcp_seq,
|
1999-10-12 06:21:15 +00:00
|
|
|
{ "Sequence number", "tcp.seq", FT_UINT32, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }},
|
1999-07-17 04:19:15 +00:00
|
|
|
|
2000-09-21 00:44:09 +00:00
|
|
|
{ &hf_tcp_nxtseq,
|
|
|
|
{ "Next sequence number", "tcp.nxtseq", FT_UINT32, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }},
|
2000-09-21 00:44:09 +00:00
|
|
|
|
1999-07-17 04:19:15 +00:00
|
|
|
{ &hf_tcp_ack,
|
1999-10-12 06:21:15 +00:00
|
|
|
{ "Acknowledgement number", "tcp.ack", FT_UINT32, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }},
|
1999-11-02 05:03:02 +00:00
|
|
|
|
1999-11-02 07:04:46 +00:00
|
|
|
{ &hf_tcp_hdr_len,
|
|
|
|
{ "Header Length", "tcp.hdr_len", FT_UINT8, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }},
|
1999-11-02 05:03:02 +00:00
|
|
|
|
|
|
|
{ &hf_tcp_flags,
|
|
|
|
{ "Flags", "tcp.flags", FT_UINT8, BASE_HEX, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }},
|
1999-11-02 05:03:02 +00:00
|
|
|
|
2000-09-14 21:58:48 +00:00
|
|
|
{ &hf_tcp_flags_cwr,
|
2009-07-07 14:54:15 +00:00
|
|
|
{ "Congestion Window Reduced (CWR)", "tcp.flags.cwr", FT_BOOLEAN, 8, TFS(&tfs_set_notset), TH_CWR,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }},
|
2000-09-14 21:58:48 +00:00
|
|
|
|
|
|
|
{ &hf_tcp_flags_ecn,
|
2009-07-07 14:54:15 +00:00
|
|
|
{ "ECN-Echo", "tcp.flags.ecn", FT_BOOLEAN, 8, TFS(&tfs_set_notset), TH_ECN,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }},
|
2000-09-14 21:58:48 +00:00
|
|
|
|
1999-11-02 05:03:02 +00:00
|
|
|
{ &hf_tcp_flags_urg,
|
2009-07-07 14:54:15 +00:00
|
|
|
{ "Urgent", "tcp.flags.urg", FT_BOOLEAN, 8, TFS(&tfs_set_notset), TH_URG,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }},
|
1999-11-02 05:03:02 +00:00
|
|
|
|
|
|
|
{ &hf_tcp_flags_ack,
|
2009-07-07 14:54:15 +00:00
|
|
|
{ "Acknowledgement", "tcp.flags.ack", FT_BOOLEAN, 8, TFS(&tfs_set_notset), TH_ACK,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }},
|
1999-11-02 05:03:02 +00:00
|
|
|
|
|
|
|
{ &hf_tcp_flags_push,
|
2009-07-07 14:54:15 +00:00
|
|
|
{ "Push", "tcp.flags.push", FT_BOOLEAN, 8, TFS(&tfs_set_notset), TH_PUSH,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }},
|
1999-11-02 05:03:02 +00:00
|
|
|
|
|
|
|
{ &hf_tcp_flags_reset,
|
2009-07-07 14:54:15 +00:00
|
|
|
{ "Reset", "tcp.flags.reset", FT_BOOLEAN, 8, TFS(&tfs_set_notset), TH_RST,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }},
|
1999-11-02 05:03:02 +00:00
|
|
|
|
|
|
|
{ &hf_tcp_flags_syn,
|
2009-07-07 14:54:15 +00:00
|
|
|
{ "Syn", "tcp.flags.syn", FT_BOOLEAN, 8, TFS(&tfs_set_notset), TH_SYN,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }},
|
1999-11-02 05:03:02 +00:00
|
|
|
|
|
|
|
{ &hf_tcp_flags_fin,
|
2009-07-07 14:54:15 +00:00
|
|
|
{ "Fin", "tcp.flags.fin", FT_BOOLEAN, 8, TFS(&tfs_set_notset), TH_FIN,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }},
|
1999-11-02 05:03:02 +00:00
|
|
|
|
2003-09-12 05:52:38 +00:00
|
|
|
/* 32 bits so we can present some values adjusted to window scaling */
|
1999-11-02 05:03:02 +00:00
|
|
|
{ &hf_tcp_window_size,
|
2003-09-12 05:52:38 +00:00
|
|
|
{ "Window size", "tcp.window_size", FT_UINT32, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }},
|
1999-11-02 05:03:02 +00:00
|
|
|
|
|
|
|
{ &hf_tcp_checksum,
|
|
|
|
{ "Checksum", "tcp.checksum", FT_UINT16, BASE_HEX, NULL, 0x0,
|
2006-06-12 19:27:05 +00:00
|
|
|
"Details at: http://www.wireshark.org/docs/wsug_html_chunked/ChAdvChecksums.html", HFILL }},
|
1999-11-02 05:03:02 +00:00
|
|
|
|
2006-10-29 13:53:07 +00:00
|
|
|
{ &hf_tcp_checksum_good,
|
|
|
|
{ "Good Checksum", "tcp.checksum_good", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
|
|
|
"True: checksum matches packet content; False: doesn't match content or not checked", HFILL }},
|
|
|
|
|
2001-02-28 19:33:49 +00:00
|
|
|
{ &hf_tcp_checksum_bad,
|
|
|
|
{ "Bad Checksum", "tcp.checksum_bad", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
2006-10-29 13:53:07 +00:00
|
|
|
"True: checksum doesn't match packet content; False: matches content or not checked", HFILL }},
|
2001-02-28 19:33:49 +00:00
|
|
|
|
2002-08-21 23:57:38 +00:00
|
|
|
{ &hf_tcp_analysis_flags,
|
|
|
|
{ "TCP Analysis Flags", "tcp.analysis.flags", FT_NONE, BASE_NONE, NULL, 0x0,
|
|
|
|
"This frame has some of the TCP analysis flags set", HFILL }},
|
|
|
|
|
2002-08-02 22:41:56 +00:00
|
|
|
{ &hf_tcp_analysis_retransmission,
|
2002-11-07 08:51:07 +00:00
|
|
|
{ "Retransmission", "tcp.analysis.retransmission", FT_NONE, BASE_NONE, NULL, 0x0,
|
2002-08-02 22:41:56 +00:00
|
|
|
"This frame is a suspected TCP retransmission", HFILL }},
|
|
|
|
|
2003-10-25 00:25:38 +00:00
|
|
|
{ &hf_tcp_analysis_fast_retransmission,
|
|
|
|
{ "Fast Retransmission", "tcp.analysis.fast_retransmission", FT_NONE, BASE_NONE, NULL, 0x0,
|
|
|
|
"This frame is a suspected TCP fast retransmission", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_tcp_analysis_out_of_order,
|
|
|
|
{ "Out Of Order", "tcp.analysis.out_of_order", FT_NONE, BASE_NONE, NULL, 0x0,
|
|
|
|
"This frame is a suspected Out-Of-Order segment", HFILL }},
|
|
|
|
|
2007-08-31 15:06:27 +00:00
|
|
|
{ &hf_tcp_analysis_reused_ports,
|
|
|
|
{ "TCP Port numbers reused", "tcp.analysis.reused_ports", FT_NONE, BASE_NONE, NULL, 0x0,
|
|
|
|
"A new tcp session has started with previously used port numbers", HFILL }},
|
|
|
|
|
2002-08-02 22:41:56 +00:00
|
|
|
{ &hf_tcp_analysis_lost_packet,
|
2002-11-07 08:51:07 +00:00
|
|
|
{ "Previous Segment Lost", "tcp.analysis.lost_segment", FT_NONE, BASE_NONE, NULL, 0x0,
|
2002-08-02 22:41:56 +00:00
|
|
|
"A segment before this one was lost from the capture", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_tcp_analysis_ack_lost_packet,
|
2002-11-07 08:51:07 +00:00
|
|
|
{ "ACKed Lost Packet", "tcp.analysis.ack_lost_segment", FT_NONE, BASE_NONE, NULL, 0x0,
|
2002-08-02 22:41:56 +00:00
|
|
|
"This frame ACKs a lost segment", HFILL }},
|
|
|
|
|
2004-12-03 05:53:09 +00:00
|
|
|
{ &hf_tcp_analysis_window_update,
|
|
|
|
{ "Window update", "tcp.analysis.window_update", FT_NONE, BASE_NONE, NULL, 0x0,
|
|
|
|
"This frame is a tcp window update", HFILL }},
|
|
|
|
|
2004-12-19 07:18:04 +00:00
|
|
|
{ &hf_tcp_analysis_window_full,
|
|
|
|
{ "Window full", "tcp.analysis.window_full", FT_NONE, BASE_NONE, NULL, 0x0,
|
2005-09-11 16:55:34 +00:00
|
|
|
"This segment has caused the allowed window to become 100% full", HFILL }},
|
2004-12-19 07:18:04 +00:00
|
|
|
|
2002-08-02 22:41:56 +00:00
|
|
|
{ &hf_tcp_analysis_keep_alive,
|
2002-11-07 08:51:07 +00:00
|
|
|
{ "Keep Alive", "tcp.analysis.keep_alive", FT_NONE, BASE_NONE, NULL, 0x0,
|
2002-08-02 22:41:56 +00:00
|
|
|
"This is a keep-alive segment", HFILL }},
|
|
|
|
|
2003-09-08 10:19:06 +00:00
|
|
|
{ &hf_tcp_analysis_keep_alive_ack,
|
|
|
|
{ "Keep Alive ACK", "tcp.analysis.keep_alive_ack", FT_NONE, BASE_NONE, NULL, 0x0,
|
|
|
|
"This is an ACK to a keep-alive segment", HFILL }},
|
|
|
|
|
2002-11-01 10:25:35 +00:00
|
|
|
{ &hf_tcp_analysis_duplicate_ack,
|
2002-11-07 08:51:07 +00:00
|
|
|
{ "Duplicate ACK", "tcp.analysis.duplicate_ack", FT_NONE, BASE_NONE, NULL, 0x0,
|
2002-11-01 10:25:35 +00:00
|
|
|
"This is a duplicate ACK", HFILL }},
|
|
|
|
|
2003-03-27 09:40:27 +00:00
|
|
|
{ &hf_tcp_analysis_duplicate_ack_num,
|
|
|
|
{ "Duplicate ACK #", "tcp.analysis.duplicate_ack_num", FT_UINT32, BASE_DEC, NULL, 0x0,
|
|
|
|
"This is duplicate ACK number #", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_tcp_analysis_duplicate_ack_frame,
|
2003-03-27 19:55:59 +00:00
|
|
|
{ "Duplicate to the ACK in frame", "tcp.analysis.duplicate_ack_frame", FT_FRAMENUM, BASE_NONE, NULL, 0x0,
|
2003-03-27 09:40:27 +00:00
|
|
|
"This is a duplicate to the ACK in frame #", HFILL }},
|
|
|
|
|
2004-03-19 06:14:03 +00:00
|
|
|
{ &hf_tcp_continuation_to,
|
|
|
|
{ "This is a continuation to the PDU in frame", "tcp.continuation_to", FT_FRAMENUM, BASE_NONE, NULL, 0x0,
|
|
|
|
"This is a continuation to the PDU in frame #", HFILL }},
|
|
|
|
|
2002-11-01 11:05:37 +00:00
|
|
|
{ &hf_tcp_analysis_zero_window_probe,
|
2002-11-07 08:51:07 +00:00
|
|
|
{ "Zero Window Probe", "tcp.analysis.zero_window_probe", FT_NONE, BASE_NONE, NULL, 0x0,
|
2002-11-01 11:05:37 +00:00
|
|
|
"This is a zero-window-probe", HFILL }},
|
|
|
|
|
2006-01-26 22:50:16 +00:00
|
|
|
{ &hf_tcp_analysis_zero_window_probe_ack,
|
|
|
|
{ "Zero Window Probe Ack", "tcp.analysis.zero_window_probe_ack", FT_NONE, BASE_NONE, NULL, 0x0,
|
|
|
|
"This is an ACK to a zero-window-probe", HFILL }},
|
|
|
|
|
2002-11-01 11:05:37 +00:00
|
|
|
{ &hf_tcp_analysis_zero_window,
|
2002-11-07 08:51:07 +00:00
|
|
|
{ "Zero Window", "tcp.analysis.zero_window", FT_NONE, BASE_NONE, NULL, 0x0,
|
2004-02-24 17:49:07 +00:00
|
|
|
"This is a zero-window", HFILL }},
|
2002-11-01 11:05:37 +00:00
|
|
|
|
2002-04-21 02:57:01 +00:00
|
|
|
{ &hf_tcp_len,
|
2002-08-28 21:04:11 +00:00
|
|
|
{ "TCP Segment Len", "tcp.len", FT_UINT32, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL}},
|
2002-04-21 02:57:01 +00:00
|
|
|
|
2002-08-02 22:41:56 +00:00
|
|
|
{ &hf_tcp_analysis_acks_frame,
|
2003-03-27 19:55:59 +00:00
|
|
|
{ "This is an ACK to the segment in frame", "tcp.analysis.acks_frame", FT_FRAMENUM, BASE_NONE, NULL, 0x0,
|
2002-08-02 22:41:56 +00:00
|
|
|
"Which previous segment is this an ACK for", HFILL}},
|
|
|
|
|
2008-08-25 02:15:36 +00:00
|
|
|
{ &hf_tcp_analysis_bytes_in_flight,
|
|
|
|
{ "Number of bytes in flight", "tcp.analysis.bytes_in_flight", FT_UINT32, BASE_DEC, NULL, 0x0,
|
|
|
|
"How many bytes are now in flight for this connection", HFILL}},
|
|
|
|
|
2002-08-02 22:41:56 +00:00
|
|
|
{ &hf_tcp_analysis_ack_rtt,
|
2002-08-28 21:04:11 +00:00
|
|
|
{ "The RTT to ACK the segment was", "tcp.analysis.ack_rtt", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
|
2002-08-02 22:41:56 +00:00
|
|
|
"How long time it took to ACK the segment (RTT)", HFILL}},
|
|
|
|
|
2005-07-10 05:27:38 +00:00
|
|
|
{ &hf_tcp_analysis_rto,
|
|
|
|
{ "The RTO for this segment was", "tcp.analysis.rto", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
|
|
|
|
"How long transmission was delayed before this segment was retransmitted (RTO)", HFILL}},
|
|
|
|
|
|
|
|
{ &hf_tcp_analysis_rto_frame,
|
|
|
|
{ "RTO based on delta from frame", "tcp.analysis.rto_frame", FT_FRAMENUM, BASE_NONE, NULL, 0x0,
|
|
|
|
"This is the frame we measure the RTO from", HFILL }},
|
|
|
|
|
1999-11-02 05:03:02 +00:00
|
|
|
{ &hf_tcp_urgent_pointer,
|
|
|
|
{ "Urgent pointer", "tcp.urgent_pointer", FT_UINT16, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }},
|
2002-12-19 11:22:38 +00:00
|
|
|
|
|
|
|
{ &hf_tcp_segment_overlap,
|
|
|
|
{ "Segment overlap", "tcp.segment.overlap", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
|
|
|
"Segment overlaps with other segments", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_tcp_segment_overlap_conflict,
|
|
|
|
{ "Conflicting data in segment overlap", "tcp.segment.overlap.conflict", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
|
|
|
"Overlapping segments contained conflicting data", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_tcp_segment_multiple_tails,
|
|
|
|
{ "Multiple tail segments found", "tcp.segment.multipletails", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
2004-08-21 09:02:52 +00:00
|
|
|
"Several tails were found when reassembling the pdu", HFILL }},
|
2002-12-19 11:22:38 +00:00
|
|
|
|
|
|
|
{ &hf_tcp_segment_too_long_fragment,
|
|
|
|
{ "Segment too long", "tcp.segment.toolongfragment", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
|
|
|
"Segment contained data past end of the pdu", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_tcp_segment_error,
|
2004-08-21 09:02:52 +00:00
|
|
|
{ "Reassembling error", "tcp.segment.error", FT_FRAMENUM, BASE_NONE, NULL, 0x0,
|
|
|
|
"Reassembling error due to illegal segments", HFILL }},
|
2002-12-19 11:22:38 +00:00
|
|
|
|
|
|
|
{ &hf_tcp_segment,
|
|
|
|
{ "TCP Segment", "tcp.segment", FT_FRAMENUM, BASE_NONE, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }},
|
2002-12-19 11:22:38 +00:00
|
|
|
|
|
|
|
{ &hf_tcp_segments,
|
2005-06-02 18:52:55 +00:00
|
|
|
{ "Reassembled TCP Segments", "tcp.segments", FT_NONE, BASE_NONE, NULL, 0x0,
|
2002-12-19 11:22:38 +00:00
|
|
|
"TCP Segments", HFILL }},
|
2003-08-28 03:35:23 +00:00
|
|
|
|
|
|
|
{ &hf_tcp_reassembled_in,
|
|
|
|
{ "Reassembled PDU in frame", "tcp.reassembled_in", FT_FRAMENUM, BASE_NONE, NULL, 0x0,
|
2004-08-21 11:11:13 +00:00
|
|
|
"The PDU that doesn't end in this segment is reassembled in this frame", HFILL }},
|
2003-08-28 03:35:23 +00:00
|
|
|
|
2006-10-28 21:32:38 +00:00
|
|
|
{ &hf_tcp_options,
|
|
|
|
{ "TCP Options", "tcp.options", FT_BYTES,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
2006-10-28 21:32:38 +00:00
|
|
|
|
2003-03-01 05:02:53 +00:00
|
|
|
{ &hf_tcp_option_mss,
|
2006-01-30 23:29:09 +00:00
|
|
|
{ "TCP MSS Option", "tcp.options.mss", FT_BOOLEAN,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
2003-08-28 03:35:23 +00:00
|
|
|
|
2003-03-01 08:28:59 +00:00
|
|
|
{ &hf_tcp_option_mss_val,
|
|
|
|
{ "TCP MSS Option Value", "tcp.options.mss_val", FT_UINT16,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
BASE_DEC, NULL, 0x0, NULL, HFILL}},
|
2003-08-28 03:35:23 +00:00
|
|
|
|
2003-03-01 08:51:12 +00:00
|
|
|
{ &hf_tcp_option_wscale,
|
2006-01-30 23:29:09 +00:00
|
|
|
{ "TCP Window Scale Option", "tcp.options.wscale",
|
|
|
|
FT_BOOLEAN,
|
2003-03-01 05:02:53 +00:00
|
|
|
BASE_NONE, NULL, 0x0, "TCP Window Option", HFILL}},
|
2003-08-28 03:35:23 +00:00
|
|
|
|
2003-03-01 08:51:12 +00:00
|
|
|
{ &hf_tcp_option_wscale_val,
|
|
|
|
{ "TCP Windows Scale Option Value", "tcp.options.wscale_val",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0, "TCP Window Scale Value",
|
|
|
|
HFILL}},
|
2003-08-28 03:35:23 +00:00
|
|
|
|
2006-01-30 23:29:09 +00:00
|
|
|
{ &hf_tcp_option_sack_perm,
|
|
|
|
{ "TCP Sack Perm Option", "tcp.options.sack_perm",
|
2003-03-01 07:07:07 +00:00
|
|
|
FT_BOOLEAN,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
BASE_NONE, NULL, 0x0, NULL, HFILL}},
|
2003-08-28 03:35:23 +00:00
|
|
|
|
2003-03-01 05:02:53 +00:00
|
|
|
{ &hf_tcp_option_sack,
|
2006-01-30 23:29:09 +00:00
|
|
|
{ "TCP Sack Option", "tcp.options.sack", FT_BOOLEAN,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
BASE_NONE, NULL, 0x0, NULL, HFILL}},
|
2003-08-28 03:35:23 +00:00
|
|
|
|
2003-03-03 03:16:36 +00:00
|
|
|
{ &hf_tcp_option_sack_sle,
|
|
|
|
{"TCP Sack Left Edge", "tcp.options.sack_le", FT_UINT32,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
BASE_DEC, NULL, 0x0, NULL, HFILL}},
|
2003-08-28 03:35:23 +00:00
|
|
|
|
2003-03-03 03:16:36 +00:00
|
|
|
{ &hf_tcp_option_sack_sre,
|
|
|
|
{"TCP Sack Right Edge", "tcp.options.sack_re", FT_UINT32,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
BASE_DEC, NULL, 0x0, NULL, HFILL}},
|
2003-08-28 03:35:23 +00:00
|
|
|
|
2003-03-01 05:02:53 +00:00
|
|
|
{ &hf_tcp_option_echo,
|
2006-01-30 23:29:09 +00:00
|
|
|
{ "TCP Echo Option", "tcp.options.echo", FT_BOOLEAN,
|
2003-03-01 07:07:07 +00:00
|
|
|
BASE_NONE, NULL, 0x0, "TCP Sack Echo", HFILL}},
|
2003-08-28 03:35:23 +00:00
|
|
|
|
2003-03-01 05:02:53 +00:00
|
|
|
{ &hf_tcp_option_echo_reply,
|
2006-01-30 23:29:09 +00:00
|
|
|
{ "TCP Echo Reply Option", "tcp.options.echo_reply",
|
2003-03-01 07:07:07 +00:00
|
|
|
FT_BOOLEAN,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
BASE_NONE, NULL, 0x0, NULL, HFILL}},
|
2003-08-28 03:35:23 +00:00
|
|
|
|
2003-03-01 05:02:53 +00:00
|
|
|
{ &hf_tcp_option_time_stamp,
|
2006-01-30 23:29:09 +00:00
|
|
|
{ "TCP Time Stamp Option", "tcp.options.time_stamp",
|
2003-03-01 07:07:07 +00:00
|
|
|
FT_BOOLEAN,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
BASE_NONE, NULL, 0x0, NULL, HFILL}},
|
2003-08-28 03:35:23 +00:00
|
|
|
|
2003-03-01 05:02:53 +00:00
|
|
|
{ &hf_tcp_option_cc,
|
2003-03-01 07:07:07 +00:00
|
|
|
{ "TCP CC Option", "tcp.options.cc", FT_BOOLEAN, BASE_NONE,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, 0x0, NULL, HFILL}},
|
2003-08-28 03:35:23 +00:00
|
|
|
|
2003-03-01 05:02:53 +00:00
|
|
|
{ &hf_tcp_option_ccnew,
|
2006-01-30 23:29:09 +00:00
|
|
|
{ "TCP CC New Option", "tcp.options.ccnew", FT_BOOLEAN,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
BASE_NONE, NULL, 0x0, NULL, HFILL}},
|
2003-08-28 03:35:23 +00:00
|
|
|
|
2003-03-01 05:02:53 +00:00
|
|
|
{ &hf_tcp_option_ccecho,
|
2003-03-01 07:07:07 +00:00
|
|
|
{ "TCP CC Echo Option", "tcp.options.ccecho", FT_BOOLEAN,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
BASE_NONE, NULL, 0x0, NULL, HFILL}},
|
2003-08-28 03:35:23 +00:00
|
|
|
|
2003-03-01 05:02:53 +00:00
|
|
|
{ &hf_tcp_option_md5,
|
2003-03-01 07:07:07 +00:00
|
|
|
{ "TCP MD5 Option", "tcp.options.md5", FT_BOOLEAN, BASE_NONE,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, 0x0, NULL, HFILL}},
|
2004-11-12 22:04:19 +00:00
|
|
|
|
2007-06-04 23:27:12 +00:00
|
|
|
{ &hf_tcp_option_qs,
|
|
|
|
{ "TCP QS Option", "tcp.options.qs", FT_BOOLEAN, BASE_NONE,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, 0x0, NULL, HFILL}},
|
2007-06-04 23:27:12 +00:00
|
|
|
|
2008-08-12 21:08:46 +00:00
|
|
|
{ &hf_tcp_option_scps,
|
|
|
|
{ "TCP SCPS Capabilities Option", "tcp.options.scps",
|
|
|
|
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL}},
|
2008-08-12 21:08:46 +00:00
|
|
|
|
|
|
|
{ &hf_tcp_option_scps_vector,
|
|
|
|
{ "TCP SCPS Capabilities Vector", "tcp.options.scps.vector",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL}},
|
2008-08-12 21:08:46 +00:00
|
|
|
|
|
|
|
{ &hf_tcp_option_scps_binding,
|
|
|
|
{ "TCP SCPS Extended Binding Spacce",
|
|
|
|
"tcp.options.scps.binding",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
|
|
|
"TCP SCPS Extended Binding Space", HFILL}},
|
|
|
|
|
|
|
|
{ &hf_tcp_option_snack,
|
|
|
|
{ "TCP Selective Negative Acknowledgement Option",
|
|
|
|
"tcp.options.snack",
|
|
|
|
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL}},
|
2008-08-12 21:08:46 +00:00
|
|
|
|
|
|
|
{ &hf_tcp_option_snack_offset,
|
|
|
|
{ "TCP SNACK Offset", "tcp.options.snack.offset",
|
|
|
|
FT_UINT16, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL}},
|
2008-08-12 21:08:46 +00:00
|
|
|
|
|
|
|
{ &hf_tcp_option_snack_size,
|
|
|
|
{ "TCP SNACK Size", "tcp.options.snack.size",
|
|
|
|
FT_UINT16, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL}},
|
2008-08-12 21:08:46 +00:00
|
|
|
|
|
|
|
{ &hf_tcp_option_snack_le,
|
|
|
|
{ "TCP SNACK Left Edge", "tcp.options.snack.le",
|
|
|
|
FT_UINT16, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL}},
|
2008-08-12 21:08:46 +00:00
|
|
|
|
|
|
|
{ &hf_tcp_option_snack_re,
|
|
|
|
{ "TCP SNACK Right Edge", "tcp.options.snack.re",
|
|
|
|
FT_UINT16, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL}},
|
2008-08-12 21:08:46 +00:00
|
|
|
|
|
|
|
{ &hf_tcp_scpsoption_flags_bets,
|
|
|
|
{ "Partial Reliability Capable (BETS)",
|
|
|
|
"tcp.options.scpsflags.bets", FT_BOOLEAN, 8,
|
2009-07-07 14:54:15 +00:00
|
|
|
TFS(&tfs_set_notset), 0x80, NULL, HFILL }},
|
2008-08-12 21:08:46 +00:00
|
|
|
|
|
|
|
{ &hf_tcp_scpsoption_flags_snack1,
|
|
|
|
{ "Short Form SNACK Capable (SNACK1)",
|
|
|
|
"tcp.options.scpsflags.snack1", FT_BOOLEAN, 8,
|
2009-07-07 14:54:15 +00:00
|
|
|
TFS(&tfs_set_notset), 0x40, NULL, HFILL }},
|
2008-08-12 21:08:46 +00:00
|
|
|
|
|
|
|
{ &hf_tcp_scpsoption_flags_snack2,
|
|
|
|
{ "Long Form SNACK Capable (SNACK2)",
|
|
|
|
"tcp.options.scpsflags.snack2", FT_BOOLEAN, 8,
|
2009-07-07 14:54:15 +00:00
|
|
|
TFS(&tfs_set_notset), 0x20, NULL, HFILL }},
|
2008-08-12 21:08:46 +00:00
|
|
|
|
|
|
|
{ &hf_tcp_scpsoption_flags_compress,
|
|
|
|
{ "Lossless Header Compression (COMP)",
|
|
|
|
"tcp.options.scpsflags.compress", FT_BOOLEAN, 8,
|
2009-07-07 14:54:15 +00:00
|
|
|
TFS(&tfs_set_notset), 0x10, NULL, HFILL }},
|
2008-08-12 21:08:46 +00:00
|
|
|
|
|
|
|
{ &hf_tcp_scpsoption_flags_nlts,
|
|
|
|
{ "Network Layer Timestamp (NLTS)",
|
|
|
|
"tcp.options.scpsflags.nlts", FT_BOOLEAN, 8,
|
2009-07-07 14:54:15 +00:00
|
|
|
TFS(&tfs_set_notset), 0x8, NULL, HFILL }},
|
2008-08-12 21:08:46 +00:00
|
|
|
|
|
|
|
{ &hf_tcp_scpsoption_flags_resv1,
|
|
|
|
{ "Reserved Bit 1",
|
|
|
|
"tcp.options.scpsflags.reserved1", FT_BOOLEAN, 8,
|
2009-07-07 14:54:15 +00:00
|
|
|
TFS(&tfs_set_notset), 0x4, NULL, HFILL }},
|
2008-08-12 21:08:46 +00:00
|
|
|
|
|
|
|
{ &hf_tcp_scpsoption_flags_resv2,
|
|
|
|
{ "Reserved Bit 2",
|
|
|
|
"tcp.options.scpsflags.reserved2", FT_BOOLEAN, 8,
|
2009-07-07 14:54:15 +00:00
|
|
|
TFS(&tfs_set_notset), 0x2, NULL, HFILL }},
|
2008-08-12 21:08:46 +00:00
|
|
|
|
|
|
|
{ &hf_tcp_scpsoption_flags_resv3,
|
|
|
|
{ "Reserved Bit 3",
|
|
|
|
"tcp.options.scpsflags.reserved3", FT_BOOLEAN, 8,
|
2009-07-07 14:54:15 +00:00
|
|
|
TFS(&tfs_set_notset), 0x1, NULL, HFILL }},
|
2008-08-12 21:08:46 +00:00
|
|
|
|
2004-11-12 22:04:19 +00:00
|
|
|
{ &hf_tcp_pdu_time,
|
|
|
|
{ "Time until the last segment of this PDU", "tcp.pdu.time", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
|
|
|
|
"How long time has passed until the last frame of this PDU", HFILL}},
|
2007-09-25 20:37:13 +00:00
|
|
|
|
2006-10-22 00:21:40 +00:00
|
|
|
{ &hf_tcp_pdu_size,
|
|
|
|
{ "PDU Size", "tcp.pdu.size", FT_UINT32, BASE_DEC, NULL, 0x0,
|
|
|
|
"The size of this PDU", HFILL}},
|
|
|
|
|
2004-11-12 22:04:19 +00:00
|
|
|
{ &hf_tcp_pdu_last_frame,
|
|
|
|
{ "Last frame of this PDU", "tcp.pdu.last_frame", FT_FRAMENUM, BASE_NONE, NULL, 0x0,
|
|
|
|
"This is the last frame of the PDU starting in this segment", HFILL }},
|
|
|
|
|
2007-09-25 20:37:13 +00:00
|
|
|
{ &hf_tcp_ts_relative,
|
|
|
|
{ "Time since first frame in this TCP stream", "tcp.time_relative", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
|
|
|
|
"Time relative to first frame in this TCP stream", HFILL}},
|
|
|
|
|
|
|
|
{ &hf_tcp_ts_delta,
|
|
|
|
{ "Time since previous frame in this TCP stream", "tcp.time_delta", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
|
|
|
|
"Time delta from previous frame in this TCP stream", HFILL}},
|
2009-05-14 23:33:17 +00:00
|
|
|
|
|
|
|
{ &hf_tcp_proc_src_uid,
|
|
|
|
{ "Source process user ID", "tcp.proc.srcuid", FT_UINT32, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL}},
|
2009-05-14 23:33:17 +00:00
|
|
|
|
|
|
|
{ &hf_tcp_proc_src_pid,
|
|
|
|
{ "Source process ID", "tcp.proc.srcpid", FT_UINT32, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL}},
|
2009-05-14 23:33:17 +00:00
|
|
|
|
|
|
|
{ &hf_tcp_proc_src_uname,
|
|
|
|
{ "Source process user name", "tcp.proc.srcuname", FT_STRING, BASE_NONE, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL}},
|
2009-05-14 23:33:17 +00:00
|
|
|
|
|
|
|
{ &hf_tcp_proc_src_cmd,
|
|
|
|
{ "Source process name", "tcp.proc.srccmd", FT_STRING, BASE_NONE, NULL, 0x0,
|
|
|
|
"Source process command name", HFILL}},
|
|
|
|
|
|
|
|
{ &hf_tcp_proc_dst_uid,
|
|
|
|
{ "Destination process user ID", "tcp.proc.dstuid", FT_UINT32, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL}},
|
2009-05-14 23:33:17 +00:00
|
|
|
|
|
|
|
{ &hf_tcp_proc_dst_pid,
|
|
|
|
{ "Destination process ID", "tcp.proc.dstpid", FT_UINT32, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL}},
|
2009-05-14 23:33:17 +00:00
|
|
|
|
|
|
|
{ &hf_tcp_proc_dst_uname,
|
|
|
|
{ "Destination process user name", "tcp.proc.dstuname", FT_STRING, BASE_NONE, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL}},
|
2009-05-14 23:33:17 +00:00
|
|
|
|
|
|
|
{ &hf_tcp_proc_dst_cmd,
|
|
|
|
{ "Destination process name", "tcp.proc.dstcmd", FT_STRING, BASE_NONE, NULL, 0x0,
|
|
|
|
"Destination process command name", HFILL}}
|
1999-07-17 04:19:15 +00:00
|
|
|
};
|
2007-09-25 20:37:13 +00:00
|
|
|
|
1999-11-16 11:44:20 +00:00
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_tcp,
|
|
|
|
&ett_tcp_flags,
|
|
|
|
&ett_tcp_options,
|
|
|
|
&ett_tcp_option_sack,
|
2008-08-12 21:08:46 +00:00
|
|
|
&ett_tcp_option_scps,
|
|
|
|
&ett_tcp_option_scps_extended,
|
2002-08-21 23:57:38 +00:00
|
|
|
&ett_tcp_analysis_faults,
|
2002-12-19 11:22:38 +00:00
|
|
|
&ett_tcp_analysis,
|
2007-09-25 20:37:13 +00:00
|
|
|
&ett_tcp_timestamps,
|
2002-12-19 11:22:38 +00:00
|
|
|
&ett_tcp_segments,
|
2006-10-29 13:53:07 +00:00
|
|
|
&ett_tcp_segment,
|
2009-05-14 23:33:17 +00:00
|
|
|
&ett_tcp_checksum,
|
|
|
|
&ett_tcp_process_info
|
1999-11-16 11:44:20 +00:00
|
|
|
};
|
2000-07-13 14:16:49 +00:00
|
|
|
module_t *tcp_module;
|
1999-07-17 04:19:15 +00:00
|
|
|
|
2001-01-03 06:56:03 +00:00
|
|
|
proto_tcp = proto_register_protocol("Transmission Control Protocol",
|
|
|
|
"TCP", "tcp");
|
1999-07-17 04:19:15 +00:00
|
|
|
proto_register_field_array(proto_tcp, hf, array_length(hf));
|
1999-11-16 11:44:20 +00:00
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
2000-04-03 09:24:12 +00:00
|
|
|
|
2000-07-13 14:16:49 +00:00
|
|
|
/* subdissector code */
|
2001-12-08 06:41:48 +00:00
|
|
|
subdissector_table = register_dissector_table("tcp.port",
|
|
|
|
"TCP port", FT_UINT16, BASE_DEC);
|
Add routines to:
register lists of "heuristic" dissectors, which are handed a
frame that may or may contain a payload for the protocol they
dissect, and that return FALSE if it's not or dissect the packet
and return TRUE if it is;
add a dissector to such a list;
go through such a list, calling each dissector until either a
dissector returns TRUE, in which case the routine returns TRUE,
or it runs out of entries in the list, in which case the routine
returns FALSE.
Have lists of heuristic dissectors for TCP and for COTP when used with
the Inactive Subset of CLNP, and add the GIOP and Yahoo Messenger
dissectors to the first list and the Sinec H1 dissector to the second
list.
Make the dissector name argument to "dissector_add()" and
"dissector_delete()" a "const char *" rarther than just a "char *".
Add "heur_dissector_add()", the routine to add a heuristic dissector to
a list of heuristic dissectors, to the set of routines we can export to
plugins through a table on platforms where dynamically-loaded code can't
call stuff in the main program, and initialize the element in the table
in question for "dissector_add()" (which we'd forgotten to do).
svn path=/trunk/; revision=1909
2000-05-05 09:32:36 +00:00
|
|
|
register_heur_dissector_list("tcp", &heur_subdissector_list);
|
2000-07-13 14:16:49 +00:00
|
|
|
|
2000-12-13 02:24:23 +00:00
|
|
|
/* Register configuration preferences */
|
2001-01-03 07:53:48 +00:00
|
|
|
tcp_module = prefs_register_protocol(proto_tcp, NULL);
|
2003-01-28 23:56:40 +00:00
|
|
|
prefs_register_bool_preference(tcp_module, "summary_in_tree",
|
2000-07-13 14:16:49 +00:00
|
|
|
"Show TCP summary in protocol tree",
|
2003-07-24 21:11:20 +00:00
|
|
|
"Whether the TCP summary line should be shown in the protocol tree",
|
2000-12-13 02:24:23 +00:00
|
|
|
&tcp_summary_in_tree);
|
2002-01-18 22:35:19 +00:00
|
|
|
prefs_register_bool_preference(tcp_module, "check_checksum",
|
2005-09-11 16:55:34 +00:00
|
|
|
"Validate the TCP checksum if possible",
|
|
|
|
"Whether to validate the TCP checksum",
|
2002-01-18 22:35:19 +00:00
|
|
|
&tcp_check_checksum);
|
2001-09-13 07:56:53 +00:00
|
|
|
prefs_register_bool_preference(tcp_module, "desegment_tcp_streams",
|
2004-08-21 09:02:52 +00:00
|
|
|
"Allow subdissector to reassemble TCP streams",
|
|
|
|
"Whether subdissector can request TCP streams to be reassembled",
|
2001-09-13 07:56:53 +00:00
|
|
|
&tcp_desegment);
|
2003-01-28 23:56:40 +00:00
|
|
|
prefs_register_bool_preference(tcp_module, "analyze_sequence_numbers",
|
2002-08-02 22:41:56 +00:00
|
|
|
"Analyze TCP sequence numbers",
|
|
|
|
"Make the TCP dissector analyze TCP sequence numbers to find and flag segment retransmissions, missing segments and RTT",
|
|
|
|
&tcp_analyze_seq);
|
2003-01-28 23:56:40 +00:00
|
|
|
prefs_register_bool_preference(tcp_module, "relative_sequence_numbers",
|
2003-09-18 19:19:51 +00:00
|
|
|
"Relative sequence numbers and window scaling",
|
|
|
|
"Make the TCP dissector use relative sequence numbers instead of absolute ones. "
|
|
|
|
"To use this option you must also enable \"Analyze TCP sequence numbers\". "
|
|
|
|
"This option will also try to track and adjust the window field according to any TCP window scaling options seen.",
|
2002-08-02 22:41:56 +00:00
|
|
|
&tcp_relative_seq);
|
2008-08-25 02:15:36 +00:00
|
|
|
prefs_register_bool_preference(tcp_module, "track_bytes_in_flight",
|
|
|
|
"Track number of bytes in flight",
|
|
|
|
"Make the TCP dissector track the number on un-ACKed bytes of data are in flight per packet. "
|
|
|
|
"To use this option you must also enable \"Analyze TCP sequence numbers\". "
|
|
|
|
"This takes a lot of memory but allows you to track how much data are in flight at a time and graphing it in io-graphs",
|
|
|
|
&tcp_track_bytes_in_flight);
|
2007-09-25 20:37:13 +00:00
|
|
|
prefs_register_bool_preference(tcp_module, "calculate_timestamps",
|
|
|
|
"Calculate conversation timestamps",
|
|
|
|
"Calculate timestamps relative to the first frame and the previous frame in the tcp conversation",
|
|
|
|
&tcp_calculate_ts);
|
2003-07-24 21:11:20 +00:00
|
|
|
prefs_register_bool_preference(tcp_module, "try_heuristic_first",
|
|
|
|
"Try heuristic sub-dissectors first",
|
|
|
|
"Try to decode a packet using an heuristic sub-dissector before using a sub-dissector registered to a specific port",
|
|
|
|
&try_heuristic_first);
|
2002-08-02 22:41:56 +00:00
|
|
|
|
2001-09-13 07:56:53 +00:00
|
|
|
register_init_routine(tcp_fragment_init);
|
1999-07-17 04:19:15 +00:00
|
|
|
}
|
2000-04-16 22:46:25 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_tcp(void)
|
|
|
|
{
|
2001-12-03 04:00:26 +00:00
|
|
|
dissector_handle_t tcp_handle;
|
|
|
|
|
|
|
|
tcp_handle = create_dissector_handle(dissect_tcp, proto_tcp);
|
|
|
|
dissector_add("ip.proto", IP_PROTO_TCP, tcp_handle);
|
2001-11-26 04:52:51 +00:00
|
|
|
data_handle = find_dissector("data");
|
2002-12-17 11:49:32 +00:00
|
|
|
tcp_tap = register_tap("tcp");
|
2000-04-16 22:46:25 +00:00
|
|
|
}
|
2009-05-14 23:33:17 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Editor modelines
|
|
|
|
*
|
|
|
|
* Local Variables:
|
|
|
|
* c-basic-offset: 4
|
|
|
|
* tab-width: 4
|
|
|
|
* indent-tabs-mode: t
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* ex: set shiftwidth=4 tabstop=4 noexpandtab
|
|
|
|
* :indentSize=4:tabSize=4:noTabs=false:
|
|
|
|
*/
|