From 7c0c8189a6b9dd7f67c165b694e0384b0682086e Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Sat, 17 Mar 2018 13:54:30 +0100 Subject: Qt: fix "Follow stream" in Conversations dialog If no stream is given to FollowStreamDialog::follow(), then it overwrites the display filter with a conversation filter for the first packet in the capture file. Pass an explicit stream number and the "Follow stream" button will set a correct display filter. Test: open pcap with three TCP streams. Statistics -> Conversations. Select last TCP conversation (expect "tcp.stream eq 2"). Select the second conversation (expect "tcp.stream eq 1") and activate "Filter Out" button (expect "!(tcp.stream eq 1)" and not "!(tcp.stream eq 2) and !(tcp.stream eq 1)"). Bug: 14254 Change-Id: I28744d7f76f5034b07ea5660b45399566e3a7d2c Reviewed-on: https://code.wireshark.org/review/26520 Petri-Dish: Peter Wu Tested-by: Petri Dish Buildbot Reviewed-by: Alexis La Goutte --- ui/qt/conversation_dialog.cpp | 14 ++++---------- ui/qt/conversation_dialog.h | 2 +- ui/qt/main_window.h | 2 +- ui/qt/main_window_slots.cpp | 14 ++++++++++---- 4 files changed, 16 insertions(+), 16 deletions(-) (limited to 'ui') diff --git a/ui/qt/conversation_dialog.cpp b/ui/qt/conversation_dialog.cpp index 1687628e1f..e38a0fcae4 100644 --- a/ui/qt/conversation_dialog.cpp +++ b/ui/qt/conversation_dialog.cpp @@ -198,26 +198,20 @@ void ConversationDialog::followStream() return; } - QString filter; - follow_type_t ftype = FOLLOW_TCP; + follow_type_t ftype; switch (conv_item->etype) { case ENDPOINT_TCP: - filter = QString("tcp.stream eq %1").arg(conv_item->conv_id); + ftype = FOLLOW_TCP; break; case ENDPOINT_UDP: - filter = QString("udp.stream eq %1").arg(conv_item->conv_id); ftype = FOLLOW_UDP; break; default: - break; - } - - if (filter.length() < 1) { return; } - emit filterAction(filter, FilterAction::ActionApply, FilterAction::ActionTypePlain); - emit openFollowStreamDialog(ftype); + // Will set the display filter too. + emit openFollowStreamDialog(ftype, (int)conv_item->conv_id); } void ConversationDialog::graphTcp() diff --git a/ui/qt/conversation_dialog.h b/ui/qt/conversation_dialog.h index 94a5e776f6..fc68081641 100644 --- a/ui/qt/conversation_dialog.h +++ b/ui/qt/conversation_dialog.h @@ -56,7 +56,7 @@ public slots: signals: void filterAction(QString filter, FilterAction::Action action, FilterAction::ActionType type); - void openFollowStreamDialog(follow_type_t type); + void openFollowStreamDialog(follow_type_t type, int stream_num); void openTcpStreamGraph(int graph_type); private: diff --git a/ui/qt/main_window.h b/ui/qt/main_window.h index 20dad06006..88d39f9fb9 100644 --- a/ui/qt/main_window.h +++ b/ui/qt/main_window.h @@ -525,7 +525,7 @@ private slots: void on_actionAnalyzeDecodeAs_triggered(); void on_actionAnalyzeReloadLuaPlugins_triggered(); - void openFollowStreamDialog(follow_type_t type); + void openFollowStreamDialog(follow_type_t type, int stream_num = -1); void on_actionAnalyzeFollowTCPStream_triggered(); void on_actionAnalyzeFollowUDPStream_triggered(); void on_actionAnalyzeFollowSSLStream_triggered(); diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp index be8af49256..1c70a6f389 100644 --- a/ui/qt/main_window_slots.cpp +++ b/ui/qt/main_window_slots.cpp @@ -2958,13 +2958,19 @@ void MainWindow::on_actionAnalyzeReloadLuaPlugins_triggered() reloadLuaPlugins(); } -void MainWindow::openFollowStreamDialog(follow_type_t type) { +void MainWindow::openFollowStreamDialog(follow_type_t type, int stream_num) { FollowStreamDialog *fsd = new FollowStreamDialog(*this, capture_file_, type); connect(fsd, SIGNAL(updateFilter(QString, bool)), this, SLOT(filterPackets(QString, bool))); connect(fsd, SIGNAL(goToPacket(int)), packet_list_, SLOT(goToPacket(int))); fsd->show(); - fsd->follow(getFilter()); + if (stream_num >= 0) { + // If a specific conversation was requested, then ignore any previous + // display filters and display all related packets. + fsd->follow("", true, stream_num); + } else { + fsd->follow(getFilter()); + } } void MainWindow::on_actionAnalyzeFollowTCPStream_triggered() @@ -3268,8 +3274,8 @@ void MainWindow::statCommandConversations(const char *arg, void *userdata) ConversationDialog *conv_dialog = new ConversationDialog(*this, capture_file_, GPOINTER_TO_INT(userdata), arg); connect(conv_dialog, SIGNAL(filterAction(QString,FilterAction::Action,FilterAction::ActionType)), this, SIGNAL(filterAction(QString,FilterAction::Action,FilterAction::ActionType))); - connect(conv_dialog, SIGNAL(openFollowStreamDialog(follow_type_t)), - this, SLOT(openFollowStreamDialog(follow_type_t))); + connect(conv_dialog, SIGNAL(openFollowStreamDialog(follow_type_t,int)), + this, SLOT(openFollowStreamDialog(follow_type_t,int))); connect(conv_dialog, SIGNAL(openTcpStreamGraph(int)), this, SLOT(openTcpStreamDialog(int))); conv_dialog->show(); -- cgit v1.2.3