diff options
author | Dario Lombardo <lomato@gmail.com> | 2018-01-07 22:06:13 +0100 |
---|---|---|
committer | Roland Knall <rknall@gmail.com> | 2018-01-09 09:58:48 +0000 |
commit | 22b5ffad861b2efede6d64d16e38710d2c713ba1 (patch) | |
tree | 3987df75222880846fa9a07dea6edf088bd1e54a | |
parent | 0a8d6cf97e0dccc02cb36f2636feb053725118da (diff) |
extcap: add preference to prevent interfaces loading.
Change-Id: Ia5865a40c75e582f28408a0515c5c0b38e43a916
Reviewed-on: https://code.wireshark.org/review/25188
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
-rw-r--r-- | epan/prefs.c | 3 | ||||
-rw-r--r-- | epan/prefs.h | 1 | ||||
-rw-r--r-- | extcap.c | 3 | ||||
-rw-r--r-- | ui/qt/capture_preferences_frame.cpp | 8 | ||||
-rw-r--r-- | ui/qt/capture_preferences_frame.h | 2 | ||||
-rw-r--r-- | ui/qt/capture_preferences_frame.ui | 9 |
6 files changed, 25 insertions, 1 deletions
diff --git a/epan/prefs.c b/epan/prefs.c index b06e7dfb30..f0edfcbb24 100644 --- a/epan/prefs.c +++ b/epan/prefs.c @@ -3470,6 +3470,9 @@ prefs_register_modules(void) prefs_register_bool_preference(capture_module, "real_time_update", "Update packet list in real time during capture", "Update packet list in real time during capture?", &prefs.capture_real_time); + prefs_register_bool_preference(capture_module, "no_extcap", "Disable Extcap interfaces", + "Disable external capture modules (Extcap)", &prefs.capture_no_extcap); + /* We might want to make this a "recent" setting. */ prefs_register_bool_preference(capture_module, "auto_scroll", "Scroll packet list during capture", "Scroll packet list during capture?", &prefs.capture_auto_scroll); diff --git a/epan/prefs.h b/epan/prefs.h index 2eb7fbbfbd..de3b239d3f 100644 --- a/epan/prefs.h +++ b/epan/prefs.h @@ -213,6 +213,7 @@ typedef struct _e_prefs { gboolean capture_pcap_ng; gboolean capture_real_time; gboolean capture_auto_scroll; + gboolean capture_no_extcap; gboolean capture_show_info; GList *capture_columns; guint rtp_player_max_visible; @@ -506,6 +506,9 @@ append_extcap_interface_list(GList *list, char **err_str _U_) extcap_interface *data = NULL; GList *ifutilkeys_head = NULL, *ifutilkeys = NULL; + if (prefs.capture_no_extcap) + return list; + /* Update the extcap interfaces and get a list of their if_infos */ if ( !_loaded_interfaces || g_hash_table_size(_loaded_interfaces) == 0 ) extcap_load_interface_list(); diff --git a/ui/qt/capture_preferences_frame.cpp b/ui/qt/capture_preferences_frame.cpp index 2a7baf9c5d..2fd6aadea6 100644 --- a/ui/qt/capture_preferences_frame.cpp +++ b/ui/qt/capture_preferences_frame.cpp @@ -50,6 +50,7 @@ CapturePreferencesFrame::CapturePreferencesFrame(QWidget *parent) : pref_pcap_ng_ = prefFromPrefPtr(&prefs.capture_pcap_ng); pref_real_time_ = prefFromPrefPtr(&prefs.capture_real_time); pref_auto_scroll_ = prefFromPrefPtr(&prefs.capture_auto_scroll); + pref_no_extcap_ = prefFromPrefPtr(&prefs.capture_no_extcap); // Setting the left margin via a style sheet clobbers its // appearance. @@ -117,6 +118,7 @@ void CapturePreferencesFrame::updateWidgets() ui->captureRealTimeCheckBox->setChecked(prefs_get_bool_value(pref_real_time_, pref_stashed)); ui->captureAutoScrollCheckBox->setChecked(prefs_get_bool_value(pref_auto_scroll_, pref_stashed)); #endif // HAVE_LIBPCAP + ui->captureNoExtcapCheckBox->setChecked(prefs_get_bool_value(pref_no_extcap_, pref_stashed)); } void CapturePreferencesFrame::on_defaultInterfaceComboBox_editTextChanged(const QString &new_iface) @@ -144,6 +146,12 @@ void CapturePreferencesFrame::on_captureAutoScrollCheckBox_toggled(bool checked) prefs_set_bool_value(pref_auto_scroll_, checked, pref_stashed); } +void CapturePreferencesFrame::on_captureNoExtcapCheckBox_toggled(bool checked) +{ + prefs_set_bool_value(pref_no_extcap_, checked, pref_stashed); + wsApp->refreshLocalInterfaces(); +} + /* * Editor modelines * diff --git a/ui/qt/capture_preferences_frame.h b/ui/qt/capture_preferences_frame.h index 1932396a9a..0806436b89 100644 --- a/ui/qt/capture_preferences_frame.h +++ b/ui/qt/capture_preferences_frame.h @@ -47,6 +47,7 @@ private slots: void on_capturePcapNgCheckBox_toggled(bool checked); void on_captureRealTimeCheckBox_toggled(bool checked); void on_captureAutoScrollCheckBox_toggled(bool checked); + void on_captureNoExtcapCheckBox_toggled(bool checked); private: Ui::CapturePreferencesFrame *ui; @@ -56,6 +57,7 @@ private: pref_t *pref_pcap_ng_; pref_t *pref_real_time_; pref_t *pref_auto_scroll_; + pref_t *pref_no_extcap_; void updateWidgets(); }; diff --git a/ui/qt/capture_preferences_frame.ui b/ui/qt/capture_preferences_frame.ui index 66d56bc550..9e15529339 100644 --- a/ui/qt/capture_preferences_frame.ui +++ b/ui/qt/capture_preferences_frame.ui @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>354</width> - <height>194</height> + <height>220</height> </rect> </property> <property name="minimumSize"> @@ -98,6 +98,13 @@ </widget> </item> <item> + <widget class="QCheckBox" name="captureNoExtcapCheckBox"> + <property name="text"> + <string>Disable Extcap interfaces</string> + </property> + </widget> + </item> + <item> <spacer name="verticalSpacer"> <property name="orientation"> <enum>Qt::Vertical</enum> |