Added a function to check for hidden devices, which also work correctly
for plumbed devices on solaris.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@24231
f5534014-38df-0310-8fa8-
9805f1628bb7
/* Is this interface hidden and, if so, should we include it
anyway? */
- if (prefs.capture_devices_hide == NULL ||
- strstr(prefs.capture_devices_hide, if_info->name) == NULL ||
- !do_hide) {
+ if (!prefs_is_capture_device_hidden(if_info->name) || !do_hide) {
/* It's not hidden, or it is but we should include it in the list. */
/* Do we have a user-supplied description? */
prefs DATA
prefs_apply
prefs_apply_all
+prefs_is_capture_device_hidden
prefs_find_module
prefs_get_title_by_name
prefs_is_registered_protocol
return ret;
}
+/*
+ * Returns TRUE if the given device is hidden
+ */
+gboolean
+prefs_is_capture_device_hidden(const char *name)
+{
+ gchar *tok, *devices;
+ size_t len;
+
+ if (prefs.capture_devices_hide && name) {
+ devices = g_strdup (prefs.capture_devices_hide);
+ len = strlen (name);
+ for (tok = strtok (devices, ","); tok; tok = strtok(NULL, ",")) {
+ if (strlen (tok) == len && strcmp (name, tok) == 0) {
+ g_free (devices);
+ return TRUE;
+ }
+ }
+ g_free (devices);
+ }
+
+ return FALSE;
+}
+
#define PRS_PRINT_FMT "print.format"
#define PRS_PRINT_DEST "print.destination"
#define PRS_PRINT_FILE "print.file"
extern prefs_set_pref_e prefs_set_pref(char *prefarg);
+/*
+ * Returns TRUE if the given device is hidden
+ */
+extern gboolean prefs_is_capture_device_hidden(const char *name);
+
#endif /* prefs.h */
for(ifs = 0; (curr = g_list_nth(if_list, ifs)); ifs++) {
g_string_assign(if_tool_str, "");
if_info = curr->data;
+
+ /* Continue if capture device is hidden */
+ if (prefs_is_capture_device_hidden(if_info->name)) {
+ continue;
+ }
+
if_dlg_data = g_malloc0(sizeof(if_dlg_data_t));
if_dlg_data->if_info = *if_info;