summaryrefslogtreecommitdiff
path: root/ui
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 /ui
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 'ui')
-rw-r--r--ui/iface_lists.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/ui/iface_lists.c b/ui/iface_lists.c
index b28236b177..a0b75af240 100644
--- a/ui/iface_lists.c
+++ b/ui/iface_lists.c
@@ -86,6 +86,25 @@ scan_local_interfaces(void (*update_cb)(void))
device = g_array_index(global_capture_opts.all_ifaces, interface_t, i);
if (device.local && device.type != IF_PIPE && device.type != IF_STDIN) {
global_capture_opts.all_ifaces = g_array_remove_index(global_capture_opts.all_ifaces, i);
+
+ if (device.selected) {
+ global_capture_opts.num_selected--;
+ /* if device was to be used after this statement,
+ we should set device.selected=FALSE here */
+ }
+
+ /* if we remove an interface from all_interfaces,
+ it must also be removed from ifaces if it is present there
+ otherwise, it would be re-added to all_interfaces below
+ (interfaces set with -i on the command line are initially present in ifaces but not
+ in all_interfaces, but these interfaces are not removed here) */
+ for (j = 0; j < global_capture_opts.ifaces->len; j++) {
+ interface_opts = g_array_index(global_capture_opts.ifaces, interface_options, j);
+ if (strcmp(device.name, interface_opts.name) == 0) {
+ /* 2nd param must be the index of ifaces (not all_ifaces) */
+ capture_opts_del_iface(&global_capture_opts, j);
+ }
+ }
}
}
}