summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2017-06-30 15:57:44 +0200
committerMichael Mann <mmann78@netscape.net>2017-07-01 01:24:08 +0000
commit81f98e4e1c8225b13f8d1a8960ab023a022045b6 (patch)
treec48a7f73538989c10988c1f205bb045789510df6
parent050cfef79ca1bf8b4c8e67fbc2a9e83425109943 (diff)
downloadwireshark-81f98e4e1c8225b13f8d1a8960ab023a022045b6.tar.gz
iface_lists: select interfaces via command line (option -i)
The "wireshark -i lo" option somehow did not mark interfaces as selected. It turns out that the "-i" option populates the "ifaces" array during option parsing, but we must also set the "selected" property in the "all_ifaces" array in function "scan_local_interfaces". Bug: 13865 Fixes: v2.3.0rc0-2812-g40a5fb567a ("Restore interface selection after interface refresh") Change-Id: Iacfeaf14efe2696f37f0e021259c59fb677de435 Reviewed-on: https://code.wireshark.org/review/22478 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net> (cherry picked from commit ec1a5b15455c2c0bd5535d5257b2513804140747) Reviewed-on: https://code.wireshark.org/review/22490 Petri-Dish: Michael Mann <mmann78@netscape.net>
-rw-r--r--ui/iface_lists.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/ui/iface_lists.c b/ui/iface_lists.c
index d60c72903b..5b36104050 100644
--- a/ui/iface_lists.c
+++ b/ui/iface_lists.c
@@ -57,8 +57,9 @@ if_list_comparator_alph(const void *first_arg, const void *second_arg)
/*
* Try to populate the given device with options (like capture filter) from
* the capture options that are in use for an existing capture interface.
+ * Returns TRUE if the interface is selected for capture and FALSE otherwise.
*/
-static void
+static gboolean
fill_from_ifaces (interface_t *device)
{
interface_options interface_opts;
@@ -82,8 +83,9 @@ fill_from_ifaces (interface_t *device)
if (interface_opts.linktype != -1) {
device->active_dlt = interface_opts.linktype;
}
- return;
+ return TRUE;
}
+ return FALSE;
}
/*
@@ -309,9 +311,9 @@ scan_local_interfaces(void (*update_cb)(void))
#endif
/* Copy interface options for active capture devices. */
- fill_from_ifaces(&device);
+ gboolean selected = fill_from_ifaces(&device);
/* Restore device selection (for next capture). */
- if (!device.selected && g_hash_table_lookup(selected_devices, device.name)) {
+ if (!device.selected && (selected || g_hash_table_lookup(selected_devices, device.name))) {
device.selected = TRUE;
global_capture_opts.num_selected++;
}