diff options
author | Sake Blok <sake@euronet.nl> | 2009-12-13 01:10:55 +0000 |
---|---|---|
committer | Sake Blok <sake@euronet.nl> | 2009-12-13 01:10:55 +0000 |
commit | 1580d332f4fb4d218cb0fb1f6e8a306a302da7a4 (patch) | |
tree | 24b5d96ebdb98f00cc7f6362db93fa8a9a7015e7 | |
parent | e1ec979363c15c1da6a9b23f7278912cf729473a (diff) |
Fix for bug 3955 and 4288. When doing Follow TCP stream, there was no
check whether a packet belonged to the correct tcp stream (when there
are multiple streams in the tracefile with the samen ip addresses and
tcp ports.
svn path=/trunk/; revision=31252
-rw-r--r-- | epan/dissectors/packet-tcp.c | 3 | ||||
-rw-r--r-- | epan/follow.c | 11 | ||||
-rw-r--r-- | epan/follow.h | 4 |
3 files changed, 12 insertions, 6 deletions
diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c index e45cd3a401..39b84cc8bf 100644 --- a/epan/dissectors/packet-tcp.c +++ b/epan/dissectors/packet-tcp.c @@ -3520,7 +3520,8 @@ dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (tcph->th_have_seglen) { if( data_out_file ) { - reassemble_tcp( tcph->th_seq, /* sequence number */ + reassemble_tcp( conv->index, /* conversation index */ + tcph->th_seq, /* sequence number */ tcph->th_ack, /* acknowledgement number */ tcph->th_seglen, /* data length */ (gchar*)tvb_get_ptr(tvb, offset, length_remaining), /* data */ diff --git a/epan/follow.c b/epan/follow.c index 604c25494b..be0817603d 100644 --- a/epan/follow.c +++ b/epan/follow.c @@ -56,6 +56,7 @@ FILE* data_out_file = NULL; gboolean empty_tcp_stream; gboolean incomplete_tcp_stream; +static guint32 tcp_stream_to_follow; static guint8 ip_address[2][MAX_IPADDR_LEN]; static guint port[2]; static guint bytes_written[2]; @@ -95,6 +96,7 @@ build_follow_filter( packet_info *pi ) { buf = g_strdup_printf("tcp.stream eq %d", conv->index); len = 4; is_ipv6 = FALSE; + tcp_stream_to_follow = conv->index; } else if( pi->net_src.type == AT_IPv4 && pi->net_dst.type == AT_IPv4 && pi->ipproto == IP_PROTO_UDP ) { @@ -115,6 +117,7 @@ build_follow_filter( packet_info *pi ) { buf = g_strdup_printf("tcp.stream eq %d", conv->index); len = 16; is_ipv6 = TRUE; + tcp_stream_to_follow = conv->index; } else if( pi->net_src.type == AT_IPv6 && pi->net_dst.type == AT_IPv6 && pi->ipproto == IP_PROTO_UDP ) { @@ -147,9 +150,9 @@ static guint8 src_addr[2][MAX_IPADDR_LEN]; static guint src_port[2] = { 0, 0 }; void -reassemble_tcp( gulong sequence, gulong acknowledgement, gulong length, - const char* data, gulong data_length, int synflag, - address *net_src, address *net_dst, +reassemble_tcp( guint32 tcp_stream, gulong sequence, gulong acknowledgement, + gulong length, const char* data, gulong data_length, + int synflag, address *net_src, address *net_dst, guint srcport, guint dstport) { guint8 srcx[MAX_IPADDR_LEN], dstx[MAX_IPADDR_LEN]; int src_index, j, first = 0, len; @@ -160,6 +163,8 @@ reassemble_tcp( gulong sequence, gulong acknowledgement, gulong length, src_index = -1; /* First, check if this packet should be processed. */ + if ( tcp_stream != tcp_stream_to_follow ) + return; if ((net_src->type != AT_IPv4 && net_src->type != AT_IPv6) || (net_dst->type != AT_IPv4 && net_dst->type != AT_IPv6)) diff --git a/epan/follow.h b/epan/follow.h index 989e4bd729..8d279e548c 100644 --- a/epan/follow.h +++ b/epan/follow.h @@ -42,8 +42,8 @@ typedef struct _tcp_stream_chunk { } tcp_stream_chunk; char* build_follow_filter( packet_info * ); -void reassemble_tcp( gulong, gulong, gulong, const char*, gulong, int, - address *, address *, guint, guint ); +void reassemble_tcp( guint32, gulong, gulong, gulong, const char*, gulong, + int, address *, address *, guint, guint ); void reset_tcp_reassembly( void ); typedef struct { |