diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2016-01-01 18:00:19 +0100 |
---|---|---|
committer | Stig Bjørlykke <stig@bjorlykke.org> | 2016-01-05 09:13:39 +0000 |
commit | dfbea5d47c449670d6b4e989fec49b1cc680c497 (patch) | |
tree | bb328a05de160302f5d08023210fbc69dab77754 /ui/qt/capture_filter_syntax_worker.cpp | |
parent | 85fd9df235dcf77117b45ade4494c99e983595ec (diff) |
Qt: Don't check capture filter for user DLTs
This makes it possible to use a capture filter on an interface
with user DLTs (147-162).
Bug: 11656
Ping-Bug: 11668
Change-Id: Ie9931b27e8dc8ea239e7e04e26d0ae1cacba50c9
Reviewed-on: https://code.wireshark.org/review/12996
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Diffstat (limited to 'ui/qt/capture_filter_syntax_worker.cpp')
-rw-r--r-- | ui/qt/capture_filter_syntax_worker.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/ui/qt/capture_filter_syntax_worker.cpp b/ui/qt/capture_filter_syntax_worker.cpp index f19d6f0b2a..e38e0e05c9 100644 --- a/ui/qt/capture_filter_syntax_worker.cpp +++ b/ui/qt/capture_filter_syntax_worker.cpp @@ -29,6 +29,7 @@ #endif #include "capture_filter_syntax_worker.h" +#include "syntax_line_edit.h" #include <QMutexLocker> #include <QSet> @@ -58,7 +59,7 @@ void CaptureFilterSyntaxWorker::start() { struct bpf_program fcode; pcap_t *pd; int pc_err; - bool ok = true; + enum SyntaxLineEdit::SyntaxState state = SyntaxLineEdit::Valid; QString err_str; data_mtx_.lock(); @@ -72,7 +73,7 @@ void CaptureFilterSyntaxWorker::start() { data_mtx_.unlock(); if (global_capture_opts.num_selected < 1) { - emit syntaxResult(filter, false, QString("No interfaces selected")); + emit syntaxResult(filter, SyntaxLineEdit::Invalid, QString("No interfaces selected")); DEBUG_SYNTAX_CHECK("unknown", "no interfaces"); continue; } @@ -82,7 +83,13 @@ void CaptureFilterSyntaxWorker::start() { device = g_array_index(global_capture_opts.all_ifaces, interface_t, if_idx); if (!device.locked && device.selected) { - active_dlts.insert(device.active_dlt); + 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); + } } } @@ -97,7 +104,7 @@ void CaptureFilterSyntaxWorker::start() { if (pc_err) { DEBUG_SYNTAX_CHECK("unknown", "known bad"); - ok = false; + state = SyntaxLineEdit::Invalid; err_str = pcap_geterr(pd); } else { DEBUG_SYNTAX_CHECK("unknown", "known good"); @@ -106,9 +113,9 @@ void CaptureFilterSyntaxWorker::start() { pcap_compile_mtx_.unlock(); - if (!ok) break; + if (state == SyntaxLineEdit::Invalid) break; } - emit syntaxResult(filter, ok, err_str); + emit syntaxResult(filter, state, err_str); DEBUG_SYNTAX_CHECK("known", "idle"); } @@ -124,7 +131,7 @@ void CaptureFilterSyntaxWorker::checkFilter(const QString &filter) DEBUG_SYNTAX_CHECK("received", "?"); data_cond_.wakeOne(); #else - emit syntaxResult(filter, true, QString("Syntax checking unavailable")); + emit syntaxResult(filter, SyntaxLineEdit::Deprecated, QString("Syntax checking unavailable")); #endif // HAVE_LIBPCAP } |