summaryrefslogtreecommitdiff
path: root/capture_opts.c
diff options
context:
space:
mode:
authorMartin Kaiser <wireshark@kaiser.cx>2014-07-04 18:18:07 -0400
committerEvan Huus <eapache@gmail.com>2014-07-12 14:06:03 +0000
commit55733ea17021b160c17df09b3d3a602386c8586f (patch)
tree643de689cebc98b02f41f4fc6f79170fa844d62f /capture_opts.c
parent5fda232659f25bedbf426dfc25f174119614229f (diff)
downloadwireshark-55733ea17021b160c17df09b3d3a602386c8586f.tar.gz
fix scan_local_interfaces()
when we delete an interface from all_ifaces, delete it from ifaces as well remove its selected status if it was selected at the moment, an interface that was used for capturing before will never be removed from the list of interfaces even if it becomes unavailable as it remains in ifaces and will be re-added to all_ifaces in scan_local_interfaces() new helper function capture_opts_del_iface() to delete an entry from ifaces and free all its components Change-Id: Ie3271a7ed086367e511d3a971f3b68cfc014115d Reviewed-on: https://code.wireshark.org/review/2965 Reviewed-by: Evan Huus <eapache@gmail.com>
Diffstat (limited to 'capture_opts.c')
-rw-r--r--capture_opts.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/capture_opts.c b/capture_opts.c
index 57139662a8..1d4921fa91 100644
--- a/capture_opts.c
+++ b/capture_opts.c
@@ -1013,20 +1013,14 @@ capture_opts_output_to_pipe(const char *save_file, gboolean *is_pipe)
return 0;
}
-/*
- * Add all non-hidden selected interfaces in the "all interfaces" list
- * to the list of interfaces for the capture.
- */
void
-collect_ifaces(capture_options *capture_opts)
+capture_opts_del_iface(capture_options *capture_opts, guint index)
{
- guint i;
- interface_t device;
interface_options interface_opts;
- /* Empty out the existing list of interfaces. */
- for (i = capture_opts->ifaces->len; i != 0; i--) {
- interface_opts = g_array_index(capture_opts->ifaces, interface_options, i - 1);
+ interface_opts = g_array_index(capture_opts->ifaces, interface_options, index);
+ /* XXX - check if found? */
+
g_free(interface_opts.name);
g_free(interface_opts.descr);
if (interface_opts.console_display_name != NULL)
@@ -1040,8 +1034,25 @@ collect_ifaces(capture_options *capture_opts)
g_free(interface_opts.auth_password);
}
#endif
- capture_opts->ifaces = g_array_remove_index(capture_opts->ifaces, i - 1);
- }
+ capture_opts->ifaces = g_array_remove_index(capture_opts->ifaces, index);
+}
+
+
+
+/*
+ * Add all non-hidden selected interfaces in the "all interfaces" list
+ * to the list of interfaces for the capture.
+ */
+void
+collect_ifaces(capture_options *capture_opts)
+{
+ guint i;
+ interface_t device;
+ interface_options interface_opts;
+
+ /* Empty out the existing list of interfaces. */
+ for (i = capture_opts->ifaces->len; i != 0; i--)
+ capture_opts_del_iface(capture_opts, i-1);
/* Now fill the list up again. */
for (i = 0; i < capture_opts->all_ifaces->len; i++) {