Qt: Keep extcap control channels when capturing to multiple files
When using the "Create a new file automatically" feature the capture in Wireshark will stop and start, but the extcap utility will continue run as normal. Ensure the control channels are kept when doing this. Rename the unused capture_session.session_started to session_will_restart to detect this. Bug: 16178 Change-Id: I6797c982760a1013fca2a24699befff1dc82f28c Reviewed-on: https://code.wireshark.org/review/35013 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall <rknall@gmail.com>
This commit is contained in:
parent
f75f128462
commit
abfa0d6218
|
@ -48,7 +48,7 @@ typedef struct _capture_session {
|
||||||
uid_t owner; /**< owner of the cfile */
|
uid_t owner; /**< owner of the cfile */
|
||||||
gid_t group; /**< group of the cfile */
|
gid_t group; /**< group of the cfile */
|
||||||
#endif
|
#endif
|
||||||
gboolean session_started;
|
gboolean session_will_restart; /**< Set when session will restart */
|
||||||
guint32 count; /**< Total number of frames captured */
|
guint32 count; /**< Total number of frames captured */
|
||||||
capture_options *capture_opts; /**< options for this capture */
|
capture_options *capture_opts; /**< options for this capture */
|
||||||
capture_file *cf; /**< handle to cfile */
|
capture_file *cf; /**< handle to cfile */
|
||||||
|
|
|
@ -128,7 +128,7 @@ capture_session_init(capture_session *cap_session, capture_file *cf)
|
||||||
cap_session->group = getgid();
|
cap_session->group = getgid();
|
||||||
#endif
|
#endif
|
||||||
cap_session->count = 0;
|
cap_session->count = 0;
|
||||||
cap_session->session_started = FALSE;
|
cap_session->session_will_restart = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Append an arg (realloc) to an argc/argv array */
|
/* Append an arg (realloc) to an argc/argv array */
|
||||||
|
|
|
@ -414,6 +414,7 @@ capture_input_new_file(capture_session *cap_session, gchar *new_file)
|
||||||
/* (we can only have an open capture file in real_time_mode!) */
|
/* (we can only have an open capture file in real_time_mode!) */
|
||||||
if( ((capture_file *) cap_session->cf)->state != FILE_CLOSED) {
|
if( ((capture_file *) cap_session->cf)->state != FILE_CLOSED) {
|
||||||
if(capture_opts->real_time_mode) {
|
if(capture_opts->real_time_mode) {
|
||||||
|
cap_session->session_will_restart = TRUE;
|
||||||
capture_callback_invoke(capture_cb_capture_update_finished, cap_session);
|
capture_callback_invoke(capture_cb_capture_update_finished, cap_session);
|
||||||
cf_finish_tail((capture_file *)cap_session->cf,
|
cf_finish_tail((capture_file *)cap_session->cf,
|
||||||
&cap_session->rec, &cap_session->buf, &err);
|
&cap_session->rec, &cap_session->buf, &err);
|
||||||
|
@ -714,6 +715,7 @@ capture_input_closed(capture_session *cap_session, gchar *msg)
|
||||||
/* Tell the GUI we are not doing a capture any more.
|
/* Tell the GUI we are not doing a capture any more.
|
||||||
Must be done after the cf_finish_tail(), so file lengths are
|
Must be done after the cf_finish_tail(), so file lengths are
|
||||||
correctly displayed */
|
correctly displayed */
|
||||||
|
cap_session->session_will_restart = FALSE;
|
||||||
capture_callback_invoke(capture_cb_capture_update_finished, cap_session);
|
capture_callback_invoke(capture_cb_capture_update_finished, cap_session);
|
||||||
|
|
||||||
/* Finish the capture. */
|
/* Finish the capture. */
|
||||||
|
|
|
@ -2517,7 +2517,7 @@ void MainWindow::changeEvent(QEvent* event)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update main window items based on whether there's a capture in progress. */
|
/* Update main window items based on whether there's a capture in progress. */
|
||||||
void MainWindow::setForCaptureInProgress(bool capture_in_progress, GArray *ifaces)
|
void MainWindow::setForCaptureInProgress(bool capture_in_progress, bool handle_toolbars, GArray *ifaces)
|
||||||
{
|
{
|
||||||
setMenusForCaptureInProgress(capture_in_progress);
|
setMenusForCaptureInProgress(capture_in_progress);
|
||||||
|
|
||||||
|
@ -2532,6 +2532,7 @@ void MainWindow::setForCaptureInProgress(bool capture_in_progress, GArray *iface
|
||||||
// set_capture_if_dialog_for_capture_in_progress(capture_in_progress);
|
// set_capture_if_dialog_for_capture_in_progress(capture_in_progress);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (handle_toolbars) {
|
||||||
QList<InterfaceToolbar *> toolbars = findChildren<InterfaceToolbar *>();
|
QList<InterfaceToolbar *> toolbars = findChildren<InterfaceToolbar *>();
|
||||||
foreach(InterfaceToolbar *toolbar, toolbars) {
|
foreach(InterfaceToolbar *toolbar, toolbars) {
|
||||||
if (capture_in_progress) {
|
if (capture_in_progress) {
|
||||||
|
@ -2541,6 +2542,7 @@ void MainWindow::setForCaptureInProgress(bool capture_in_progress, GArray *iface
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static QList<register_stat_group_t> menu_groups = QList<register_stat_group_t>()
|
static QList<register_stat_group_t> menu_groups = QList<register_stat_group_t>()
|
||||||
<< REGISTER_ANALYZE_GROUP_UNSORTED
|
<< REGISTER_ANALYZE_GROUP_UNSORTED
|
||||||
|
|
|
@ -268,7 +268,7 @@ private:
|
||||||
|
|
||||||
void externalMenuHelper(ext_menu_t * menu, QMenu * subMenu, gint depth);
|
void externalMenuHelper(ext_menu_t * menu, QMenu * subMenu, gint depth);
|
||||||
|
|
||||||
void setForCaptureInProgress(bool capture_in_progress = false, GArray *ifaces = NULL);
|
void setForCaptureInProgress(bool capture_in_progress = false, bool handle_toolbars = false, GArray *ifaces = NULL);
|
||||||
QMenu* findOrAddMenu(QMenu *parent_menu, QString& menu_text);
|
QMenu* findOrAddMenu(QMenu *parent_menu, QString& menu_text);
|
||||||
|
|
||||||
void captureFileReadStarted(const QString &action);
|
void captureFileReadStarted(const QString &action);
|
||||||
|
|
|
@ -501,7 +501,8 @@ void MainWindow::captureCapturePrepared(capture_session *session) {
|
||||||
|
|
||||||
/* Disable menu items that make no sense if you're currently running
|
/* Disable menu items that make no sense if you're currently running
|
||||||
a capture. */
|
a capture. */
|
||||||
setForCaptureInProgress(true, session->capture_opts->ifaces);
|
bool handle_toolbars = (session->session_will_restart ? false : true);
|
||||||
|
setForCaptureInProgress(true, handle_toolbars, session->capture_opts->ifaces);
|
||||||
// set_capture_if_dialog_for_capture_in_progress(TRUE);
|
// set_capture_if_dialog_for_capture_in_progress(TRUE);
|
||||||
|
|
||||||
// /* Don't set up main window for a capture file. */
|
// /* Don't set up main window for a capture file. */
|
||||||
|
@ -515,12 +516,13 @@ void MainWindow::captureCaptureUpdateStarted(capture_session *session) {
|
||||||
switching to the next multiple file. */
|
switching to the next multiple file. */
|
||||||
setTitlebarForCaptureInProgress();
|
setTitlebarForCaptureInProgress();
|
||||||
|
|
||||||
setForCaptureInProgress(true, session->capture_opts->ifaces);
|
bool handle_toolbars = (session->session_will_restart ? false : true);
|
||||||
|
setForCaptureInProgress(true, handle_toolbars, session->capture_opts->ifaces);
|
||||||
|
|
||||||
setForCapturedPackets(true);
|
setForCapturedPackets(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::captureCaptureUpdateFinished(capture_session *) {
|
void MainWindow::captureCaptureUpdateFinished(capture_session *session) {
|
||||||
|
|
||||||
/* The capture isn't stopping any more - it's stopped. */
|
/* The capture isn't stopping any more - it's stopped. */
|
||||||
capture_stopping_ = false;
|
capture_stopping_ = false;
|
||||||
|
@ -530,7 +532,8 @@ void MainWindow::captureCaptureUpdateFinished(capture_session *) {
|
||||||
|
|
||||||
/* Enable menu items that make sense if you're not currently running
|
/* Enable menu items that make sense if you're not currently running
|
||||||
a capture. */
|
a capture. */
|
||||||
setForCaptureInProgress(false);
|
bool handle_toolbars = (session->session_will_restart ? false : true);
|
||||||
|
setForCaptureInProgress(false, handle_toolbars);
|
||||||
setMenusForCaptureFile();
|
setMenusForCaptureFile();
|
||||||
|
|
||||||
setWindowIcon(wsApp->normalIcon());
|
setWindowIcon(wsApp->normalIcon());
|
||||||
|
|
Loading…
Reference in New Issue