summaryrefslogtreecommitdiff
path: root/ui/qt
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2017-05-25 14:36:44 -0400
committerMichael Mann <mmann78@netscape.net>2017-05-25 22:14:45 +0000
commit9bd2b63968ecde680cdee8e8eff43e526ef178f4 (patch)
treed52f0bf83161396c9aa244fe018616076f010a9a /ui/qt
parentf33363c38613d86432adb072f7debabb1f37424c (diff)
downloadwireshark-9bd2b63968ecde680cdee8e8eff43e526ef178f4.tar.gz
Don't try to compile capture filter if pcap_compile isn't available.
This is most likely due to WinPcap not being installed. Bug: 13672 Change-Id: Ic7069f98c7f8068cdc5045204c2e23ab56b3f7eb Reviewed-on: https://code.wireshark.org/review/21757 Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'ui/qt')
-rw-r--r--ui/qt/capture_filter_syntax_worker.cpp28
-rw-r--r--ui/qt/compiled_filter_output.cpp2
2 files changed, 24 insertions, 6 deletions
diff --git a/ui/qt/capture_filter_syntax_worker.cpp b/ui/qt/capture_filter_syntax_worker.cpp
index dc3edbfe0c..e2dae2bac0 100644
--- a/ui/qt/capture_filter_syntax_worker.cpp
+++ b/ui/qt/capture_filter_syntax_worker.cpp
@@ -87,19 +87,35 @@ void CaptureFilterSyntaxWorker::start() {
device = g_array_index(global_capture_opts.all_ifaces, interface_t, if_idx);
if (!device.locked && device.selected) {
- if (device.active_dlt >= DLT_USER0 && device.active_dlt <= DLT_USER15) {
- // Capture filter for DLT_USER is unknown
- state = SyntaxLineEdit::Deprecated;
- err_str = "Unable to check capture filter";
- } else {
- active_dlts.insert(device.active_dlt);
+#ifdef HAVE_EXTCAP
+ if (device.if_info.extcap == NULL)
+ {
+#endif
+ if (device.active_dlt >= DLT_USER0 && device.active_dlt <= DLT_USER15) {
+ // Capture filter for DLT_USER is unknown
+ state = SyntaxLineEdit::Deprecated;
+ err_str = "Unable to check capture filter";
+ } else {
+ active_dlts.insert(device.active_dlt);
+ }
+#ifdef HAVE_EXTCAP
+ }
+ else
+ {
+ //TODO: Verify extcap capture file (bug 11668)
}
+#endif
}
}
foreach (gint dlt, active_dlts.toList()) {
pcap_compile_mtx_.lock();
pd = pcap_open_dead(dlt, DUMMY_SNAPLENGTH);
+ if (pd == NULL)
+ {
+ //don't have ability to verify capture filter
+ break;
+ }
#ifdef PCAP_NETMASK_UNKNOWN
pc_err = pcap_compile(pd, &fcode, filter.toUtf8().constData(), 1 /* Do optimize */, PCAP_NETMASK_UNKNOWN);
#else
diff --git a/ui/qt/compiled_filter_output.cpp b/ui/qt/compiled_filter_output.cpp
index 43096aa1df..ca718259a4 100644
--- a/ui/qt/compiled_filter_output.cpp
+++ b/ui/qt/compiled_filter_output.cpp
@@ -89,6 +89,8 @@ void CompiledFilterOutput::compileFilter()
continue;
} else {
pcap_t *pd = pcap_open_dead(device.active_dlt, WTAP_MAX_PACKET_SIZE);
+ if (pd == NULL)
+ break;
g_mutex_lock(pcap_compile_mtx);
if (pcap_compile(pd, &fcode, compile_filter_.toUtf8().constData(), 1, 0) < 0) {
compile_results.insert(interfaces, QString("%1").arg(g_strdup(pcap_geterr(pd))));