#include <epan/prefs.h>
#include <epan/emem.h>
#include "packet-tcp.h"
-#include "packet-ip.h"
#include "packet-frame.h"
#include <epan/conversation.h>
-#include <epan/strutil.h>
#include <epan/reassemble.h>
#include <epan/tap.h>
#include <epan/slab.h>
* packet to the capture program but a checksummed packet got put onto
* the wire.
*/
-static gboolean tcp_check_checksum = TRUE;
+static gboolean tcp_check_checksum = FALSE;
extern FILE* data_out_file;
static int hf_tcp_srcport = -1;
static int hf_tcp_dstport = -1;
static int hf_tcp_port = -1;
+static int hf_tcp_stream = -1;
static int hf_tcp_seq = -1;
static int hf_tcp_nxtseq = -1;
static int hf_tcp_ack = -1;
static int hf_tcp_len = -1;
static int hf_tcp_urgent_pointer = -1;
static int hf_tcp_analysis_flags = -1;
+static int hf_tcp_analysis_bytes_in_flight = -1;
static int hf_tcp_analysis_acks_frame = -1;
static int hf_tcp_analysis_ack_rtt = -1;
static int hf_tcp_analysis_rto = -1;
static int hf_tcp_option_qs = -1;
static int hf_tcp_ts_relative = -1;
static int hf_tcp_ts_delta = -1;
+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;
+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;
static gint ett_tcp = -1;
static gint ett_tcp_flags = -1;
static gint ett_tcp_options = -1;
static gint ett_tcp_option_sack = -1;
+static gint ett_tcp_option_scps = -1;
+static gint ett_tcp_option_scps_extended = -1;
static gint ett_tcp_analysis = -1;
static gint ett_tcp_analysis_faults = -1;
static gint ett_tcp_timestamps = -1;
static gint ett_tcp_segments = -1;
static gint ett_tcp_segment = -1;
static gint ett_tcp_checksum = -1;
+static gint ett_tcp_process_info = -1;
/* not all of the hf_fields below make sense for TCP but we have to provide
* **************************************************************************/
static gboolean tcp_analyze_seq = TRUE;
static gboolean tcp_relative_seq = TRUE;
+static gboolean tcp_track_bytes_in_flight = TRUE;
static gboolean tcp_calculate_ts = FALSE;
/* SLAB allocator for tcp_unacked structures
struct tcp_analysis *
-get_tcp_conversation_data(packet_info *pinfo)
+init_tcp_conversation_data(packet_info *pinfo)
{
- int direction;
- conversation_t *conv=NULL;
struct tcp_analysis *tcpd=NULL;
+ /* Initialize the tcp protocol datat structure to add to the tcp conversation */
+ tcpd=se_alloc0(sizeof(struct tcp_analysis));
+ memset(&tcpd->flow1, 0, sizeof(tcp_flow_t));
+ memset(&tcpd->flow2, 0, sizeof(tcp_flow_t));
+ tcpd->flow1.win_scale=-1;
+ tcpd->flow1.multisegment_pdus=se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "tcp_multisegment_pdus");
+ tcpd->flow1.username = NULL;
+ tcpd->flow1.command = NULL;
+ tcpd->flow2.win_scale=-1;
+ tcpd->flow2.multisegment_pdus=se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "tcp_multisegment_pdus");
+ tcpd->flow2.username = NULL;
+ tcpd->flow2.command = NULL;
+ 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;
+
+ return tcpd;
+}
+
+conversation_t *
+get_tcp_conversation(packet_info *pinfo)
+{
+ conversation_t *conv=NULL;
+
/* 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);
}
+ return conv;
+}
- /* check if we have any data for this conversation */
- tcpd=conversation_get_proto_data(conv, proto_tcp);
- if(!tcpd){
- /* No no such data yet. Allocate and init it */
- tcpd=se_alloc(sizeof(struct tcp_analysis));
- tcpd->flow1.segments=NULL;
- tcpd->flow1.base_seq=0;
- tcpd->flow1.lastack=0;
- tcpd->flow1.lastacktime.secs=0;
- tcpd->flow1.lastacktime.nsecs=0;
- tcpd->flow1.lastnondupack=0;
- tcpd->flow1.nextseq=0;
- tcpd->flow1.nextseqtime.secs=0;
- tcpd->flow1.nextseqtime.nsecs=0;
- tcpd->flow1.nextseqframe=0;
- tcpd->flow1.window=0;
- tcpd->flow1.win_scale=-1;
- tcpd->flow1.flags=0;
- tcpd->flow1.multisegment_pdus=se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "tcp_multisegment_pdus");
- tcpd->flow2.segments=NULL;
- tcpd->flow2.base_seq=0;
- tcpd->flow2.lastack=0;
- tcpd->flow2.lastacktime.secs=0;
- tcpd->flow2.lastacktime.nsecs=0;
- tcpd->flow2.lastnondupack=0;
- tcpd->flow2.nextseq=0;
- tcpd->flow2.nextseqtime.secs=0;
- tcpd->flow2.nextseqtime.nsecs=0;
- tcpd->flow2.nextseqframe=0;
- tcpd->flow2.window=0;
- tcpd->flow2.win_scale=-1;
- tcpd->flow2.flags=0;
- tcpd->flow2.multisegment_pdus=se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "tcp_multisegment_pdus");
- 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;
+struct tcp_analysis *
+get_tcp_conversation_data(conversation_t *conv, packet_info *pinfo)
+{
+ int direction;
+ struct tcp_analysis *tcpd=NULL;
+
+ /* 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
+ * conversation with template options, tcpd will not
+ * 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);
}
+ if (!tcpd) {
+ return NULL;
+ }
/* 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) {
- direction= (pinfo->srcport > pinfo->destport)*2-1;
+ direction= (pinfo->srcport > pinfo->destport) ? 1 : -1;
}
if(direction>=0){
tcpd->fwd=&(tcpd->flow1);
return tcpd;
}
+/* 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);
+}
+
+
/* 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 = p_get_proto_data(pinfo->fd, proto_tcp);
-
if( !tcppd ) {
tcppd = se_alloc(sizeof(struct tcp_per_packet_data_t));
p_add_proto_data(pinfo->fd, proto_tcp, tcppd);
}
-
+
+ if (!tcpd)
+ return;
+
nstime_delta(&tcppd->ts_del, &pinfo->fd->abs_ts, &tcpd->ts_prev);
-
+
tcpd->ts_prev.secs=pinfo->fd->abs_ts.secs;
tcpd->ts_prev.nsecs=pinfo->fd->abs_ts.nsecs;
}
proto_item *item;
proto_tree *tree;
nstime_t ts;
-
+
+ if (!tcpd)
+ return;
+
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);
item = proto_tree_add_time(tree, hf_tcp_ts_relative, tvb, 0, 0, &ts);
PROTO_ITEM_SET_GENERATED(item);
- if( !tcppd )
+ if( !tcppd )
tcppd = p_get_proto_data(pinfo->fd, proto_tcp);
if( tcppd ) {
* 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.
- * Since this might also match PDUs that are completely within
+ * Since this might also match PDUs that are completely within
* this segment we also verify that the found PDU does span
* beyond the end of this segment.
*/
static void
pdu_store_window_scale_option(guint8 ws, struct tcp_analysis *tcpd)
{
- tcpd->fwd->win_scale=ws;
+ if (tcpd)
+ tcpd->fwd->win_scale=ws;
}
static void
tcp_get_relative_seq_ack(guint32 *seq, guint32 *ack, guint32 *win, struct tcp_analysis *tcpd)
{
- if(tcp_relative_seq){
+ if (tcpd && tcp_relative_seq) {
(*seq) -= tcpd->fwd->base_seq;
(*ack) -= tcpd->rev->base_seq;
if(tcpd->fwd->win_scale!=-1){
static void
tcp_analyze_get_acked_struct(guint32 frame, gboolean createflag, struct tcp_analysis *tcpd)
{
+ if (!tcpd)
+ return;
+
tcpd->ta=se_tree_lookup32(tcpd->acked_table, frame);
if((!tcpd->ta) && createflag){
- tcpd->ta=se_alloc(sizeof(struct tcp_acked));
- tcpd->ta->frame_acked=0;
- tcpd->ta->ts.secs=0;
- tcpd->ta->ts.nsecs=0;
- tcpd->ta->flags=0;
- tcpd->ta->dupack_num=0;
- tcpd->ta->dupack_frame=0;
+ tcpd->ta=se_alloc0(sizeof(struct tcp_acked));
se_tree_insert32(tcpd->acked_table, frame, (void *)tcpd->ta);
}
}
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
-
+ if (!tcpd) {
+ return;
+ }
/* if this is the first segment for this list we need to store the
* base_seq
*
* Start relative seq and ack numbers at 1 if this
- * is not a SYN packet. This makes the relative
+ * is not a SYN packet. This makes the relative
* seq/ack numbers to be displayed correctly in the
* event that the SYN or SYN/ACK packet is not seen
* (this solves bug 1542)
}
- /* LOST PACKET / REUSED PORTS
+ /* LOST PACKET
* If this segment is beyond the last seen nextseq we must
* have missed some previous segment
*
* We only check for this if we have actually seen segments prior to this
* one.
* RST packets are not checked for this.
- *
- * If the packet is a SYN, then it's not a lost packet, then the tcp ports
- * are reused. This is seen often in load-balanced environments where
- * client ports are preserved on the server-side. We only want to report
- * port reusage once, so the SYN/ACK is excluded from analysis.
- *
- * XXX The port reusage routine might better be handled by cleaning up
- * the conversation when a SYN is received and setting the TA_FLAG then.
*/
if( tcpd->fwd->nextseq
&& GT_SEQ(seq, tcpd->fwd->nextseq)
if(!tcpd->ta){
tcp_analyze_get_acked_struct(pinfo->fd->num, TRUE, tcpd);
}
- if ((flags&(TH_SYN|TH_ACK))==TH_SYN)
- tcpd->ta->flags|=TCP_A_REUSED_PORTS;
- else if ((flags&(TH_SYN|TH_ACK))!=(TH_SYN|TH_ACK))
- tcpd->ta->flags|=TCP_A_LOST_PACKET;
+ tcpd->ta->flags|=TCP_A_LOST_PACKET;
}
}
+
finished_fwd:
/* If this was NOT a dupack we must reset the dupack counters */
if( (!tcpd->ta) || !(tcpd->ta->flags&TCP_A_DUPLICATE_ACK) ){
}
ackcount++;
tmpual=tcpd->rev->segments->next;
+
+ if (tcpd->rev->scps_capable) {
+ /* Track largest segment successfully sent for SNACK analysis */
+ if ((ual->nextseq - ual->seq) > tcpd->fwd->maxsizeacked) {
+ tcpd->fwd->maxsizeacked = (ual->nextseq - ual->seq);
+ }
+ }
+
TCP_UNACKED_FREE(ual);
tcpd->rev->segments=tmpual;
}
}
ackcount++;
tmpual=ual->next->next;
+
+ if (tcpd->rev->scps_capable) {
+ /* Track largest segment successfully sent for SNACK analysis*/
+ if ((ual->next->nextseq - ual->next->seq) > tcpd->fwd->maxsizeacked){
+ tcpd->fwd->maxsizeacked = (ual->next->nextseq - ual->next->seq);
+ }
+ }
+
TCP_UNACKED_FREE(ual->next);
ual->next=tmpual;
ual=ual->next;
}
+ /* 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;
+ }
+ }
+
}
-/*
+/*
* Prints results of the sequence number analysis concerning tcp segments
- * retransmitted or out-of-order
- */
-static void
-tcp_sequence_number_analysis_print_retransmission(packet_info * pinfo,
- tvbuff_t * tvb,
- proto_tree * flags_tree,
+ * retransmitted or out-of-order
+ */
+static void
+tcp_sequence_number_analysis_print_retransmission(packet_info * pinfo,
+ tvbuff_t * tvb,
+ proto_tree * flags_tree,
struct tcp_acked *ta
)
{
/* TCP Rentransmission */
if (ta->flags & TCP_A_RETRANSMISSION) {
- flags_item=proto_tree_add_none_format(flags_tree,
- hf_tcp_analysis_retransmission,
- tvb, 0, 0,
+ flags_item=proto_tree_add_none_format(flags_tree,
+ hf_tcp_analysis_retransmission,
+ tvb, 0, 0,
"This frame is a (suspected) "
"retransmission"
);
PROTO_ITEM_SET_GENERATED(flags_item);
- expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_NOTE,
+ expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_NOTE,
"Retransmission (suspected)");
if (check_col(pinfo->cinfo, COL_INFO)) {
}
/* TCP Fast Rentransmission */
if (ta->flags & TCP_A_FAST_RETRANSMISSION) {
- flags_item=proto_tree_add_none_format(flags_tree,
- hf_tcp_analysis_fast_retransmission,
- tvb, 0, 0,
- "This frame is a (suspected) fast"
+ flags_item=proto_tree_add_none_format(flags_tree,
+ hf_tcp_analysis_fast_retransmission,
+ tvb, 0, 0,
+ "This frame is a (suspected) fast"
" retransmission"
);
PROTO_ITEM_SET_GENERATED(flags_item);
- expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_WARN,
+ expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_WARN,
"Fast retransmission (suspected)");
- flags_item=proto_tree_add_none_format(flags_tree,
- hf_tcp_analysis_retransmission,
- tvb, 0, 0,
+ flags_item=proto_tree_add_none_format(flags_tree,
+ hf_tcp_analysis_retransmission,
+ tvb, 0, 0,
"This frame is a (suspected) "
"retransmission"
);
PROTO_ITEM_SET_GENERATED(flags_item);
if (check_col(pinfo->cinfo, COL_INFO)) {
- col_prepend_fence_fstr(pinfo->cinfo, COL_INFO,
+ col_prepend_fence_fstr(pinfo->cinfo, COL_INFO,
"[TCP Fast Retransmission] ");
}
}
/* TCP Out-Of-Order */
if (ta->flags & TCP_A_OUT_OF_ORDER) {
- flags_item=proto_tree_add_none_format(flags_tree,
- hf_tcp_analysis_out_of_order,
- tvb, 0, 0,
+ flags_item=proto_tree_add_none_format(flags_tree,
+ hf_tcp_analysis_out_of_order,
+ tvb, 0, 0,
"This frame is a (suspected) "
"out-of-order segment"
);
PROTO_ITEM_SET_GENERATED(flags_item);
- expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_WARN,
+ expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_WARN,
"Out-Of-Order segment");
if (check_col(pinfo->cinfo, COL_INFO)) {
col_prepend_fence_fstr(pinfo->cinfo, COL_INFO, "[TCP Out-Of-Order] ");
}
}
-/* 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,
+/* 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,
struct tcp_acked *ta
)
{
/* TCP Ports Reused */
if (ta->flags & TCP_A_REUSED_PORTS) {
- flags_item=proto_tree_add_none_format(flags_tree,
- hf_tcp_analysis_reused_ports,
- tvb, 0, 0,
- "A new tcp session is started with the same"
+ flags_item=proto_tree_add_none_format(flags_tree,
+ hf_tcp_analysis_reused_ports,
+ tvb, 0, 0,
+ "A new tcp session is started with the same "
"ports as an earlier session in this trace"
);
PROTO_ITEM_SET_GENERATED(flags_item);
- expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_NOTE,
+ expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_NOTE,
"TCP Port numbers reused for new session");
if(check_col(pinfo->cinfo, COL_INFO)){
- col_prepend_fence_fstr(pinfo->cinfo, COL_INFO,
+ col_prepend_fence_fstr(pinfo->cinfo, COL_INFO,
"[TCP Port numbers reused] ");
}
}
}
-/* 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,
+/* 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,
struct tcp_acked *ta
)
{
/* TCP Lost Segment */
if (ta->flags & TCP_A_LOST_PACKET) {
- flags_item=proto_tree_add_none_format(flags_tree,
- hf_tcp_analysis_lost_packet,
- tvb, 0, 0,
+ flags_item=proto_tree_add_none_format(flags_tree,
+ hf_tcp_analysis_lost_packet,
+ tvb, 0, 0,
"A segment before this frame was "
"lost"
);
PROTO_ITEM_SET_GENERATED(flags_item);
- expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_WARN,
+ expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_WARN,
"Previous segment lost (common at capture start)");
if(check_col(pinfo->cinfo, COL_INFO)){
- col_prepend_fence_fstr(pinfo->cinfo, COL_INFO,
+ col_prepend_fence_fstr(pinfo->cinfo, COL_INFO,
"[TCP Previous segment lost] ");
}
}
/* TCP Ack lost segment */
if (ta->flags & TCP_A_ACK_LOST_PACKET) {
- flags_item=proto_tree_add_none_format(flags_tree,
- hf_tcp_analysis_ack_lost_packet,
- tvb, 0, 0,
+ flags_item=proto_tree_add_none_format(flags_tree,
+ hf_tcp_analysis_ack_lost_packet,
+ tvb, 0, 0,
"This frame ACKs a segment we have "
"not seen (lost?)"
);
PROTO_ITEM_SET_GENERATED(flags_item);
- expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_WARN,
+ expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_WARN,
"ACKed lost segment (common at capture start)");
if(check_col(pinfo->cinfo, COL_INFO)){
- col_prepend_fence_fstr(pinfo->cinfo, COL_INFO,
+ col_prepend_fence_fstr(pinfo->cinfo, COL_INFO,
"[TCP ACKed lost segment] ");
}
}
}
-/* 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,
+/* 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,
struct tcp_acked *ta
)
{
/* TCP Window Update */
if (ta->flags & TCP_A_WINDOW_UPDATE) {
- flags_item=proto_tree_add_none_format(flags_tree,
- hf_tcp_analysis_window_update,
- tvb, 0, 0,
+ flags_item=proto_tree_add_none_format(flags_tree,
+ hf_tcp_analysis_window_update,
+ tvb, 0, 0,
"This is a tcp window update"
);
PROTO_ITEM_SET_GENERATED(flags_item);
- expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_NOTE,
+ expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_CHAT,
"Window update");
if (check_col(pinfo->cinfo, COL_INFO)) {
col_prepend_fence_fstr(pinfo->cinfo, COL_INFO, "[TCP Window Update] ");
}
/* TCP Full Window */
if (ta->flags & TCP_A_WINDOW_FULL) {
- flags_item=proto_tree_add_none_format(flags_tree,
- hf_tcp_analysis_window_full,
- tvb, 0, 0,
+ flags_item=proto_tree_add_none_format(flags_tree,
+ hf_tcp_analysis_window_full,
+ tvb, 0, 0,
"The transmission window is now "
"completely full"
);
PROTO_ITEM_SET_GENERATED(flags_item);
- expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_NOTE,
+ expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_WARN,
"Window is full");
if (check_col(pinfo->cinfo, COL_INFO)) {
col_prepend_fence_fstr(pinfo->cinfo, COL_INFO, "[TCP Window Full] ");
}
}
-/* 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,
+/* 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,
struct tcp_acked *ta
)
{
/*TCP Keep Alive */
if (ta->flags & TCP_A_KEEP_ALIVE){
- flags_item=proto_tree_add_none_format(flags_tree,
- hf_tcp_analysis_keep_alive,
- tvb, 0, 0,
+ flags_item=proto_tree_add_none_format(flags_tree,
+ hf_tcp_analysis_keep_alive,
+ tvb, 0, 0,
"This is a TCP keep-alive segment"
);
PROTO_ITEM_SET_GENERATED(flags_item);
- expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_NOTE,
+ expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_NOTE,
"Keep-Alive");
if (check_col(pinfo->cinfo, COL_INFO)) {
col_prepend_fence_fstr(pinfo->cinfo, COL_INFO, "[TCP Keep-Alive] ");
}
/* TCP Ack Keep Alive */
if (ta->flags & TCP_A_KEEP_ALIVE_ACK) {
- flags_item=proto_tree_add_none_format(flags_tree,
- hf_tcp_analysis_keep_alive_ack,
- tvb, 0, 0,
+ flags_item=proto_tree_add_none_format(flags_tree,
+ hf_tcp_analysis_keep_alive_ack,
+ tvb, 0, 0,
"This is an ACK to a TCP keep-alive "
"segment"
);
PROTO_ITEM_SET_GENERATED(flags_item);
- expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_NOTE,
+ expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_NOTE,
"Keep-Alive ACK");
if (check_col(pinfo->cinfo, COL_INFO)) {
col_prepend_fence_fstr(pinfo->cinfo, COL_INFO, "[TCP Keep-Alive ACK] ");
}
}
-/* 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,
+/* 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,
struct tcp_acked *ta,
proto_tree * tree
)
/* TCP Duplicate ACK */
if (ta->dupack_num) {
if (ta->flags & TCP_A_DUPLICATE_ACK ) {
- flags_item=proto_tree_add_none_format(flags_tree,
- hf_tcp_analysis_duplicate_ack,
- tvb, 0, 0,
+ flags_item=proto_tree_add_none_format(flags_tree,
+ hf_tcp_analysis_duplicate_ack,
+ tvb, 0, 0,
"This is a TCP duplicate ack"
);
PROTO_ITEM_SET_GENERATED(flags_item);
if (check_col(pinfo->cinfo, COL_INFO)) {
- col_prepend_fence_fstr(pinfo->cinfo, COL_INFO,
- "[TCP Dup ACK %u#%u] ",
- ta->dupack_frame,
+ col_prepend_fence_fstr(pinfo->cinfo, COL_INFO,
+ "[TCP Dup ACK %u#%u] ",
+ ta->dupack_frame,
ta->dupack_num
);
}
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);
- expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_NOTE,
+ expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_NOTE,
"Duplicate ACK (#%u)",
ta->dupack_num
);
}
}
-/* 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,
+/* 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,
struct tcp_acked *ta
)
{
proto_item * flags_item;
- /* TCP Zeor Window Probe */
+ /* TCP Zero Window Probe */
if (ta->flags & TCP_A_ZERO_WINDOW_PROBE) {
- flags_item=proto_tree_add_none_format(flags_tree,
- hf_tcp_analysis_zero_window_probe,
- tvb, 0, 0,
+ flags_item=proto_tree_add_none_format(flags_tree,
+ hf_tcp_analysis_zero_window_probe,
+ tvb, 0, 0,
"This is a TCP zero-window-probe"
);
PROTO_ITEM_SET_GENERATED(flags_item);
- expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_NOTE,
+ expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_NOTE,
"Zero window probe");
if (check_col(pinfo->cinfo, COL_INFO)) {
col_prepend_fence_fstr(pinfo->cinfo, COL_INFO, "[TCP ZeroWindowProbe] ");
}
/* TCP Zero Window */
if (ta->flags&TCP_A_ZERO_WINDOW) {
- flags_item=proto_tree_add_none_format(flags_tree,
- hf_tcp_analysis_zero_window,
- tvb, 0, 0,
+ flags_item=proto_tree_add_none_format(flags_tree,
+ hf_tcp_analysis_zero_window,
+ tvb, 0, 0,
"This is a ZeroWindow segment"
);
PROTO_ITEM_SET_GENERATED(flags_item);
- expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_NOTE,
+ expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_WARN,
"Zero window");
if (check_col(pinfo->cinfo, COL_INFO)) {
col_prepend_fence_fstr(pinfo->cinfo, COL_INFO, "[TCP ZeroWindow] ");
}
/* TCP Zero Window Probe Ack */
if (ta->flags & TCP_A_ZERO_WINDOW_PROBE_ACK) {
- flags_item=proto_tree_add_none_format(flags_tree,
- hf_tcp_analysis_zero_window_probe_ack,
- tvb, 0, 0,
+ flags_item=proto_tree_add_none_format(flags_tree,
+ hf_tcp_analysis_zero_window_probe_ack,
+ tvb, 0, 0,
"This is an ACK to a TCP zero-window-probe"
);
PROTO_ITEM_SET_GENERATED(flags_item);
- expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_NOTE,
+ expert_add_info_format(pinfo, flags_item, PI_SEQUENCE, PI_NOTE,
"Zero window probe ACK");
if (check_col(pinfo->cinfo, COL_INFO)) {
- col_prepend_fence_fstr(pinfo->cinfo, COL_INFO,
+ col_prepend_fence_fstr(pinfo->cinfo, COL_INFO,
"[TCP ZeroWindowProbeAck] ");
}
}
}
+/* 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);
+ }
+}
+
static void
tcp_print_sequence_number_analysis(packet_info *pinfo, tvbuff_t *tvb, proto_tree *parent_tree, struct tcp_analysis *tcpd)
{
- struct tcp_acked *ta;
+ struct tcp_acked *ta = NULL;
proto_item *item;
proto_tree *tree;
proto_tree *flags_tree=NULL;
-
+
+ if (!tcpd) {
+ return;
+ }
if(!tcpd->ta){
tcp_analyze_get_acked_struct(pinfo->fd->num, FALSE, tcpd);
}
}
}
+ 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);
+ }
+
if(ta->flags){
- item = proto_tree_add_item(tree, hf_tcp_analysis_flags, tvb, 0, -1, FALSE);
+ item = proto_tree_add_item(tree, hf_tcp_analysis_flags, tvb, 0, 0, FALSE);
PROTO_ITEM_SET_GENERATED(item);
flags_tree=proto_item_add_subtree(item, ett_tcp_analysis);
/* print results for tcp zero window */
tcp_sequence_number_analysis_print_zero_window(pinfo, tvb, flags_tree, ta);
+
}
}
+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);
+ }
+}
/* **************************************************************************
* End of tcp sequence number analysis
/* Minimum TCP header length. */
-#define TCPH_MIN_LEN 20
+#define TCPH_MIN_LEN 20
/*
* TCP option
*/
-#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 */
+#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 */
#define TCPOPT_SACK_PERM 4 /* SACK Permitted */
#define TCPOPT_SACK 5 /* SACK Block */
#define TCPOPT_ECHO 6
#define TCPOPT_ECHOREPLY 7
-#define TCPOPT_TIMESTAMP 8 /* Better RTT estimations/PAWS */
+#define TCPOPT_TIMESTAMP 8 /* Better RTT estimations/PAWS */
#define TCPOPT_CC 11
#define TCPOPT_CCNEW 12
#define TCPOPT_CCECHO 13
#define TCPOPT_MD5 19 /* RFC2385 */
+#define TCPOPT_SCPS 20 /* SCPS Capabilities */
+#define TCPOPT_SNACK 21 /* SCPS SNACK */
+#define TCPOPT_RECBOUND 22 /* SCPS Record Boundary */
+#define TCPOPT_CORREXP 23 /* SCPS Corruption Experienced */
#define TCPOPT_QS 27 /* RFC4782 */
/*
#define TCPOLEN_CCNEW 6
#define TCPOLEN_CCECHO 6
#define TCPOLEN_MD5 18
+#define TCPOLEN_SCPS 4
+#define TCPOLEN_SNACK 6
+#define TCPOLEN_RECBOUND 2
+#define TCPOLEN_CORREXP 2
#define TCPOLEN_QS 8
{
struct tcpinfo *tcpinfo = pinfo->private_data;
fragment_data *ipfd_head;
+ int last_fragment_len;
gboolean must_desegment;
gboolean called_dissector;
int another_pdu_follows;
guint32 deseg_seq;
gint nbytes;
proto_item *item;
- proto_item *frag_tree_item;
- proto_item *tcp_tree_item;
- struct tcp_multisegment_pdu *msp;
+ struct tcp_multisegment_pdu *msp;
again:
ipfd_head=NULL;
+ last_fragment_len=0;
must_desegment = FALSE;
called_dissector = FALSE;
another_pdu_follows = 0;
deseg_offset = offset;
/* find the most previous PDU starting before this sequence number */
- msp=se_tree_lookup32_le(tcpd->fwd->multisegment_pdus, seq-1);
+ if (tcpd) {
+ msp = se_tree_lookup32_le(tcpd->fwd->multisegment_pdus, seq-1);
+ }
if(msp && msp->seq<=seq && msp->nxtpdu>seq){
int len;
} else {
len=MIN(nxtseq, msp->nxtpdu) - seq;
}
+ last_fragment_len = len;
ipfd_head = fragment_add(tvb, offset, pinfo, msp->first_frame,
tcp_fragment_table,
int old_len;
/* create a new TVB structure for desegmented data */
- next_tvb = tvb_new_real_data(ipfd_head->data,
+ next_tvb = tvb_new_child_real_data(tvb, ipfd_head->data,
ipfd_head->datalen, ipfd_head->datalen);
- /* add this tvb as a child to the original one */
- tvb_set_child_real_data_tvbuff(tvb, next_tvb);
/* add desegmented data to the data source list */
add_new_data_source(pinfo, next_tvb, "Reassembled TCP");
* desegmented, or does it think we need even more
* data?
*/
- old_len=(int)(tvb_reported_length(next_tvb)-tvb_reported_length_remaining(tvb, offset));
+ old_len=(int)(tvb_reported_length(next_tvb)-last_fragment_len);
if(pinfo->desegment_len &&
pinfo->desegment_offset<=old_len){
/*
*/
if(pinfo->desegment_len==DESEGMENT_ONE_MORE_SEGMENT){
/* We want reassembly of at least one
- * more segment so set the nxtpdu
- * boundary to one byte into the next
+ * more segment so set the nxtpdu
+ * boundary to one byte into the next
* segment.
- * This means that the next segment
+ * This means that the next segment
* 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 {
- msp->nxtpdu=seq+tvb_reported_length_remaining(tvb, offset) + pinfo->desegment_len;
+ msp->nxtpdu=seq + last_fragment_len + pinfo->desegment_len;
}
/* Since we need at least some more data
* there can be no pdu following in the
* tail of this segment.
*/
another_pdu_follows=0;
+ offset += last_fragment_len;
+ seq += last_fragment_len;
+ if (tvb_length_remaining(tvb, offset) > 0)
+ goto again;
} else {
/*
* Show the stuff in this TCP segment as
* just raw TCP segment data.
*/
- nbytes =
- tvb_reported_length_remaining(tvb, offset);
- proto_tree_add_text(tcp_tree, tvb, offset, -1,
+ nbytes = another_pdu_follows > 0
+ ? another_pdu_follows
+ : tvb_reported_length_remaining(tvb, offset);
+ proto_tree_add_text(tcp_tree, tvb, offset, nbytes,
"TCP segment data (%u byte%s)", nbytes,
plurality(nbytes, "", "s"));
- /*
- * 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);
- }
+ print_tcp_fragment_tree(ipfd_head, tree, tcp_tree, pinfo, next_tvb);
/* Did the subdissector ask us to desegment
some more data? This means that the data
* reassembled PDUs later down in dissect_tcp() when checking
* for the FIN flag.
*/
- if(pinfo->desegment_len==DESEGMENT_UNTIL_FIN){
+ if(tcpd && pinfo->desegment_len==DESEGMENT_UNTIL_FIN) {
tcpd->fwd->flags|=TCP_FLOW_REASSEMBLE_UNTIL_FIN;
}
/*
*/
deseg_seq = seq + (deseg_offset - offset);
- if( ((nxtseq - deseg_seq) <= 1024*1024)
+ if(tcpd && ((nxtseq - deseg_seq) <= 1024*1024)
&& (!pinfo->fd->flags.visited) ){
if(pinfo->desegment_len==DESEGMENT_ONE_MORE_SEGMENT){
/* The subdissector asked to reassemble using the
* but set this msp flag so we can pick it up
* above.
*/
- msp = pdu_store_sequencenumber_of_next_pdu(pinfo,
+ msp = pdu_store_sequencenumber_of_next_pdu(pinfo,
deseg_seq, nxtseq+1, tcpd->fwd->multisegment_pdus);
msp->flags|=MSP_FLAGS_REASSEMBLE_ENTIRE_SEGMENT;
} else {
- msp = pdu_store_sequencenumber_of_next_pdu(pinfo,
+ msp = pdu_store_sequencenumber_of_next_pdu(pinfo,
deseg_seq, nxtseq+pinfo->desegment_len, tcpd->fwd->multisegment_pdus);
}
* of the payload, and that's 0).
* Just mark this as TCP.
*/
- if (check_col(pinfo->cinfo, COL_PROTOCOL)){
- col_set_str(pinfo->cinfo, COL_PROTOCOL, "TCP");
- }
- if (check_col(pinfo->cinfo, COL_INFO)){
- col_set_str(pinfo->cinfo, COL_INFO, "[TCP segment of a reassembled PDU]");
- }
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "TCP");
+ col_set_str(pinfo->cinfo, COL_INFO, "[TCP segment of a reassembled PDU]");
}
/*
if(another_pdu_follows){
/* there was another pdu following this one. */
pinfo->can_desegment=2;
- /* we also have to prevent the dissector from changing the
- * PROTOCOL and INFO colums since what follows may be an
+ /* we also have to prevent the dissector from changing the
+ * PROTOCOL and INFO colums since what follows may be an
* 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
* need, and return.
*/
pinfo->desegment_offset = offset;
- pinfo->desegment_len = fixed_len - length_remaining;
+ pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT;
return;
}
}
plen = (*get_pdu_len)(pinfo, tvb, offset);
if (plen < fixed_len) {
/*
- * The PDU length from the fixed-length portion probably didn't
- * include the fixed-length portion's length, and was probably so
- * large that the total length overflowed.
+ * Either:
+ *
+ * 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;
*
- * Report this as an error.
+ * 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.
*/
show_reported_bounds_error(tvb, pinfo, tree);
return;
}
/*
- * Display the PDU length as a field
- */
- item=proto_tree_add_uint(pinfo->tcp_tree, hf_tcp_pdu_size, tvb, 0, 0, plen);
+ * Display the PDU length as a field
+ */
+ item=proto_tree_add_uint(pinfo->tcp_tree, hf_tcp_pdu_size, tvb, offset, plen, plen);
PROTO_ITEM_SET_GENERATED(item);
-
+
/* give a hint to TCP where the next PDU starts
*/
length = length_remaining;
if (length > plen)
- length = plen;
+ length = plen;
next_tvb = tvb_new_subset(tvb, offset, length, plen);
/*
col_append_fstr(pinfo->cinfo, COL_INFO, " %s=%u", abbrev, val);
}
+/* 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)
+{
+ if (check_col(pinfo->cinfo, COL_INFO))
+ col_append_fstr(pinfo->cinfo, COL_INFO, " %s[%s]", abbrev, val);
+}
+
static void
dissect_tcpopt_maxseg(const ip_tcp_opt *optp, tvbuff_t *tvb,
int offset, guint optlen, packet_info *pinfo, proto_tree *opt_tree)
{
+ proto_item *hidden_item;
guint16 mss;
mss = tvb_get_ntohs(tvb, offset + 2);
- proto_tree_add_boolean_hidden(opt_tree, hf_tcp_option_mss, tvb, offset,
+ hidden_item = proto_tree_add_boolean(opt_tree, hf_tcp_option_mss, tvb, offset,
optlen, TRUE);
+ PROTO_ITEM_SET_HIDDEN(hidden_item);
proto_tree_add_uint_format(opt_tree, hf_tcp_option_mss_val, tvb, offset,
optlen, mss, "%s: %u bytes", optp->name, mss);
tcp_info_append_uint(pinfo, "MSS", mss);
dissect_tcpopt_wscale(const ip_tcp_opt *optp, tvbuff_t *tvb,
int offset, guint optlen, packet_info *pinfo, proto_tree *opt_tree)
{
+ proto_item *hidden_item;
guint8 ws;
struct tcp_analysis *tcpd=NULL;
- tcpd=get_tcp_conversation_data(pinfo);
+ tcpd=get_tcp_conversation_data(NULL,pinfo);
ws = tvb_get_guint8(tvb, offset + 2);
- proto_tree_add_boolean_hidden(opt_tree, hf_tcp_option_wscale, tvb,
+ hidden_item = proto_tree_add_boolean(opt_tree, hf_tcp_option_wscale, tvb,
offset, optlen, TRUE);
+ PROTO_ITEM_SET_HIDDEN(hidden_item);
proto_tree_add_uint_format(opt_tree, hf_tcp_option_wscale_val, tvb,
offset, optlen, ws, "%s: %u (multiply by %u)",
optp->name, ws, 1 << ws);
{
proto_tree *field_tree = NULL;
proto_item *tf=NULL;
+ proto_item *hidden_item;
guint32 leftedge, rightedge;
struct tcp_analysis *tcpd=NULL;
guint32 base_ack=0;
if(tcp_analyze_seq && tcp_relative_seq){
/* find(or create if needed) the conversation for this tcp session */
- tcpd=get_tcp_conversation_data(pinfo);
+ tcpd=get_tcp_conversation_data(NULL,pinfo);
- base_ack=tcpd->rev->base_seq;
+ if (tcpd) {
+ base_ack=tcpd->rev->base_seq;
+ }
}
tf = proto_tree_add_text(opt_tree, tvb, offset, optlen, "%s:", optp->name);
if (field_tree == NULL) {
/* Haven't yet made a subtree out of this option. Do so. */
field_tree = proto_item_add_subtree(tf, *optp->subtree_index);
- proto_tree_add_boolean_hidden(field_tree, hf_tcp_option_sack, tvb,
+ hidden_item = proto_tree_add_boolean(field_tree, hf_tcp_option_sack, tvb,
offset, optlen, TRUE);
+ PROTO_ITEM_SET_HIDDEN(hidden_item);
}
if (optlen < 4) {
proto_tree_add_text(field_tree, tvb, offset, optlen,
dissect_tcpopt_echo(const ip_tcp_opt *optp, tvbuff_t *tvb,
int offset, guint optlen, packet_info *pinfo, proto_tree *opt_tree)
{
+ proto_item *hidden_item;
guint32 echo;
echo = tvb_get_ntohl(tvb, offset + 2);
- proto_tree_add_boolean_hidden(opt_tree, hf_tcp_option_echo, tvb, offset,
+ hidden_item = proto_tree_add_boolean(opt_tree, hf_tcp_option_echo, tvb, offset,
optlen, TRUE);
+ PROTO_ITEM_SET_HIDDEN(hidden_item);
proto_tree_add_text(opt_tree, tvb, offset, optlen,
"%s: %u", optp->name, echo);
tcp_info_append_uint(pinfo, "ECHO", echo);
dissect_tcpopt_timestamp(const ip_tcp_opt *optp, tvbuff_t *tvb,
int offset, guint optlen, packet_info *pinfo, proto_tree *opt_tree)
{
+ proto_item *hidden_item;
guint32 tsv, tser;
tsv = tvb_get_ntohl(tvb, offset + 2);
tser = tvb_get_ntohl(tvb, offset + 6);
- proto_tree_add_boolean_hidden(opt_tree, hf_tcp_option_time_stamp, tvb,
+ hidden_item = proto_tree_add_boolean(opt_tree, hf_tcp_option_time_stamp, tvb,
offset, optlen, TRUE);
+ PROTO_ITEM_SET_HIDDEN(hidden_item);
proto_tree_add_text(opt_tree, tvb, offset, optlen,
"%s: TSval %u, TSecr %u", optp->name, tsv, tser);
tcp_info_append_uint(pinfo, "TSV", tsv);
dissect_tcpopt_cc(const ip_tcp_opt *optp, tvbuff_t *tvb,
int offset, guint optlen, packet_info *pinfo, proto_tree *opt_tree)
{
+ proto_item *hidden_item;
guint32 cc;
cc = tvb_get_ntohl(tvb, offset + 2);
- proto_tree_add_boolean_hidden(opt_tree, hf_tcp_option_cc, tvb, offset,
+ hidden_item = proto_tree_add_boolean(opt_tree, hf_tcp_option_cc, tvb, offset,
optlen, TRUE);
+ PROTO_ITEM_SET_HIDDEN(hidden_item);
proto_tree_add_text(opt_tree, tvb, offset, optlen,
"%s: %u", optp->name, cc);
tcp_info_append_uint(pinfo, "CC", cc);
{ 4, "640 kbit/s"},
{ 5, "1.28 Mbit/s"},
{ 6, "2.56 Mbit/s"},
- { 7, "5.12 Mbit/s"},
+ { 7, "5.12 Mbit/s"},
{ 8, "10.24 Mbit/s"},
{ 9, "20.48 Mbit/s"},
{10, "40.96 Mbit/s"},
{15, "1.31072 Gbit/s"},
{0, NULL}
};
+ proto_item *hidden_item;
guint8 rate = tvb_get_guint8(tvb, offset + 2) & 0x0f;
- proto_tree_add_boolean_hidden(opt_tree, hf_tcp_option_qs, tvb, offset,
+ hidden_item = proto_tree_add_boolean(opt_tree, hf_tcp_option_qs, tvb, offset,
optlen, TRUE);
+ PROTO_ITEM_SET_HIDDEN(hidden_item);
proto_tree_add_text(opt_tree, tvb, offset, optlen,
- "%s: Rate response, %s, TTL diff %u ", optp->name,
- val_to_str(rate, qs_rates, "Unknown"),
+ "%s: Rate response, %s, TTL diff %u ", optp->name,
+ val_to_str(rate, qs_rates, "Unknown"),
tvb_get_guint8(tvb, offset + 3));
if (check_col(pinfo->cinfo, COL_INFO))
col_append_fstr(pinfo->cinfo, COL_INFO, " QSresp=%s", val_to_str(rate, qs_rates, "Unknown"));
}
+
+static void
+dissect_tcpopt_scps(const ip_tcp_opt *optp, tvbuff_t *tvb,
+ int offset, guint optlen, packet_info *pinfo,
+ proto_tree *opt_tree)
+{
+ struct tcp_analysis *tcpd=NULL;
+ proto_tree *field_tree = NULL;
+ tcp_flow_t *flow;
+ int direction;
+ proto_item *tf = NULL, *hidden_item;
+ gchar flags[64] = "<None>";
+ gchar *fstr[] = {"BETS", "SNACK1", "SNACK2", "COMP", "NLTS", "RESV1", "RESV2", "RESV3"};
+ gint i, bpos;
+ guint8 capvector;
+ guint8 connid;
+
+ tcpd = get_tcp_conversation_data(NULL,pinfo);
+
+ /* 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) {
+ direction= (pinfo->srcport > pinfo->destport) ? 1 : -1;
+ }
+
+ if(direction>=0)
+ flow =&(tcpd->flow1);
+ else
+ flow =&(tcpd->flow2);
+
+ /* If the option length == 4, this is a real SCPS capability option
+ * 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);
+ flags[0] = '\0';
+
+ /* Decode the capabilities vector for display */
+ for (i = 0; i < 5; i++) {
+ bpos = 128 >> i;
+ if (capvector & bpos) {
+ if (flags[0]) {
+ g_strlcat(flags, ", ", 64);
+ }
+ g_strlcat(flags, fstr[i], 64);
+ }
+ }
+
+ /* 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);
+ hidden_item = proto_tree_add_boolean(opt_tree, hf_tcp_option_scps,
+ tvb, offset, optlen, TRUE);
+ PROTO_ITEM_SET_HIDDEN(hidden_item);
+
+ 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) {
+ proto_item *hidden_item;
+
+ /* 1st octet is Extended Capability Binding Space */
+ binding_space = tvb_get_guint8(tvb, (offset + local_offset));
+
+ /* 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
+ */
+
+ extended_cap_length =
+ (tvb_get_guint8(tvb, (offset + local_offset + 1)) >> 4);
+
+ /* Convert the extended capabilities length into bytes for display */
+ extended_cap_length = (extended_cap_length << 1);
+
+ 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);
+
+ PROTO_ITEM_SET_HIDDEN(hidden_item);
+
+ /* Step past the binding space and length octets */
+ local_offset += 2;
+
+ proto_tree_add_text(field_tree, tvb, offset + local_offset,
+ extended_cap_length,
+ "\tBinding Space Data (%u bytes)",
+ extended_cap_length);
+
+ tcp_info_append_uint(pinfo, "EXCAP", binding_space);
+
+ /* 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;
+ }
+ }
+ }
+}
+
+/* This is called for SYN+ACK packets and the purpose is to verify that
+ * the SCPS capabilities option has been successfully negotiated for the flow.
+ * If the SCPS capabilities option was offered by only one party, the
+ * 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,
+ int offset, guint optlen, packet_info *pinfo,
+ 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;
+ char null_modifier[] = "\0";
+ char relative_modifier[] = "(relative)";
+ char *modifier = null_modifier;
+ proto_item *hidden_item;
+
+ tcpd = get_tcp_conversation_data(NULL,pinfo);
+
+ /* 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);
+
+ hidden_item = proto_tree_add_boolean(opt_tree, hf_tcp_option_snack, tvb,
+ offset, optlen, TRUE);
+ PROTO_ITEM_SET_HIDDEN(hidden_item);
+
+ 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);
+
+ if (tcp_relative_seq) {
+ ack -= tcpd->rev->base_seq;
+ modifier = relative_modifier;
+ }
+
+ /* 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) {
+ proto_item *hidden_item;
+ /* 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);
+ }
+}
+
static const ip_tcp_opt tcpopts[] = {
{
TCPOPT_EOL,
TCPOLEN_MD5,
NULL
},
+ {
+ TCPOPT_SCPS,
+ "SCPS capabilities",
+ &ett_tcp_option_scps,
+ VARIABLE_LENGTH,
+ TCPOLEN_SCPS,
+ dissect_tcpopt_scps
+ },
+ {
+ TCPOPT_SNACK,
+ "Selective Negative Acknowledgement",
+ NULL,
+ FIXED_LENGTH,
+ TCPOLEN_SNACK,
+ dissect_tcpopt_snack
+ },
+ {
+ TCPOPT_RECBOUND,
+ "SCPS record boundary",
+ NULL,
+ FIXED_LENGTH,
+ TCPOLEN_RECBOUND,
+ NULL
+ },
+ {
+ TCPOPT_CORREXP,
+ "SCPS corruption experienced",
+ NULL,
+ FIXED_LENGTH,
+ TCPOLEN_CORREXP,
+ NULL
+ },
{
TCPOPT_QS,
"Quick-Start",
TRY {
if(is_tcp_segment){
/*qqq see if it is an unaligned PDU */
- if(tcp_analyze_seq && (!tcp_desegment)){
+ if(tcpd && tcp_analyze_seq && (!tcp_desegment)){
if(seq || nxtseq){
offset=scan_for_next_pdu(tvb, tcp_tree, pinfo, offset,
seq, nxtseq, tcpd->fwd->multisegment_pdus);
if(is_tcp_segment){
/* if !visited, check want_pdu_tracking and
store it in table */
- if((!pinfo->fd->flags.visited) &&
+ if(tcpd && (!pinfo->fd->flags.visited) &&
tcp_analyze_seq && pinfo->want_pdu_tracking){
if(seq || nxtseq){
pdu_store_sequencenumber_of_next_pdu(
pinfo,
- seq,
+ seq,
nxtseq+pinfo->bytes_until_next_pdu,
tcpd->fwd->multisegment_pdus);
}
* if !visited, check want_pdu_tracking and store it
* in table
*/
- if((!pinfo->fd->flags.visited) && tcp_analyze_seq && pinfo->want_pdu_tracking){
+ if(tcpd && (!pinfo->fd->flags.visited) && tcp_analyze_seq && pinfo->want_pdu_tracking){
if(seq || nxtseq){
pdu_store_sequencenumber_of_next_pdu(pinfo,
- seq,
+ seq,
nxtseq+pinfo->bytes_until_next_pdu,
tcpd->fwd->multisegment_pdus);
}
guint16 th_sum;
guint16 th_urp;
proto_tree *tcp_tree = NULL, *field_tree = NULL;
- proto_item *ti = NULL, *tf;
+ proto_item *ti = NULL, *tf, *hidden_item;
int offset = 0;
- gchar *flags = "<None>";
- const gchar *fstr[] = {"FIN", "SYN", "RST", "PSH", "ACK", "URG", "ECN", "CWR" };
- size_t fpos = 0, returned_length;
+ emem_strbuf_t *flags_strbuf = ep_strbuf_new_label("<None>");
+ const gchar *fstr[] = {"FIN", "SYN", "RST", "PSH", "ACK", "URG", "ECN", "CWR"};
gint i;
guint bpos;
guint optlen;
struct tcpinfo tcpinfo;
struct tcpheader *tcph;
proto_item *tf_syn = NULL, *tf_fin = NULL, *tf_rst = NULL;
+ conversation_t *conv=NULL;
struct tcp_analysis *tcpd=NULL;
struct tcp_per_packet_data_t *tcppd=NULL;
proto_item *item;
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);
- if (check_col(pinfo->cinfo, COL_PROTOCOL))
- col_set_str(pinfo->cinfo, COL_PROTOCOL, "TCP");
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "TCP");
/* Clear out the Info column. */
- if (check_col(pinfo->cinfo, COL_INFO))
- col_clear(pinfo->cinfo, COL_INFO);
+ col_clear(pinfo->cinfo, COL_INFO);
tcph->th_sport = tvb_get_ntohs(tvb, offset);
tcph->th_dport = tvb_get_ntohs(tvb, offset + 2);
"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);
- proto_tree_add_uint_hidden(tcp_tree, hf_tcp_port, tvb, offset, 2, tcph->th_sport);
- proto_tree_add_uint_hidden(tcp_tree, hf_tcp_port, tvb, offset + 2, 2, tcph->th_dport);
+ 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);
/* 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
* numbers in via the regular code path.
*/
if (pinfo->layer_names != NULL && pinfo->layer_names->str != NULL) {
- /* use strstr because g_strrstr is only present in glib2.0 and
+ /* use strstr because g_strrstr is only present in glib2.0 and
* g_str_has_suffix in glib2.2
*/
if (strstr(pinfo->layer_names->str, "icmp:ip") != NULL)
- proto_tree_add_item(tcp_tree, hf_tcp_seq, tvb, offset + 4, 4, FALSE);
+ proto_tree_add_item(tcp_tree, hf_tcp_seq, tvb, offset + 4, 4, FALSE);
}
}
tcph->th_hlen = hi_nibble(th_off_x2) * 4; /* TCP header length, in bytes */
/* find(or create if needed) the conversation for this tcp session */
- tcpd=get_tcp_conversation_data(pinfo);
+ conv=get_tcp_conversation(pinfo);
+ tcpd=get_tcp_conversation_data(conv,pinfo);
+
+ item = proto_tree_add_uint(tcp_tree, hf_tcp_stream, tvb, offset, 0, conv->index);
+ PROTO_ITEM_SET_GENERATED(item);
+
+ /* 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.
+ */
+ if(tcpd && ((tcph->th_flags&(TH_SYN|TH_ACK))==TH_SYN) &&
+ (tcpd->fwd->base_seq!=0) &&
+ (tcph->th_seq!=tcpd->fwd->base_seq) ) {
+ 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);
+ }
+ if(!tcpd->ta)
+ tcp_analyze_get_acked_struct(pinfo->fd->num, TRUE, tcpd);
+ tcpd->ta->flags|=TCP_A_REUSED_PORTS;
+ }
+
/* Do we need to calculate timestamps relative to the tcp-stream? */
if (tcp_calculate_ts) {
+ tcppd = p_get_proto_data(pinfo->fd, proto_tcp);
/*
* Calculate the timestamps relative to this conversation (but only on the
if (!(pinfo->fd->flags.visited))
tcp_calculate_timestamps(pinfo, tcpd, tcppd);
-
/* Fill the conversation timestamp columns */
- if (check_col(pinfo->cinfo, COL_REL_CONV_TIME)) {
+ if (tcpd && check_col(pinfo->cinfo, COL_REL_CONV_TIME)) {
nstime_delta(&ts, &pinfo->fd->abs_ts, &tcpd->ts_first);
col_set_time(pinfo->cinfo, COL_REL_CONV_TIME, &ts, "tcp.time_relative");
}
if (check_col(pinfo->cinfo, COL_DELTA_CONV_TIME)) {
- if( !tcppd )
- tcppd = p_get_proto_data(pinfo->fd, proto_tcp);
-
- if( tcppd )
+ if( tcppd )
col_set_time(pinfo->cinfo, COL_DELTA_CONV_TIME, &tcppd->ts_del, "tcp.time_delta");
}
}
if (tree) { /* Add the seglen as an invisible field */
- proto_tree_add_uint_hidden(ti, hf_tcp_len, tvb, offset, 4, tcph->th_seglen);
+ hidden_item = proto_tree_add_uint(ti, hf_tcp_len, tvb, offset+12, 1, tcph->th_seglen);
+ PROTO_ITEM_SET_HIDDEN(hidden_item);
}
-
+
/* handle TCP seq# analysis parse all new segments we see */
if(tcp_analyze_seq){
if(!(pinfo->fd->flags.visited)){
tcph->th_have_seglen = FALSE;
if (check_col(pinfo->cinfo, COL_INFO) || tree) {
-#define MAX_FLAGS_LEN 64
- flags=ep_alloc(MAX_FLAGS_LEN);
- flags[0]=0;
+ gboolean first_flag = TRUE;
for (i = 0; i < 8; i++) {
bpos = 1 << i;
if (tcph->th_flags & bpos) {
- returned_length = g_snprintf(&flags[fpos], MAX_FLAGS_LEN-fpos, "%s%s",
- fpos?", ":"",
- fstr[i]);
- fpos += MIN(returned_length, MAX_FLAGS_LEN-fpos);
+ if (first_flag) {
+ ep_strbuf_truncate(flags_strbuf, 0);
+ }
+ ep_strbuf_append_printf(flags_strbuf, "%s%s", first_flag ? "" : ", ", fstr[i]);
+ first_flag = FALSE;
}
}
}
if (check_col(pinfo->cinfo, COL_INFO)) {
- col_append_fstr(pinfo->cinfo, COL_INFO, " [%s] Seq=%u", flags, tcph->th_seq);
+ 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);
}
} else {
/* Verify that the ACK field is zero */
if(tvb_get_ntohl(tvb, offset+8) != 0){
- proto_tree_add_text(tcp_tree, tvb, offset+8, 4,"Acknowledgment number: Broken TCP. The acknowledge field is nonzero while the ACK flag is not set");
+ 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");
}
}
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);
tf = proto_tree_add_uint_format(tcp_tree, hf_tcp_flags, tvb, offset + 13, 1,
- tcph->th_flags, "Flags: 0x%02x (%s)", tcph->th_flags, flags);
+ tcph->th_flags, "Flags: 0x%02x (%s)", tcph->th_flags, flags_strbuf->str);
field_tree = proto_item_add_subtree(tf, ett_tcp_flags);
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);
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);
- if(tcp_relative_seq
- && (tcph->th_win!=real_window)
+ if(tcp_relative_seq
+ && (tcph->th_win!=real_window)
&& !(tcph->th_flags&TH_SYN) ){ /* SYNs are never scaled */
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 {
after the segment. */
tcpinfo.seq = tcph->th_seq;
tcpinfo.nxtseq = nxtseq;
+ tcpinfo.lastackseq = tcph->th_ack;
/* Assume we'll pass un-reassembled data to subdissectors. */
tcpinfo.is_reassembled = FALSE;
cksum_vec[0].len = pinfo->src.len;
cksum_vec[1].ptr = pinfo->dst.data;
cksum_vec[1].len = pinfo->dst.len;
- cksum_vec[2].ptr = (const guint8 *)&phdr;
+ cksum_vec[2].ptr = (const guint8 *)phdr;
switch (pinfo->src.type) {
case AT_IPv4:
}
cksum_vec[3].ptr = tvb_get_ptr(tvb, offset, reported_len);
cksum_vec[3].len = reported_len;
- computed_cksum = in_cksum(&cksum_vec[0], 4);
+ computed_cksum = in_cksum(cksum_vec, 4);
if (computed_cksum == 0 && th_sum == 0xffff) {
item = proto_tree_add_uint_format(tcp_tree, hf_tcp_checksum, tvb,
offset + 16, 2, th_sum,
expert_add_info_format(pinfo, item, PI_CHECKSUM, PI_WARN, "TCP Checksum 0xffff instead of 0x0000 (see RFC 1624)");
if (check_col(pinfo->cinfo, COL_INFO))
- col_append_fstr(pinfo->cinfo, COL_INFO, " [TCP CHECKSUM 0xFFFF]");
+ col_append_str(pinfo->cinfo, COL_INFO, " [TCP CHECKSUM 0xFFFF]");
/* Checksum is treated as valid on most systems, so we're willing to desegment it. */
desegment_ok = TRUE;
expert_add_info_format(pinfo, item, PI_CHECKSUM, PI_ERROR, "Bad checksum");
if (check_col(pinfo->cinfo, COL_INFO))
- col_append_fstr(pinfo->cinfo, COL_INFO, " [TCP CHECKSUM INCORRECT]");
+ col_append_str(pinfo->cinfo, COL_INFO, " [TCP CHECKSUM INCORRECT]");
/* Checksum is invalid, so we're not willing to desegment it. */
desegment_ok = FALSE;
if (tcp_desegment) {
/* Yes - is this segment being returned in an error packet? */
if (!pinfo->in_error_pkt) {
- /* 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;
+ /* 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;
}
}
}
tvb_ensure_bytes_exist(tvb, offset + 20, optlen);
if (tcp_tree != NULL) {
guint8 *p_options = ep_tvb_memdup(tvb, offset + 20, optlen);
- tf = proto_tree_add_bytes_format(tcp_tree, hf_tcp_options, tvb, offset + 20,
+ tf = proto_tree_add_bytes_format(tcp_tree, hf_tcp_options, tvb, offset + 20,
optlen, p_options, "Options: (%u bytes)", optlen);
field_tree = proto_item_add_subtree(tf, ett_tcp_options);
} else
tcpopts, N_TCP_OPTS, TCPOPT_EOL, pinfo, field_tree);
}
- /* 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(!pinfo->fd->flags.visited){
- if(tcp_analyze_seq && tcp_relative_seq){
- if((tcph->th_flags & (TH_SYN|TH_ACK))==(TH_SYN|TH_ACK)) {
- verify_tcp_window_scaling(tcpd);
+ 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){
+ verify_tcp_window_scaling(tcpd);
+ }
+ /* 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
+ */
+ if(tcpd && ((tcpd->rev->scps_capable) || (tcpd->fwd->scps_capable))) {
+ verify_scps(pinfo, tf_syn, tcpd);
}
}
}
if (tcph->th_have_seglen) {
if( data_out_file ) {
- reassemble_tcp( tcph->th_seq, /* sequence number */
- tcph->th_seglen, /* data length */
+ reassemble_tcp( tcph->th_seq, /* sequence number */
+ tcph->th_ack, /* acknowledgement number */
+ tcph->th_seglen, /* data length */
(gchar*)tvb_get_ptr(tvb, offset, length_remaining), /* data */
- length_remaining, /* captured data length */
- ( tcph->th_flags & TH_SYN ), /* is syn set? */
+ length_remaining, /* captured data length */
+ ( tcph->th_flags & TH_SYN ), /* is syn set? */
&pinfo->net_src,
&pinfo->net_dst,
pinfo->srcport,
if(tcp_analyze_seq){
tcp_print_sequence_number_analysis(pinfo, tvb, tcp_tree, tcpd);
}
-
+
/* handle conversation timestamps */
if(tcp_calculate_ts){
tcp_print_timestamps(pinfo, tvb, tcp_tree, tcpd, tcppd);
/* A FIN packet might complete reassembly so we need to explicitly
* check for this here.
*/
- if( (tcph->th_flags & TH_FIN)
- && (tcpd->fwd->flags&TCP_FLOW_REASSEMBLE_UNTIL_FIN) ){
+ if(tcpd && (tcph->th_flags & TH_FIN)
+ && (tcpd->fwd->flags&TCP_FLOW_REASSEMBLE_UNTIL_FIN) ){
struct tcp_multisegment_pdu *msp;
/* find the most previous PDU starting before this sequence number */
if(ipfd_head){
tvbuff_t *next_tvb;
- /* create a new TVB structure for desegmented data */
- next_tvb = tvb_new_real_data(ipfd_head->data, ipfd_head->datalen, ipfd_head->datalen);
-
- /* add this tvb as a child to the original one */
- tvb_set_child_real_data_tvbuff(tvb, next_tvb);
+ /* 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);
/* add desegmented data to the data source list */
add_new_data_source(pinfo, next_tvb, "Reassembled TCP");
/* call the payload dissector
* but make sure we don't offer desegmentation any more
*/
- pinfo->can_desegment = 0;
+ pinfo->can_desegment = 0;
process_tcp_payload(next_tvb, 0, pinfo, tree, tcp_tree, tcph->th_sport, tcph->th_dport, tcph->th_seq, nxtseq, FALSE, tcpd);
+ print_tcp_fragment_tree(ipfd_head, tree, tcp_tree, pinfo, next_tvb);
+
return;
}
}
}
+ 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);
+ }
+ }
+
/*
* 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
{ &hf_tcp_srcport,
{ "Source Port", "tcp.srcport", FT_UINT16, BASE_DEC, NULL, 0x0,
- "", HFILL }},
+ NULL, HFILL }},
{ &hf_tcp_dstport,
{ "Destination Port", "tcp.dstport", FT_UINT16, BASE_DEC, NULL, 0x0,
- "", HFILL }},
+ NULL, HFILL }},
{ &hf_tcp_port,
{ "Source or Destination Port", "tcp.port", FT_UINT16, BASE_DEC, NULL, 0x0,
- "", HFILL }},
+ NULL, HFILL }},
+
+ { &hf_tcp_stream,
+ { "Stream index", "tcp.stream", FT_UINT32, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }},
{ &hf_tcp_seq,
{ "Sequence number", "tcp.seq", FT_UINT32, BASE_DEC, NULL, 0x0,
- "", HFILL }},
+ NULL, HFILL }},
{ &hf_tcp_nxtseq,
{ "Next sequence number", "tcp.nxtseq", FT_UINT32, BASE_DEC, NULL, 0x0,
- "", HFILL }},
+ NULL, HFILL }},
{ &hf_tcp_ack,
{ "Acknowledgement number", "tcp.ack", FT_UINT32, BASE_DEC, NULL, 0x0,
- "", HFILL }},
+ NULL, HFILL }},
{ &hf_tcp_hdr_len,
{ "Header Length", "tcp.hdr_len", FT_UINT8, BASE_DEC, NULL, 0x0,
- "", HFILL }},
+ NULL, HFILL }},
{ &hf_tcp_flags,
{ "Flags", "tcp.flags", FT_UINT8, BASE_HEX, NULL, 0x0,
- "", HFILL }},
+ NULL, HFILL }},
{ &hf_tcp_flags_cwr,
- { "Congestion Window Reduced (CWR)", "tcp.flags.cwr", FT_BOOLEAN, 8, TFS(&flags_set_truth), TH_CWR,
- "", HFILL }},
+ { "Congestion Window Reduced (CWR)", "tcp.flags.cwr", FT_BOOLEAN, 8, TFS(&tfs_set_notset), TH_CWR,
+ NULL, HFILL }},
{ &hf_tcp_flags_ecn,
- { "ECN-Echo", "tcp.flags.ecn", FT_BOOLEAN, 8, TFS(&flags_set_truth), TH_ECN,
- "", HFILL }},
+ { "ECN-Echo", "tcp.flags.ecn", FT_BOOLEAN, 8, TFS(&tfs_set_notset), TH_ECN,
+ NULL, HFILL }},
{ &hf_tcp_flags_urg,
- { "Urgent", "tcp.flags.urg", FT_BOOLEAN, 8, TFS(&flags_set_truth), TH_URG,
- "", HFILL }},
+ { "Urgent", "tcp.flags.urg", FT_BOOLEAN, 8, TFS(&tfs_set_notset), TH_URG,
+ NULL, HFILL }},
{ &hf_tcp_flags_ack,
- { "Acknowledgment", "tcp.flags.ack", FT_BOOLEAN, 8, TFS(&flags_set_truth), TH_ACK,
- "", HFILL }},
+ { "Acknowledgement", "tcp.flags.ack", FT_BOOLEAN, 8, TFS(&tfs_set_notset), TH_ACK,
+ NULL, HFILL }},
{ &hf_tcp_flags_push,
- { "Push", "tcp.flags.push", FT_BOOLEAN, 8, TFS(&flags_set_truth), TH_PUSH,
- "", HFILL }},
+ { "Push", "tcp.flags.push", FT_BOOLEAN, 8, TFS(&tfs_set_notset), TH_PUSH,
+ NULL, HFILL }},
{ &hf_tcp_flags_reset,
- { "Reset", "tcp.flags.reset", FT_BOOLEAN, 8, TFS(&flags_set_truth), TH_RST,
- "", HFILL }},
+ { "Reset", "tcp.flags.reset", FT_BOOLEAN, 8, TFS(&tfs_set_notset), TH_RST,
+ NULL, HFILL }},
{ &hf_tcp_flags_syn,
- { "Syn", "tcp.flags.syn", FT_BOOLEAN, 8, TFS(&flags_set_truth), TH_SYN,
- "", HFILL }},
+ { "Syn", "tcp.flags.syn", FT_BOOLEAN, 8, TFS(&tfs_set_notset), TH_SYN,
+ NULL, HFILL }},
{ &hf_tcp_flags_fin,
- { "Fin", "tcp.flags.fin", FT_BOOLEAN, 8, TFS(&flags_set_truth), TH_FIN,
- "", HFILL }},
+ { "Fin", "tcp.flags.fin", FT_BOOLEAN, 8, TFS(&tfs_set_notset), TH_FIN,
+ NULL, HFILL }},
/* 32 bits so we can present some values adjusted to window scaling */
{ &hf_tcp_window_size,
{ "Window size", "tcp.window_size", FT_UINT32, BASE_DEC, NULL, 0x0,
- "", HFILL }},
+ NULL, HFILL }},
{ &hf_tcp_checksum,
{ "Checksum", "tcp.checksum", FT_UINT16, BASE_HEX, NULL, 0x0,
{ &hf_tcp_len,
{ "TCP Segment Len", "tcp.len", FT_UINT32, BASE_DEC, NULL, 0x0,
- "", HFILL}},
+ NULL, HFILL}},
{ &hf_tcp_analysis_acks_frame,
{ "This is an ACK to the segment in frame", "tcp.analysis.acks_frame", FT_FRAMENUM, BASE_NONE, NULL, 0x0,
"Which previous segment is this an ACK for", HFILL}},
+ { &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}},
+
{ &hf_tcp_analysis_ack_rtt,
{ "The RTT to ACK the segment was", "tcp.analysis.ack_rtt", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
"How long time it took to ACK the segment (RTT)", HFILL}},
{ &hf_tcp_urgent_pointer,
{ "Urgent pointer", "tcp.urgent_pointer", FT_UINT16, BASE_DEC, NULL, 0x0,
- "", HFILL }},
+ NULL, HFILL }},
{ &hf_tcp_segment_overlap,
{ "Segment overlap", "tcp.segment.overlap", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
{ &hf_tcp_segment,
{ "TCP Segment", "tcp.segment", FT_FRAMENUM, BASE_NONE, NULL, 0x0,
- "TCP Segment", HFILL }},
+ NULL, HFILL }},
{ &hf_tcp_segments,
{ "Reassembled TCP Segments", "tcp.segments", FT_NONE, BASE_NONE, NULL, 0x0,
{ &hf_tcp_options,
{ "TCP Options", "tcp.options", FT_BYTES,
- BASE_HEX, NULL, 0x0, "TCP Options", HFILL }},
+ BASE_NONE, NULL, 0x0, NULL, HFILL }},
{ &hf_tcp_option_mss,
{ "TCP MSS Option", "tcp.options.mss", FT_BOOLEAN,
- BASE_NONE, NULL, 0x0, "TCP MSS Option", HFILL }},
+ BASE_NONE, NULL, 0x0, NULL, HFILL }},
{ &hf_tcp_option_mss_val,
{ "TCP MSS Option Value", "tcp.options.mss_val", FT_UINT16,
- BASE_DEC, NULL, 0x0, "TCP MSS Option Value", HFILL}},
+ BASE_DEC, NULL, 0x0, NULL, HFILL}},
{ &hf_tcp_option_wscale,
{ "TCP Window Scale Option", "tcp.options.wscale",
{ &hf_tcp_option_sack_perm,
{ "TCP Sack Perm Option", "tcp.options.sack_perm",
FT_BOOLEAN,
- BASE_NONE, NULL, 0x0, "TCP Sack Perm Option", HFILL}},
+ BASE_NONE, NULL, 0x0, NULL, HFILL}},
{ &hf_tcp_option_sack,
{ "TCP Sack Option", "tcp.options.sack", FT_BOOLEAN,
- BASE_NONE, NULL, 0x0, "TCP Sack Option", HFILL}},
+ BASE_NONE, NULL, 0x0, NULL, HFILL}},
{ &hf_tcp_option_sack_sle,
{"TCP Sack Left Edge", "tcp.options.sack_le", FT_UINT32,
- BASE_DEC, NULL, 0x0, "TCP Sack Left Edge", HFILL}},
+ BASE_DEC, NULL, 0x0, NULL, HFILL}},
{ &hf_tcp_option_sack_sre,
{"TCP Sack Right Edge", "tcp.options.sack_re", FT_UINT32,
- BASE_DEC, NULL, 0x0, "TCP Sack Right Edge", HFILL}},
+ BASE_DEC, NULL, 0x0, NULL, HFILL}},
{ &hf_tcp_option_echo,
{ "TCP Echo Option", "tcp.options.echo", FT_BOOLEAN,
{ &hf_tcp_option_echo_reply,
{ "TCP Echo Reply Option", "tcp.options.echo_reply",
FT_BOOLEAN,
- BASE_NONE, NULL, 0x0, "TCP Echo Reply Option", HFILL}},
+ BASE_NONE, NULL, 0x0, NULL, HFILL}},
{ &hf_tcp_option_time_stamp,
{ "TCP Time Stamp Option", "tcp.options.time_stamp",
FT_BOOLEAN,
- BASE_NONE, NULL, 0x0, "TCP Time Stamp Option", HFILL}},
+ BASE_NONE, NULL, 0x0, NULL, HFILL}},
{ &hf_tcp_option_cc,
{ "TCP CC Option", "tcp.options.cc", FT_BOOLEAN, BASE_NONE,
- NULL, 0x0, "TCP CC Option", HFILL}},
+ NULL, 0x0, NULL, HFILL}},
{ &hf_tcp_option_ccnew,
{ "TCP CC New Option", "tcp.options.ccnew", FT_BOOLEAN,
- BASE_NONE, NULL, 0x0, "TCP CC New Option", HFILL}},
+ BASE_NONE, NULL, 0x0, NULL, HFILL}},
{ &hf_tcp_option_ccecho,
{ "TCP CC Echo Option", "tcp.options.ccecho", FT_BOOLEAN,
- BASE_NONE, NULL, 0x0, "TCP CC Echo Option", HFILL}},
+ BASE_NONE, NULL, 0x0, NULL, HFILL}},
{ &hf_tcp_option_md5,
{ "TCP MD5 Option", "tcp.options.md5", FT_BOOLEAN, BASE_NONE,
- NULL, 0x0, "TCP MD5 Option", HFILL}},
+ NULL, 0x0, NULL, HFILL}},
{ &hf_tcp_option_qs,
{ "TCP QS Option", "tcp.options.qs", FT_BOOLEAN, BASE_NONE,
- NULL, 0x0, "TCP QS Option", HFILL}},
+ NULL, 0x0, NULL, HFILL}},
+
+ { &hf_tcp_option_scps,
+ { "TCP SCPS Capabilities Option", "tcp.options.scps",
+ FT_BOOLEAN, BASE_NONE, NULL, 0x0,
+ NULL, HFILL}},
+
+ { &hf_tcp_option_scps_vector,
+ { "TCP SCPS Capabilities Vector", "tcp.options.scps.vector",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL}},
+
+ { &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,
+ NULL, HFILL}},
+
+ { &hf_tcp_option_snack_offset,
+ { "TCP SNACK Offset", "tcp.options.snack.offset",
+ FT_UINT16, BASE_DEC, NULL, 0x0,
+ NULL, HFILL}},
+
+ { &hf_tcp_option_snack_size,
+ { "TCP SNACK Size", "tcp.options.snack.size",
+ FT_UINT16, BASE_DEC, NULL, 0x0,
+ NULL, HFILL}},
+
+ { &hf_tcp_option_snack_le,
+ { "TCP SNACK Left Edge", "tcp.options.snack.le",
+ FT_UINT16, BASE_DEC, NULL, 0x0,
+ NULL, HFILL}},
+
+ { &hf_tcp_option_snack_re,
+ { "TCP SNACK Right Edge", "tcp.options.snack.re",
+ FT_UINT16, BASE_DEC, NULL, 0x0,
+ NULL, HFILL}},
+
+ { &hf_tcp_scpsoption_flags_bets,
+ { "Partial Reliability Capable (BETS)",
+ "tcp.options.scpsflags.bets", FT_BOOLEAN, 8,
+ TFS(&tfs_set_notset), 0x80, NULL, HFILL }},
+
+ { &hf_tcp_scpsoption_flags_snack1,
+ { "Short Form SNACK Capable (SNACK1)",
+ "tcp.options.scpsflags.snack1", FT_BOOLEAN, 8,
+ TFS(&tfs_set_notset), 0x40, NULL, HFILL }},
+
+ { &hf_tcp_scpsoption_flags_snack2,
+ { "Long Form SNACK Capable (SNACK2)",
+ "tcp.options.scpsflags.snack2", FT_BOOLEAN, 8,
+ TFS(&tfs_set_notset), 0x20, NULL, HFILL }},
+
+ { &hf_tcp_scpsoption_flags_compress,
+ { "Lossless Header Compression (COMP)",
+ "tcp.options.scpsflags.compress", FT_BOOLEAN, 8,
+ TFS(&tfs_set_notset), 0x10, NULL, HFILL }},
+
+ { &hf_tcp_scpsoption_flags_nlts,
+ { "Network Layer Timestamp (NLTS)",
+ "tcp.options.scpsflags.nlts", FT_BOOLEAN, 8,
+ TFS(&tfs_set_notset), 0x8, NULL, HFILL }},
+
+ { &hf_tcp_scpsoption_flags_resv1,
+ { "Reserved Bit 1",
+ "tcp.options.scpsflags.reserved1", FT_BOOLEAN, 8,
+ TFS(&tfs_set_notset), 0x4, NULL, HFILL }},
+
+ { &hf_tcp_scpsoption_flags_resv2,
+ { "Reserved Bit 2",
+ "tcp.options.scpsflags.reserved2", FT_BOOLEAN, 8,
+ TFS(&tfs_set_notset), 0x2, NULL, HFILL }},
+
+ { &hf_tcp_scpsoption_flags_resv3,
+ { "Reserved Bit 3",
+ "tcp.options.scpsflags.reserved3", FT_BOOLEAN, 8,
+ TFS(&tfs_set_notset), 0x1, NULL, HFILL }},
{ &hf_tcp_pdu_time,
{ "Time until the last segment of this PDU", "tcp.pdu.time", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
{ &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}},
+
+ { &hf_tcp_proc_src_uid,
+ { "Source process user ID", "tcp.proc.srcuid", FT_UINT32, BASE_DEC, NULL, 0x0,
+ NULL, HFILL}},
+
+ { &hf_tcp_proc_src_pid,
+ { "Source process ID", "tcp.proc.srcpid", FT_UINT32, BASE_DEC, NULL, 0x0,
+ NULL, HFILL}},
+
+ { &hf_tcp_proc_src_uname,
+ { "Source process user name", "tcp.proc.srcuname", FT_STRING, BASE_NONE, NULL, 0x0,
+ NULL, HFILL}},
+
+ { &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,
+ NULL, HFILL}},
+
+ { &hf_tcp_proc_dst_pid,
+ { "Destination process ID", "tcp.proc.dstpid", FT_UINT32, BASE_DEC, NULL, 0x0,
+ NULL, HFILL}},
+
+ { &hf_tcp_proc_dst_uname,
+ { "Destination process user name", "tcp.proc.dstuname", FT_STRING, BASE_NONE, NULL, 0x0,
+ NULL, HFILL}},
+
+ { &hf_tcp_proc_dst_cmd,
+ { "Destination process name", "tcp.proc.dstcmd", FT_STRING, BASE_NONE, NULL, 0x0,
+ "Destination process command name", HFILL}}
};
static gint *ett[] = {
&ett_tcp_flags,
&ett_tcp_options,
&ett_tcp_option_sack,
+ &ett_tcp_option_scps,
+ &ett_tcp_option_scps_extended,
&ett_tcp_analysis_faults,
&ett_tcp_analysis,
&ett_tcp_timestamps,
&ett_tcp_segments,
&ett_tcp_segment,
- &ett_tcp_checksum
+ &ett_tcp_checksum,
+ &ett_tcp_process_info
};
module_t *tcp_module;
"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.",
&tcp_relative_seq);
+ 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);
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",
data_handle = find_dissector("data");
tcp_tap = register_tap("tcp");
}
+
+/*
+ * 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:
+ */