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>
This commit is contained in:
Dario Lombardo 2018-01-07 22:06:13 +01:00 committed by Roland Knall
parent 0a8d6cf97e
commit 22b5ffad86
6 changed files with 25 additions and 1 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>354</width>
<height>194</height>
<height>220</height>
</rect>
</property>
<property name="minimumSize">
@ -97,6 +97,13 @@
</property>
</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">