extcap: add preference to prevent interfaces loading.
authorDario Lombardo <lomato@gmail.com>
Sun, 7 Jan 2018 21:06:13 +0000 (22:06 +0100)
committerRoland Knall <rknall@gmail.com>
Tue, 9 Jan 2018 09:58:48 +0000 (09:58 +0000)
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>
epan/prefs.c
epan/prefs.h
extcap.c
ui/qt/capture_preferences_frame.cpp
ui/qt/capture_preferences_frame.h
ui/qt/capture_preferences_frame.ui

index b06e7dfb30c358fd20a3f01966e3c161f2f52af7..f0edfcbb2467994a226091ccd9b0dc2ca14e8e30 100644 (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);
index 2eb7fbbfbd119a26a3d26c7f322510c458a79d97..de3b239d3f43444f2284f812479bbbfdb20b77fb 100644 (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;
index 03aada8a9ffa0b49eeb3c6dbf31d611b28ed4a20..44ed5b5ad211650cfdc1271445465cfe46699cf8 100644 (file)
--- a/extcap.c
+++ b/extcap.c
@@ -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();
index 2a7baf9c5dfda9b244ce14c56a329efa11cd60b2..2fd6aadea615c1e1870576357b8daf5264101d5a 100644 (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
  *
index 1932396a9aa6facaf4bd05263c8e7256d9aa2c98..0806436b89237928bb3254c503eb98e1675ee43c 100644 (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();
 };
index 66d56bc550ca63fa6b2b579df24e57e53f0e2cee..9e15529339484be11dc0feb564b1e159cca2b28e 100644 (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">
      </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">