summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2014-05-11 15:07:25 +0200
committerAlexis La Goutte <alexis.lagoutte@gmail.com>2014-05-11 17:01:54 +0000
commit98f608cc0ddd5493a18e87ffe09ed551969b8ae3 (patch)
tree73262480e9b0da27362ae9bf332967ab6ed8dbeb
parent44d83c2f4f9256f7436e43dee940c922d864d57d (diff)
downloadwireshark-98f608cc0ddd5493a18e87ffe09ed551969b8ae3.tar.gz
Identify client/server by their IP address and port number in follow streams dialog box
This allows to properly identify hosts that use the same port number Change-Id: I93bf5b53e4df1d339fb06b372b90f88fce6785a0 Reviewed-on: https://code.wireshark.org/review/1588 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
-rw-r--r--ui/gtk/follow_ssl.c4
-rw-r--r--ui/gtk/follow_tcp.c8
-rw-r--r--ui/gtk/follow_udp.c8
-rw-r--r--ui/qt/follow_stream_dialog.cpp12
4 files changed, 23 insertions, 9 deletions
diff --git a/ui/gtk/follow_ssl.c b/ui/gtk/follow_ssl.c
index f12de83bca..403bd39f1a 100644
--- a/ui/gtk/follow_ssl.c
+++ b/ui/gtk/follow_ssl.c
@@ -251,7 +251,9 @@ follow_ssl_stream_cb(GtkWidget * w _U_, gpointer data _U_)
both_directions_string = g_strdup_printf("Entire conversation (%u bytes)", follow_info->bytes_written[0] + follow_info->bytes_written[1]);
/* ...and then the server-to-client and client-to-server directions. */
- if (follow_info->client_port == stats.port[0]) {
+ if ((follow_info->client_port == stats.port[0]) &&
+ ((stats.is_ipv6 && (memcmp(follow_info->client_ip.data, stats.ip_address[0], 16) == 0)) ||
+ (!stats.is_ipv6 && (memcmp(follow_info->client_ip.data, stats.ip_address[0], 4) == 0)))) {
server_hostname = hostname0;
server_port = port0;
client_hostname = hostname1;
diff --git a/ui/gtk/follow_tcp.c b/ui/gtk/follow_tcp.c
index 71b7d54b72..3b93865937 100644
--- a/ui/gtk/follow_tcp.c
+++ b/ui/gtk/follow_tcp.c
@@ -265,7 +265,9 @@ follow_tcp_stream_cb(GtkWidget * w _U_, gpointer data _U_)
port1 = ep_tcp_port_to_display(stats.port[1]);
/* Host 0 --> Host 1 */
- if(sc.src_port == stats.port[0]) {
+ if ((sc.src_port == stats.port[0]) &&
+ ((stats.is_ipv6 && (memcmp(sc.src_addr, stats.ip_address[0], 16) == 0)) ||
+ (!stats.is_ipv6 && (memcmp(sc.src_addr, stats.ip_address[0], 4) == 0)))) {
server_to_client_string =
g_strdup_printf("%s:%s " UTF8_RIGHTWARDS_ARROW " %s:%s (%u bytes)",
hostname0, port0,
@@ -280,7 +282,9 @@ follow_tcp_stream_cb(GtkWidget * w _U_, gpointer data _U_)
}
/* Host 1 --> Host 0 */
- if(sc.src_port == stats.port[1]) {
+ if ((sc.src_port == stats.port[1]) &&
+ ((stats.is_ipv6 && (memcmp(sc.src_addr, stats.ip_address[1], 16) == 0)) ||
+ (!stats.is_ipv6 && (memcmp(sc.src_addr, stats.ip_address[1], 4) == 0)))) {
client_to_server_string =
g_strdup_printf("%s:%s " UTF8_RIGHTWARDS_ARROW " %s:%s (%u bytes)",
hostname0, port0,
diff --git a/ui/gtk/follow_udp.c b/ui/gtk/follow_udp.c
index 73aa8ee99f..544dc6d097 100644
--- a/ui/gtk/follow_udp.c
+++ b/ui/gtk/follow_udp.c
@@ -52,10 +52,10 @@ udp_queue_packet_data(void *tapdata, packet_info *pinfo,
follow_record = g_new(follow_record_t,1);
- follow_record->data = g_byte_array_sized_new(tvb_length(next_tvb));
+ follow_record->data = g_byte_array_sized_new(tvb_captured_length(next_tvb));
follow_record->data = g_byte_array_append(follow_record->data,
tvb_get_ptr(next_tvb, 0, -1),
- tvb_length(next_tvb));
+ tvb_captured_length(next_tvb));
if (follow_info->client_port == 0) {
follow_info->client_port = pinfo->srcport;
@@ -193,7 +193,9 @@ follow_udp_stream_cb(GtkWidget *w _U_, 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]);
- if(follow_info->client_port == stats.port[0]) {
+ if ((follow_info->client_port == stats.port[0]) &&
+ ((stats.is_ipv6 && (memcmp(follow_info->client_ip.data, stats.ip_address[0], 16) == 0)) ||
+ (!stats.is_ipv6 && (memcmp(follow_info->client_ip.data, stats.ip_address[0], 4) == 0)))) {
server_to_client_string =
g_strdup_printf("%s:%s " UTF8_RIGHTWARDS_ARROW " %s:%s (%u bytes)",
hostname0, port0,
diff --git a/ui/qt/follow_stream_dialog.cpp b/ui/qt/follow_stream_dialog.cpp
index 9fbf5ed871..a747b62812 100644
--- a/ui/qt/follow_stream_dialog.cpp
+++ b/ui/qt/follow_stream_dialog.cpp
@@ -1057,7 +1057,9 @@ bool FollowStreamDialog::follow(QString previous_filter, bool use_tcp_index)
if (follow_type_ == FOLLOW_TCP)
{
/* Host 0 --> Host 1 */
- if(sc.src_port == stats.port[0]) {
+ if ((sc.src_port == stats.port[0]) &&
+ ((stats.is_ipv6 && (memcmp(sc.src_addr, stats.ip_address[0], 16) == 0)) ||
+ (!stats.is_ipv6 && (memcmp(sc.src_addr, stats.ip_address[0], 4) == 0)))) {
server_to_client_string =
QString("%1:%2 %3 %4:%5 (%6)")
.arg(hostname0).arg(port0)
@@ -1078,7 +1080,9 @@ bool FollowStreamDialog::follow(QString previous_filter, bool use_tcp_index)
}
/* Host 1 --> Host 0 */
- if(sc.src_port == stats.port[1]) {
+ if ((sc.src_port == stats.port[1]) &&
+ ((stats.is_ipv6 && (memcmp(sc.src_addr, stats.ip_address[1], 16) == 0)) ||
+ (!stats.is_ipv6 && (memcmp(sc.src_addr, stats.ip_address[1], 4) == 0)))) {
client_to_server_string =
QString("%1:%2 %3 %4:%5 (%6)")
.arg(hostname0).arg(port0)
@@ -1101,7 +1105,9 @@ bool FollowStreamDialog::follow(QString previous_filter, bool use_tcp_index)
}
else
{
- if(follow_info_.client_port == stats.port[0]) {
+ if ((follow_info_.client_port == stats.port[0]) &&
+ ((stats.is_ipv6 && (memcmp(follow_info_.client_ip.data, stats.ip_address[0], 16) == 0)) ||
+ (!stats.is_ipv6 && (memcmp(follow_info_.client_ip.data, stats.ip_address[0], 4) == 0)))) {
server_to_client_string =
QString("%1:%2 %3 %4:%5 (%6)")
.arg(hostname0).arg(port0)