Fix bug #1212: Follow SSL/UDP Stream gets direction wrong ...

svn path=/trunk/; revision=24715
This commit is contained in:
Stephen Fisher 2008-03-22 05:50:19 +00:00
parent b906bf1708
commit c4571a6ad5
4 changed files with 61 additions and 39 deletions

View File

@ -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;

View File

@ -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);
}

View File

@ -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"

View File

@ -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;