Fix for bug 1447: Follow TCP Stream show only the first stream

Use the new "tcp.stream eq XXX" as a display filter for follow tcp stream.
This makes sure only the tcp stream which the selected packet belangs to
will be shown (in case tcp ports are reused in the tracefile).


svn path=/trunk/; revision=26306
This commit is contained in:
Sake Blok 2008-09-30 13:29:15 +00:00
parent a550fb9d78
commit ec20a1ccb8
1 changed files with 11 additions and 12 deletions

View File

@ -39,6 +39,7 @@
#include <epan/packet.h>
#include <epan/ipproto.h>
#include "follow.h"
#include <epan/conversation.h>
#define MAX_IPADDR_LEN 16
@ -84,14 +85,14 @@ char*
build_follow_filter( packet_info *pi ) {
char* buf;
int len;
conversation_t *conv=NULL;
if( pi->net_src.type == AT_IPv4 && pi->net_dst.type == AT_IPv4
&& pi->ipproto == IP_PROTO_TCP ) {
&& pi->ipproto == IP_PROTO_TCP
&& (conv=find_conversation(pi->fd->num, &pi->src, &pi->dst, pi->ptype,
pi->srcport, pi->destport, 0)) != NULL ) {
/* TCP over IPv4 */
buf = g_strdup_printf(
"(ip.addr eq %s and ip.addr eq %s) and (tcp.port eq %d and tcp.port eq %d)",
ip_to_str( pi->net_src.data),
ip_to_str( pi->net_dst.data),
pi->srcport, pi->destport );
buf = g_strdup_printf("tcp.stream eq %d", conv->index);
len = 4;
is_ipv6 = FALSE;
}
@ -107,13 +108,11 @@ build_follow_filter( packet_info *pi ) {
is_ipv6 = FALSE;
}
else if( pi->net_src.type == AT_IPv6 && pi->net_dst.type == AT_IPv6
&& pi->ipproto == IP_PROTO_TCP ) {
&& pi->ipproto == IP_PROTO_TCP
&& (conv=find_conversation(pi->fd->num, &pi->src, &pi->dst, pi->ptype,
pi->srcport, pi->destport, 0)) != NULL ) {
/* TCP over IPv6 */
buf = g_strdup_printf(
"(ipv6.addr eq %s and ipv6.addr eq %s) and (tcp.port eq %d and tcp.port eq %d)",
ip6_to_str((const struct e_in6_addr *)pi->net_src.data),
ip6_to_str((const struct e_in6_addr *)pi->net_dst.data),
pi->srcport, pi->destport );
buf = g_strdup_printf("tcp.stream eq %d", conv->index);
len = 16;
is_ipv6 = TRUE;
}