diff --git a/gtk/follow_ssl.c b/gtk/follow_ssl.c index e18c796129..fbd9e71a5c 100644 --- a/gtk/follow_ssl.c +++ b/gtk/follow_ssl.c @@ -103,12 +103,11 @@ ssl_queue_packet_data(void *tapdata, packet_info *pinfo, epan_dissect_t *edt _U_ if (follow_info->client_port == 0) { follow_info->client_port = pinfo->srcport; - memcpy(follow_info->client_ip, pinfo->src.data, pinfo->src.len); + COPY_ADDRESS(&follow_info->client_ip, &pinfo->src); } - if (memcmp(follow_info->client_ip, pinfo->src.data, pinfo->src.len) == 0 && - follow_info->client_port == pinfo->srcport) { + if (ADDRESSES_EQUAL(&follow_info->client_ip, &pinfo->src) && + follow_info->client_port == pinfo->srcport) rec->is_server = 0; - } else rec->is_server = 1; @@ -247,20 +246,32 @@ follow_ssl_stream_cb(GtkWidget * w, gpointer data _U_) /* Both Stream Directions */ both_directions_string = g_strdup_printf("Entire conversation (%u bytes)", follow_info->bytes_written[0] + follow_info->bytes_written[1]); - /* Host 0 --> Host 1 */ - server_to_client_string = - g_strdup_printf("%s:%s --> %s:%s (%u bytes)", - hostname0, port0, - hostname1, port1, - follow_info->bytes_written[0]); - - /* Host 1 --> Host 0 */ - client_to_server_string = - g_strdup_printf("%s:%s --> %s:%s (%u bytes)", - hostname1, port1, - hostname0, port0, - follow_info->bytes_written[1]); - + if(follow_info->client_port == stats.port[0]) { + server_to_client_string = + g_strdup_printf("%s:%s --> %s:%s (%u bytes)", + hostname0, port0, + hostname1, port1, + follow_info->bytes_written[0]); + + client_to_server_string = + g_strdup_printf("%s:%s --> %s:%s (%u bytes)", + hostname1, port1, + hostname0, port0, + follow_info->bytes_written[1]); + } else { + server_to_client_string = + g_strdup_printf("%s:%s --> %s:%s (%u bytes)", + hostname1, port1, + hostname0, port0, + follow_info->bytes_written[0]); + + client_to_server_string = + g_strdup_printf("%s:%s --> %s:%s (%u bytes)", + hostname0, port0, + hostname1, port1, + follow_info->bytes_written[1]); + } + follow_stream("Follow SSL Stream", follow_info, both_directions_string, server_to_client_string, client_to_server_string); @@ -312,8 +323,7 @@ follow_read_ssl_stream(follow_info_t *follow_info, if (follow_info->show_stream == FROM_SERVER) { skip = TRUE; } - } - else { + } else { global_pos = &global_server_pos; if (follow_info->show_stream == FROM_CLIENT) { skip = TRUE; diff --git a/gtk/follow_stream.c b/gtk/follow_stream.c index 47342590d1..0f07bc616f 100644 --- a/gtk/follow_stream.c +++ b/gtk/follow_stream.c @@ -992,6 +992,7 @@ follow_destroy_cb(GtkWidget *w, gpointer data _U_) } g_free(follow_info->filter_out_filter); + g_free((gpointer)follow_info->client_ip.data); forget_follow_info(follow_info); g_free(follow_info); } diff --git a/gtk/follow_stream.h b/gtk/follow_stream.h index e7fece56cb..a2a78806b6 100644 --- a/gtk/follow_stream.h +++ b/gtk/follow_stream.h @@ -86,7 +86,7 @@ typedef struct { GList *payload; guint bytes_written[2]; guint client_port; - char client_ip[MAX_IPADDR_LEN]; + address client_ip; } follow_info_t; #define E_FOLLOW_INFO_KEY "follow_info_key" diff --git a/gtk/follow_udp.c b/gtk/follow_udp.c index 775d9b8b47..c9accfe8e9 100644 --- a/gtk/follow_udp.c +++ b/gtk/follow_udp.c @@ -62,11 +62,11 @@ udp_queue_packet_data(void *tapdata, packet_info *pinfo, if (follow_info->client_port == 0) { follow_info->client_port = pinfo->srcport; - memcpy(follow_info->client_ip, pinfo->src.data, pinfo->src.len); + COPY_ADDRESS(&follow_info->client_ip, &pinfo->src); } - if (memcmp(follow_info->client_ip, pinfo->src.data, pinfo->src.len) == - 0 && follow_info->client_port == pinfo->srcport) + if (ADDRESSES_EQUAL(&follow_info->client_ip, &pinfo->src) && + follow_info->client_port == pinfo->srcport) follow_record->is_server = FALSE; else follow_record->is_server = TRUE; @@ -193,19 +193,31 @@ follow_udp_stream_cb(GtkWidget *w, gpointer data _U_) /* Both Stream Directions */ both_directions_string = g_strdup_printf("Entire conversation (%u bytes)", follow_info->bytes_written[0] + follow_info->bytes_written[1]); - /* Host 0 --> Host 1 */ - server_to_client_string = - g_strdup_printf("%s:%s --> %s:%s (%u bytes)", - hostname0, port0, - hostname1, port1, - follow_info->bytes_written[0]); - - /* Host 1 --> Host 0 */ - client_to_server_string = - g_strdup_printf("%s:%s --> %s:%s (%u bytes)", - hostname1, port1, - hostname0, port0, - follow_info->bytes_written[1]); + if(follow_info->client_port == stats.port[0]) { + server_to_client_string = + g_strdup_printf("%s:%s --> %s:%s (%u bytes)", + hostname0, port0, + hostname1, port1, + follow_info->bytes_written[0]); + + client_to_server_string = + g_strdup_printf("%s:%s --> %s:%s (%u bytes)", + hostname1, port1, + hostname0, port0, + follow_info->bytes_written[1]); + } else { + server_to_client_string = + g_strdup_printf("%s:%s --> %s:%s (%u bytes)", + hostname1, port1, + hostname0, port0, + follow_info->bytes_written[0]); + + client_to_server_string = + g_strdup_printf("%s:%s --> %s:%s (%u bytes)", + hostname0, port0, + hostname1, port1, + follow_info->bytes_written[1]); + } follow_stream("Follow UDP Stream", follow_info, both_directions_string, server_to_client_string, client_to_server_string); @@ -260,8 +272,7 @@ follow_read_udp_stream(follow_info_t *follow_info, if(follow_info->show_stream == FROM_SERVER) { skip = TRUE; } - } - else { + } else { global_pos = &global_server_pos; if (follow_info->show_stream == FROM_CLIENT) { skip = TRUE;