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 <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
This commit is contained in:
Peter Wu 2018-03-17 13:54:30 +01:00 committed by Alexis La Goutte
parent 83d028792a
commit 7c0c8189a6
4 changed files with 16 additions and 16 deletions

View File

@ -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()

View File

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

View File

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

View File

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